Mercurial > emacs
changeset 91048:d38543a1c0f9
Merge from emacs--devo--0
Patches applied:
* emacs--devo--0 (patch 880-885)
- Remove RCS keywords from doc/misc/cc-mode.texi
- Update from CVS
Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-264
line wrap: on
line diff
--- a/admin/FOR-RELEASE Fri Oct 12 21:57:45 2007 +0000 +++ b/admin/FOR-RELEASE Sat Oct 13 05:53:03 2007 +0000 @@ -24,7 +24,7 @@ ** Try to reorder NEWS: most important things first, related items together. -* WINDOWS SUPPORT BUGS. +* WINDOWS SUPPORT BUGS These don't need to be fixed before a release, but we call the attention of Windows users to fixing them. @@ -43,6 +43,11 @@ reported on emacs-devel that he was not able to reproduce the bug on a GNU/Linux system. +* BUGS WAITING FOR MORE USER INPUT + +** raman@users.sf.net, sep 7: Emacs 23.0.50: Segfaults in alloc.c (batch process) +http://lists.gnu.org/archive/html/emacs-devel/2007-09/msg00690.html + * BUGS ** Document the changes introduced by multi-tty @@ -56,9 +61,6 @@ ** Why were the calls to x_fully_uncatch_errors commented out in eval.c? http://lists.gnu.org/archive/html/emacs-devel/2007-09/msg01987.html -** raman@users.sf.net, sep 7: Emacs 23.0.50: Segfaults in alloc.c (batch process) -http://lists.gnu.org/archive/html/emacs-devel/2007-09/msg00690.html - ** grep et al should use font-lock to do highlighting, so that they respect font-lock-mode. "can't turn off font-lock" http://lists.gnu.org/archive/html/emacs-devel/2007-08/msg00548.html @@ -99,26 +101,26 @@ SECTION READERS ---------------------------------- -etc/TUTORIAL rms -etc/TUTORIAL.bg Ognyan Kulev <ogi@fmi.uni-sofia.bg> +etc/TUTORIAL +etc/TUTORIAL.bg etc/TUTORIAL.cn -etc/TUTORIAL.cs Pavel Janík <Pavel@Janik.cz> -etc/TUTORIAL.de Werner LEMBERG <wl@gnu.org> +etc/TUTORIAL.cs +etc/TUTORIAL.de etc/TUTORIAL.eo -etc/TUTORIAL.es Marcelo Toledo -etc/TUTORIAL.fr ttn -etc/TUTORIAL.it ttn -etc/TUTORIAL.ja Kenichi Handa <handa@m17n.org> +etc/TUTORIAL.es +etc/TUTORIAL.fr +etc/TUTORIAL.it +etc/TUTORIAL.ja etc/TUTORIAL.ko -etc/TUTORIAL.nl Lute Kamstra -etc/TUTORIAL.pl Slawomir Nowaczyk <slawek@cs.lth.se> -etc/TUTORIAL.pt_BR Marcelo Toledo +etc/TUTORIAL.nl +etc/TUTORIAL.pl +etc/TUTORIAL.pt_BR etc/TUTORIAL.ro -etc/TUTORIAL.ru Alex Ott <alexott@gmail.com> -etc/TUTORIAL.sk Pavel Janík <Pavel@Janik.cz> -etc/TUTORIAL.sl Primoz PETERLIN <primoz.peterlin@biofiz.mf.uni-lj.si> -etc/TUTORIAL.sv Mats Lidell <matsl@contactor.se> -etc/TUTORIAL.th Virach Sornlertlamvanich <virach@tcllab.org> +etc/TUTORIAL.ru +etc/TUTORIAL.sk +etc/TUTORIAL.sl +etc/TUTORIAL.sv +etc/TUTORIAL.th etc/TUTORIAL.zh
--- a/doc/emacs/ChangeLog Fri Oct 12 21:57:45 2007 +0000 +++ b/doc/emacs/ChangeLog Sat Oct 13 05:53:03 2007 +0000 @@ -1,6 +1,26 @@ +2007-10-13 Glenn Morris <rgm@gnu.org> + + * misc.texi (Interactive Shell): Correct INSIDE_EMACS reference. + +2007-10-11 Eric S. Raymond <esr@snark.thyrsus.com> + + * emacs.texi: + * files.texi (Version Systems): Minor fixes to version-control material + suggseted by RMS and Robert J. Chassell. + +2007-10-10 Eric S. Raymond <esr@snark.thyrsus.com> + + * files.texi (Version Systems): + * vc-xtra.texi: + * vc1-xtra.texi: + * vc2-xtra.texi: Merge in changes for new VC with fileset-oriented + operations. Change of terminology from 'version' to `revision'. + Revise text for adequate description of VCSes with monotonic IDs. + * emacs.texi: Change of terminology from 'version' to `revision'. + 2007-10-09 Eric S. Raymond <esr@snark.thyrsus.com> - * files.texi (Version Systems): Describe newerte VCses. + * files.texi (Version Systems): Describe newer VCses. Reorder the descriptions to be chronological. 2007-10-04 Nick Roberts <nickrob@snap.net.nz>
--- a/doc/emacs/emacs.texi Fri Oct 12 21:57:45 2007 +0000 +++ b/doc/emacs/emacs.texi Sat Oct 13 05:53:03 2007 +0000 @@ -460,7 +460,7 @@ * Introduction to VC:: How version control works in general. * VC Mode Line:: How the mode line shows version control status. * Basic VC Editing:: How to edit a file under version control. -* Old Versions:: Examining and comparing old versions. +* Old Revisions:: Examining and comparing old revisions of files. * Secondary VC Commands:: The commands used a little less frequently. * Branches:: Multiple lines of development. * Remote Repositories:: Efficient access to remote CVS servers.
--- a/doc/emacs/files.texi Fri Oct 12 21:57:45 2007 +0000 +++ b/doc/emacs/files.texi Sat Oct 13 05:53:03 2007 +0000 @@ -1213,11 +1213,10 @@ The Emacs version control interface is called VC. Its commands work with different version control systems---currently, it supports CVS, GNU Arch, RCS, Meta-CVS, Subversion, and SCCS. Of these, the GNU -project distributes CVS, GNU Arch, and RCS; we recommend that you use -either CVS or GNU Arch for your projects, and RCS for individual -files. We also have free software to replace SCCS, known as CSSC; if -you are using SCCS and don't want to make the incompatible change to -RCS or CVS, you can switch to CSSC. +project distributes CVS, GNU Arch, and RCS. We also have free +software to replace SCCS, known as CSSC; if you are using SCCS and +don't want to make the incompatible change to RCS or CVS, you can +switch to CSSC. VC is enabled by default in Emacs. To disable it, set the customizable variable @code{vc-handled-backends} to @code{nil} @@ -1233,7 +1232,7 @@ * Introduction to VC:: How version control works in general. * VC Mode Line:: How the mode line shows version control status. * Basic VC Editing:: How to edit a file under version control. -* Old Versions:: Examining and comparing old versions. +* Old Revisions:: Examining and comparing old versions. * Secondary VC Commands:: The commands used a little less frequently. * Branches:: Multiple lines of development. @ifnottex @@ -1250,7 +1249,7 @@ VC allows you to use a version control system from within Emacs, integrating the version control operations smoothly with editing. Though VC cannot completely bridge the gaps between version-control -systems with widely differing capabilities, it does provide +systems with widely differing capabilities, it does provide a uniform interface to many version control operations. Regardless of which version control system is in use, you will be able to do basic operations in much the same way. @@ -1261,10 +1260,10 @@ you want to use. @menu -* Why Version Control?:: Understanding the problems it addresses -* Version Systems:: Supported version control back-end systems. -* VC Concepts:: Words and concepts related to version control. -* Types of Log File:: The per-file VC log in contrast to the ChangeLog. +* Why Version Control?:: Understanding the problems it addresses +* Version Control Systems:: Supported version control back-end systems. +* VCS Concepts:: Words and concepts related to version control. +* Types of Log File:: The VCS log in contrast to the ChangeLog. @end menu @node Why Version Control? @@ -1287,7 +1286,7 @@ are an important aid to memory; for a multi-person project they become a vitally important form of communication among developers. -@node Version Systems +@node Version Control Systems @subsubsection Supported Version Control Systems @cindex back end (version control) @@ -1368,11 +1367,11 @@ @cindex Mercurial Mercurial is a distributed version-control systems broadly resembling GNU Arch and git, with atomic fileset commits and -rename/move histories. Like git it is fully decventralized. +rename/move histories. Like git it is fully decentralized. VC fully supports Mercurial, except for repository sync operations which still need to be done from the command line. -@node VC Concepts +@node VCS Concepts @subsubsection Concepts of Version Control @cindex repository @@ -1387,11 +1386,22 @@ @cindex work file @cindex checking out files - A file checked out of a version-control repository is sometimes called -the @dfn{work file}. You edit the work file and make changes in it, as -you would with an ordinary file. After you are done with a set of -changes, you @dfn{check the file in}, which records the changes in the -repository, along with a log entry for them. + A file checked out of a version-control repository is sometimes +called the @dfn{work file}. You edit the work file and make changes +in it, as you would with an ordinary file. After you are done with a +set of changes, you @dfn{check in} or @dfn{commit} the file, which +records the changes in the repository, along with a log entry for +them. + +@cindex revision +@cindex revision ID + A copy of a file stored in a repository is called a @dfn{revision}. +The history of a file is a sequence of revisions. Each revisions is +named by a @dfn{revision ID}. In older VCSes (such as SCCS and RCS), +the simplest kind of revision ID consisted of a @dfn{dot-pair}; +integers (the @dfn{major} and @dfn{minor} revisions) separated by a +dot. Newer VCSes tend to use @dfn{monotonic} revision IDs that are +simple integers counting from 1. To go beyond these basic concepts, you will need to understand three ways in which version-control systems can differ from each other. They @@ -1417,7 +1427,7 @@ to lock the file to make further changes. By contrast, a merging system lets each user check out and modify a -work file at any time. When you check in a a file, the system will +work file at any time. When you check in a file, the system will attempt to merge your changes with any others checked into the repository since you checked out the file. @@ -1429,14 +1439,15 @@ checked in by someone else after your checkout. Both kinds of conflict have to be resolved by human judgment and communication. - SCCS always uses locking. RCS is lock-based by default but can be told -to operate in a merging style. CVS is merge-based by default but can -be told to operate in a locking mode. Most later version-control -systems, such as Subversion and GNU Arch, have been fundamentally -merging-based rather than locking-based. This is because experience -has shown that the merging-based approach is generally superior to -the locking one, both in convenience to developers and in minimizing -the number and severity of conflicts that actually occur. + SCCS always uses locking. RCS is lock-based by default but can be +told to operate in a merging style. CVS and Subversion are +merge-based by default but can be told to operate in a locking mode. +Most later version-control systems, such as GNU Arch, git, and +Mercurial, have been based exclusively on merging rather than locking. +This is because experience has shown that the merging-based approach +is generally superior to the locking one, both in convenience to +developers and in minimizing the number and severity of conflicts that +actually occur. While it is rather unlikely that anyone will ever again build a fundamentally locking-based rather than merging-based version-control @@ -1448,14 +1459,14 @@ between them as much as possible. @cindex files versus changesets. - On SCCS. RCS, CVS, and other early version-control systems, checkins + On SCCS, RCS, CVS, and other early version-control systems, checkins and other operations are @dfn{file-based}; each file has its own -@dfn{master file} with its own comment- and revision history separate +@dfn{master file} with its own comment and revision history separate from that of all other files in the system. Later systems, beginning -with Subversion, are @dfn{changeset-based}; a checkin may include -changes to several files and that change set is treated as a unit by the -system. Any comment associated with the change doesn't belong to any -one file, but is attached to the changeset itself. +with Subversion, became @dfn{changeset-based}; a checkin under these +may include changes to several files and that change set is treated as +a unit by the system. Any comment associated with the change belongs +to no single file, but is attached to the changeset itself. Changeset-based version control is in general both more flexible and more powerful than file-based version control; usually, when a change to @@ -1465,22 +1476,30 @@ there are lots of legacy repositories still to be dealt with at time of writing in 2007. + In fact, older versions of VC mode supported only file-based systems, +leading to some unhappy results when it was used to drive +changeset-based ones---the Subversion support, for example, used to break +up changesets into multiple per-file commits. This has been fixed, but +it has left a legacy in VC-mode's terminology. The terms ``checkin'' +and ``checkout'' are associated with file-based and locking-based +systems and a bit archaic; nowadays those operations are usually called +``commit'' and ``update''. + @cindex centralized vs. decentralized - Early version-control systems were designed around a @dfn{centralized} model in which each project has only one repository used by all developers. SCCS, RCS, CVS, and Subversion share this kind of model. It has two important problems. One is that a single repository is a -single point of failure--if the repository server is down all work +single point of failure---if the repository server is down all work stops. The other is that you need to be connected live to the server to do checkins and checkouts; if you're offline, you can't work. - Newer version-control systems like GNU Arch are @dfn{decentralized}. -A project may have several different repositories, and these systems -support a sort of super-merge between repositories that tries to -reconcile their change histories. At the limit, each developer has -his/her own repository, and repository merges replace checkin/commit -operations. + Newer version-control systems like GNU Arch, git, Mercurial, and Bzr +are @dfn{decentralized}. A project may have several different +repositories, and these systems support a sort of super-merge between +repositories that tries to reconcile their change histories. At the +limit, each developer has his/her own repository, and repository +merges replace checkin/commit operations. VC's job is to help you manage the traffic between your personal workfiles and a repository. Whether that repository is a single master @@ -1553,7 +1572,7 @@ this on the mode line. For example, @samp{RCS-1.3} says that RCS is used for that file, and the current version is 1.3. - The character between the back-end name and the version number + The character between the back-end name and the revision ID indicates the version control status of the file. @samp{-} means that the work file is not locked (if locking is in use), or not modified (if locking is not in use). @samp{:} indicates that the file is locked, or @@ -1575,8 +1594,56 @@ @node Basic VC Editing @subsection Basic Editing under Version Control +@menu +* Selecting a fileset:: Choosing a set of files to operate on +* Doing the next logical thing:: Stepping forward in the development cycle +* VC with a locking VCS:: RCS in its default mode, SCCS, and optionally CVS. +* VC with a merging VCS:: Without locking: default mode for CVS. +* Advanced C-x v v:: Advanced features available with a prefix argument. +* Log Buffer:: Features available in log entry buffers. +@end menu + +@node Selecting a fileset +@subsubsection Choosing the scope of your command + +@cindex filesets + Most VC commands operate on @dfn{filesets}. A fileset is a +group of files that you have chosen to treat as a unit at the +time you perform the command. Filesets are the way that VC +mode bridges the gap between file-based and changeset-based +version-control systems. + + If you are visiting a version-controlled file in the current buffer, +the default fileset for any command is simply that one file. If you +are visiting a VC Dired buffer, and some files in it are marked, +your fileset is the marked files only. + + All files in a fileset must be under the same version-control system. +If they are not, VC mode will fail when you attempt to execute +a command on the fileset. + + In VC, filesets, are, essentially, a way to pass multiple file +arguments as a group to underlying version-control commands. For +example, on Subversion a checkin with more than one file in its +fileset will become a joint commit, as though you had typed +@command{svn commit} with those file arguments at the shell command +line in the directory of the selected buffer. + + If you are accustomed to earlier versions of VC, the change in behavior +you will notice is in VC-Dired mode. Other than @kbd{C-x v v}, most +VC-mode commands once operated on only one file selected by the line +the cursor is on. The change in the behavior of @kbd{C-x v v} outside +VC-Dired mode is more subtle. Formerly it operated in parallel on all +marked files, but did not pass them to the version-control backends as +a group. Now it does, which enables VC to drive changeset-based +version-control systems. + +@node Doing the next logical thing +@subsubsection Performing the next operation in the development cycle + The principal VC command is an all-purpose command that performs -either locking or check-in, depending on the situation. +either locking or check-in on your current fileset, depending on +the situation. @table @kbd @itemx C-x v v @@ -1600,14 +1667,7 @@ achieve this, bind the key @kbd{C-x C-q} to @kbd{vc-toggle-read-only} in your @file{~/.emacs} file. (@xref{Init Rebinding}.) -@menu -* VC with Locking:: RCS in its default mode, SCCS, and optionally CVS. -* Without Locking:: Without locking: default mode for CVS. -* Advanced C-x v v:: Advanced features available with a prefix argument. -* Log Buffer:: Features available in log entry buffers. -@end menu - -@node VC with Locking +@node VC with a locking VCS @subsubsection Basic Version Control with Locking If locking is used for the file (as with SCCS, and RCS in its default @@ -1621,7 +1681,7 @@ @item If the file is locked by you, and contains changes, @kbd{C-x v v} checks in the changes. In order to do this, it first reads the log entry -for the new version. @xref{Log Buffer}. +for the new revision. @xref{Log Buffer}. @item If the file is locked by you, but you have not changed it since you @@ -1638,18 +1698,19 @@ These rules also apply when you use CVS in locking mode, except that there is no such thing as stealing a lock. -@node Without Locking -@subsubsection Basic Version Control without Locking +@node VC with a merging VCS +@subsubsection Basic Version Control with Merging When your version-control system is merging-based rather than locking-based---the default for CVS and Subversion, and the way GNU -Arch always works---work files are always writable; you do not need to -do anything before you begin to edit a file. The status indicator on -the mode line is @samp{-} if the file is unmodified; it flips to -@samp{:} as soon as you save any changes in the work file. +Arch and more modern systems always work---work files are always +writable; you do not need to do anything before you begin to edit a +file. The status indicator on the mode line is @samp{-} if the file +is unmodified; it flips to @samp{:} as soon as you save any changes in +the work file. Here is what @kbd{C-x v v} does when using a merging-based system -(such as CVS or Subversion in their defaiult merging mode): +(such as CVS or Subversion in their default merging mode): @itemize @bullet @item @@ -1663,7 +1724,7 @@ @item If there are no new changes in the repository, but you have made modifications in your work file, @kbd{C-x v v} checks in your changes. -In order to do this, it first reads the log entry for the new version. +In order to do this, it first reads the log entry for the new revision. @xref{Log Buffer}. @item @@ -1675,9 +1736,9 @@ repository is not implemented. Unfortunately, this means that nothing informs you if another user has checked in changes in the same file since you began editing it, and when this happens, his changes will be -effectively removed when you check in your version (though they will +effectively removed when you check in your revision (though they will remain in the repository, so they will not be entirely lost). You must -therefore verify that the current version is unchanged, before you +therefore verify that the current revision is unchanged, before you check in your changes. In addition, locking is possible with RCS even in this mode, although @@ -1690,7 +1751,7 @@ @node Advanced C-x v v @subsubsection Advanced Control in @kbd{C-x v v} -@cindex version number to check in/out +@cindex revision ID to check in/out When you give a prefix argument to @code{vc-next-action} (@kbd{C-u C-x v v}), it still performs the next logical version control operation, but accepts additional arguments to specify precisely how @@ -1698,21 +1759,21 @@ @itemize @bullet @item -If the file is modified (or locked), you can specify the version -number to use for the new version that you check in. This is one way +If the file is modified (or locked), you can specify the revision ID +to use for the new version that you check in. This is one way to create a new branch (@pxref{Branches}). @item If the file is not modified (and unlocked), you can specify the -version to select; this lets you start working from an older version, -or on another branch. If you do not enter any version, that takes you -to the highest version on the current branch; therefore @kbd{C-u C-x -v v @key{RET}} is a convenient way to get the latest version of a file from -the repository. +revision to select; this lets you start working from an older +revision, or on another branch. If you do not enter any revision, +that takes you to the highest (``head'') revision on the current +branch; therefore @kbd{C-u C-x v v @key{RET}} is a convenient way to +get the latest version of a file from the repository. @item @cindex specific version control system -Instead of the version number, you can also specify the name of a +Instead of the revision ID, you can also specify the name of a version control system. This is useful when one file is being managed with two version control systems at the same time @iftex @@ -1776,11 +1837,13 @@ time to complete the check-in. If you change several source files for the same reason, it is often -convenient to specify the same log entry for many of the files. To do -this, use the history of previous log entries. The commands @kbd{M-n}, -@kbd{M-p}, @kbd{M-s} and @kbd{M-r} for doing this work just like the -minibuffer history commands (except that these versions are used outside -the minibuffer). +convenient to specify the same log entry for many of the files. (This +is the normal way to do things on a changeset-oriented system, where +comments are attached to changesets rather than the history of +individual files.) The most convenient way to do this is to mark all the +files in VC-Dired mode and check in from there; the log buffer will +carry the fileset information with it and do a group commit when you +confirm it with @kbd{C-c C-c}. However, you can also browse the history of previous log entries to duplicate a checkin comment. This can be useful when you want several @@ -1794,62 +1857,73 @@ mode, which involves running two hooks: @code{text-mode-hook} and @code{vc-log-mode-hook}. @xref{Hooks}. -@node Old Versions -@subsection Examining And Comparing Old Versions +@node Old Revisions +@subsection Examining And Comparing Old Revisions One of the convenient features of version control is the ability -to examine any version of a file, or compare two versions. +to examine any revision of a file, or compare two revisions. @table @kbd -@item C-x v ~ @var{version} @key{RET} -Examine version @var{version} of the visited file, in a buffer of its +@item C-x v ~ @var{revision} @key{RET} +Examine revision @var{revision} of the visited file, in a buffer of its own. @item C-x v = -Compare the current buffer contents with the focus version from which -you started editing. - -@item C-u C-x v = @var{file} @key{RET} @var{oldvers} @key{RET} @var{newvers} @key{RET} -Compare the specified two versions of @var{file}. +Compare the buffer contents associated with the current +fileset with the working revision(s) from which you started editing. + +@item C-u C-x v = @key{RET} @var{oldvers} @key{RET} @var{newvers} @key{RET} +Compare the specified two repository revisions of the current fileset. @item C-x v g -Display the file with per-line version information and using colors. +Display the file with per-line revision information and using colors. @end table -@findex vc-version-other-window +@findex vc-revision-other-window @kindex C-x v ~ - To examine an old version in its entirety, visit the file and then type -@kbd{C-x v ~ @var{version} @key{RET}} (@code{vc-version-other-window}). -This puts the text of version @var{version} in a file named -@file{@var{filename}.~@var{version}~}, and visits it in its own buffer -in a separate window. (In RCS, you can also select an old version + To examine an old revision in its entirety, visit the file and then type +@kbd{C-x v ~ @var{revision} @key{RET}} (@code{vc-revision-other-window}). +This puts the text of revision @var{revision} in a file named +@file{@var{filename}.~@var{revision}~}, and visits it in its own buffer +in a separate window. (In RCS, you can also select an old revision and create a branch from it. @xref{Branches}.) @findex vc-diff @kindex C-x v = - It is usually more convenient to compare two versions of the file, -with the command @kbd{C-x v =} (@code{vc-diff}). Plain @kbd{C-x v =} -compares the current buffer contents (saving them in the file if -necessary) with the master version from which you started editing the -file (this is not necessarily the latest version of the file). -@kbd{C-u C-x v =}, with a numeric argument, reads a file name and two -version numbers, then compares those versions of the specified file. -Both forms display the output in a special buffer in another window. - - You can specify a checked-in version by its number; an empty input +@kbd{C-x v =} compares the current buffer contents of each file in the +current fileset (saving them in the file if necessary) with the +repository revision from which you started editing each file (this is not +necessarily the latest revision of the file). The diff will be displayed +in a special buffer in another window. + +@findex vc-diff +@kindex C-u C-x v = + You can compare two repository revisions of the current fileset with +the command @kbd{C-u C-x v =} (@code{vc-diff}). @kbd{C-u C-x v =} reads +two revision ID or tags. The diff will be displayed in a special +buffer in another window. + + You can specify a checked-in revision by its ID; an empty input specifies the current contents of the work file (which may be different -from all the checked-in versions). You can also specify a snapshot name +from all the checked-in revisions). You can also specify a snapshot name @iftex (@pxref{Snapshots,,,emacs-xtra, Specialized Emacs Features}) @end iftex @ifnottex (@pxref{Snapshots}) @end ifnottex -instead of one or both version numbers. - - If you supply a directory name instead of the name of a registered -file, this command compares the two specified versions of all registered -files in that directory and its subdirectories. +instead of one or both revision ID. + + Note that if your version-control system is file-oriented (SCCS, +RCS, CVS) rather than fileset-oriented (Subversion, GNU Arch, git, +Mercurial) specifying a revision of a multiple-file fileset by +revision ID (as opposed to a snapshot name or RSCCS/RCS tag) is +unlikely to return diffs that are connected in any meaningful way. + + If you invoke @kbd{C-u C-x v =} or @kbd{C-u C-x v =} from a buffer +that is neither visiting a version-controlled file nor a VC Dired +buffer, these commands will generate a diff of all registered files in +the current directory and its subdirectories. @vindex vc-diff-switches @vindex vc-rcs-diff-switches @@ -1867,12 +1941,12 @@ Compilation mode (@pxref{Compilation Mode}), such as @kbd{C-x `} and @kbd{C-c C-c}, in both the ``old'' and ``new'' text, and they always find the corresponding locations in the current work file. (Older -versions are not, in general, present as files on your disk.) +revisions are not, in general, present as files on your disk.) @findex vc-annotate @kindex C-x v g For some back ends, you can display the file @dfn{annotated} with -per-line version information and using colors to enhance the visual +per-line revision information and using colors to enhance the visual appearance, with the command @kbd{M-x vc-annotate}. It creates a new buffer (the ``annotate buffer'') displaying the file's text, with each part colored to show how old it is. Text colored red is new, blue means @@ -1881,7 +1955,7 @@ changes are blue, and the newest changes are red. When you give a prefix argument to this command, it uses the -minibuffer to read two arguments: which version number to display and +minibuffer to read two arguments: the ID of which revision to display and annotate (instead of the current file contents), and the time span in days the color range should cover. @@ -1919,9 +1993,9 @@ line. @item W -Annotate the focus version--the one you are editing. If you used +Annotate the working revision--the one you are editing. If you used @kbd{P} and @kbd{N} to browse to other revisions, use this key to -return to your current version. +return to your working revision. @end table @node Secondary VC Commands @@ -1974,16 +2048,18 @@ If locking is in use, @kbd{C-x v i} leaves the file unlocked and read-only. Type @kbd{C-x v v} if you wish to start editing it. After registering a file with CVS, you must subsequently commit the initial -version by typing @kbd{C-x v v}. Until you do that, the version +revision by typing @kbd{C-x v v}. Until you do that, the revision ID appears as @samp{@@@@} in the mode line. -@vindex vc-default-init-version -@cindex initial version number to register - The initial version number for a newly registered file is 1.1, by -default. You can specify a different default by setting the variable -@code{vc-default-init-version}, or you can give @kbd{C-x v i} a numeric -argument; then it reads the initial version number for this particular -file using the minibuffer. +@vindex vc-default-init-revision +@cindex initial revision ID to register + The default initial revision ID for a newly registered file +varies by what VCS you are using; normally it will be 1.1 on VCSes +that use dot-pair revision IDs and 1 on VCSes that use monotonic IDs. +You can specify a different default by setting the variable +@code{vc-default-init-revision}, or you can give @kbd{C-x v i} a +numeric argument; then it reads the initial revision ID for this +particular file using the minibuffer. @vindex vc-initial-comment If @code{vc-initial-comment} is non-@code{nil}, @kbd{C-x v i} reads an @@ -1995,12 +2071,12 @@ @table @kbd @item C-x v l -Display version control state and change history. +Display revision control state and change history. @end table @kindex C-x v l @findex vc-print-log - To view the detailed version control status and history of a file, + To view the detailed revision control status and history of a file, type @kbd{C-x v l} (@code{vc-print-log}). It displays the history of changes to the current file, including the text of the log entries. The output appears in a separate window. The point is centered at the @@ -2048,7 +2124,7 @@ @item f Visit the revision indicated at the current line, like typing @kbd{C-x -v ~} and specifying this revision's number (@pxref{Old Versions}). +v ~} and specifying this revision's ID (@pxref{Old Revisions}). @item d Display the diff (@pxref{Comparing Files}) between the revision @@ -2062,7 +2138,7 @@ @table @kbd @item C-x v u -Revert the buffer and the file to the version from which you started +Revert the buffer and the file to the working revision from which you started editing the file. @item C-x v c @@ -2073,51 +2149,25 @@ @kindex C-x v u @findex vc-revert-buffer If you want to discard your current set of changes and revert to the -version from which you started editing the file, use @kbd{C-x v u} +working revision from which you started editing the file, use @kbd{C-x v u} (@code{vc-revert-buffer}). This leaves the file unlocked; if locking is in use, you must first lock the file again before you change it again. @kbd{C-x v u} requires confirmation, unless it sees that you -haven't made any changes with respect to the master version. +haven't made any changes with respect to the master copy of the +working revision. @kbd{C-x v u} is also the command to unlock a file if you lock it and then decide not to change it. @kindex C-x v c -@findex vc-cancel-version +@findex vc-rollback To cancel a change that you already checked in, use @kbd{C-x v c} -(@code{vc-cancel-version}). This command discards all record of the -most recent checked-in version, but only if your work file corresponds -to that version---you cannot use @kbd{C-x v c} to cancel a version -that is not the latest on its branch. @kbd{C-x v c} also offers to -revert your work file and buffer to the previous version (the one that -precedes the version that is deleted). - - If you answer @kbd{no}, VC keeps your changes in the buffer, and locks -the file. The no-revert option is useful when you have checked in a -change and then discover a trivial error in it; you can cancel the -erroneous check-in, fix the error, and check the file in again. - - When @kbd{C-x v c} does not revert the buffer, it unexpands all -version control headers in the buffer instead -@iftex -(@pxref{Version Headers,,,emacs-xtra, Specialized Emacs Features}). -@end iftex -@ifnottex -(@pxref{Version Headers}). -@end ifnottex -This is because the buffer no longer corresponds to any existing -version. If you check it in again, the check-in process will expand -the headers properly for the new version number. - - However, it is impossible to unexpand the RCS @samp{@w{$}Log$} header -automatically. If you use that header feature, you have to unexpand it -by hand---by deleting the entry for the version that you just canceled. - - Be careful when invoking @kbd{C-x v c}, as it is easy to lose a lot of -work with it. To help you be careful, this command always requires -confirmation with @kbd{yes}. Note also that this command is disabled -under CVS, because canceling versions is very dangerous and discouraged -with CVS. +(@code{vc-rollback}). This command discards all record of the most +recent checked-in revision, but only if your work file corresponds to +that revision---you cannot use @kbd{C-x v c} to cancel a revision that is +not the latest on its branch. Note that many version-control systems do +not support rollback at all; this command is something of a historical +relic. @ifnottex @c vc1-xtra.texi needs extra level of lowering. @@ -2132,7 +2182,7 @@ @cindex trunk (version control) One use of version control is to maintain multiple ``current'' -versions of a file. For example, you might have different versions of a +revisions of a file. For example, you might have different revisions of a program in which you are gradually adding various unfinished new features. Each such independent line of development is called a @dfn{branch}. VC allows you to create branches, switch between @@ -2140,18 +2190,30 @@ Please note, however, that branches are not supported for SCCS. A file's main line of development is usually called the @dfn{trunk}. -The versions on the trunk are normally numbered 1.1, 1.2, 1.3, etc. At -any such version, you can start an independent branch. A branch -starting at version 1.2 would have version number 1.2.1.1, and consecutive -versions on this branch would have numbers 1.2.1.2, 1.2.1.3, 1.2.1.4, -and so on. If there is a second branch also starting at version 1.2, it -would consist of versions 1.2.2.1, 1.2.2.2, 1.2.2.3, etc. - -@cindex head version - If you omit the final component of a version number, that is called a -@dfn{branch number}. It refers to the highest existing version on that -branch---the @dfn{head version} of that branch. The branches in the -example above have branch numbers 1.2.1 and 1.2.2. +You can create multiple branches from the trunk. How the difference +between trunk and branch is made visible is dependent on whether the +VCS uses dot-pair or monotonic version IDs. + + In VCSes with dot-pair revision IDs, the revisions on the trunk are +normally IDed 1.1, 1.2, 1.3, etc. At any such revision, you can +start an independent branch. A branch starting at revision 1.2 would +have revision ID 1.2.1.1, and consecutive revisions on this branch +would have IDs 1.2.1.2, 1.2.1.3, 1.2.1.4, and so on. If there is +a second branch also starting at revision 1.2, it would consist of +revisions 1.2.2.1, 1.2.2.2, 1.2.2.3, etc. + + In VCSes with monotonic revision IDs, trunk revisions are IDed as +1, 2, 3, etc. A branch from (say) revision 2 might start with 2.1 and +continue through 2.2, 2.3, etc. But naming conventions for branches +and subbranches vary widely on these systems, and some (like +Mercurial) never depart from the monotonic integer sequence at all. +Consult the documentation of the VCS you are using. + +@cindex head revision + If you omit the final component of a dot-pair revision ID, that is called a +@dfn{branch ID}. It refers to the highest existing revision on that +branch---the @dfn{head revision} of that branch. The branches in the +dot-pair example above have branch IDs 1.2.1 and 1.2.2. @menu * Switching Branches:: How to get to another existing branch. @@ -2165,14 +2227,15 @@ @subsubsection Switching between Branches To switch between branches, type @kbd{C-u C-x v v} and specify the -version number you want to select. On a locking-based system, this +revision ID you want to select. On a locking-based system, this version is then visited @emph{unlocked} (write-protected), so you can examine it before locking it. Switching branches in this way is allowed only when the file is not locked. - You can omit the minor version number, thus giving only the branch -number; this takes you to the head version on the chosen branch. If you -only type @key{RET}, Emacs goes to the highest version on the trunk. + On a VCS with dot-pair IDs, you can omit the minor part, thus giving +only the branch ID; this takes you to the head version on the +chosen branch. If you only type @key{RET}, Emacs goes to the highest +version on the trunk. After you have switched to any branch (including the main branch), you stay on it for subsequent VC commands, until you explicitly select some @@ -2181,36 +2244,36 @@ @node Creating Branches @subsubsection Creating New Branches - To create a new branch from a head version (one that is the latest in -the branch that contains it), first select that version if necessary, + To create a new branch from a head revision (one that is the latest in +the branch that contains it), first select that revision if necessary, lock it with @kbd{C-x v v}, and make whatever changes you want. Then, when you check in the changes, use @kbd{C-u C-x v v}. This lets you -specify the version number for the new version. You should specify a -suitable branch number for a branch starting at the current version. -For example, if the current version is 2.5, the branch number should be +specify the revision ID for the new revision. You should specify a +suitable branch ID for a branch starting at the current revision. +For example, if the current revision is 2.5, the branch ID should be 2.5.1, 2.5.2, and so on, depending on the number of existing branches at that point. - To create a new branch at an older version (one that is no longer the -head of a branch), first select that version (@pxref{Switching + To create a new branch at an older revision (one that is no longer the +head of a branch), first select that revision (@pxref{Switching Branches}). Your procedure will then differ depending on whether you are using a locking or merging-based VCS. - On a locking VCS, you will need to lock the old version branch with + On a locking VCS, you will need to lock the old revision branch with @kbd{C-x v v}. You'll be asked to confirm, when you lock the old -version, that you really mean to create a new branch---if you say no, -you'll be offered a chance to lock the latest version instead. On +revision, that you really mean to create a new branch---if you say no, +you'll be offered a chance to lock the latest revision instead. On a merging-based VCS you will skip this step. Then make your changes and type @kbd{C-x v v} again to check in a new -version. This automatically creates a new branch starting from the -selected version. You need not specially request a new branch, because -that's the only way to add a new version at a point that is not the head +revision. This automatically creates a new branch starting from the +selected revision. You need not specially request a new branch, because +that's the only way to add a new revision at a point that is not the head of a branch. After the branch is created, you ``stay'' on it. That means that -subsequent check-ins create new versions on that branch. To leave the -branch, you must explicitly select a different version with @kbd{C-u C-x +subsequent check-ins create new revisions on that branch. To leave the +branch, you must explicitly select a different revision with @kbd{C-u C-x v v}. To transfer changes from one branch to another, use the merge command, described in the next section. @@ -2240,26 +2303,26 @@ This is the common way to pick up recent changes from the repository, regardless of whether you have already changed the file yourself. - You can also enter a branch number or a pair of version numbers in + You can also enter a branch ID or a pair of revision IDs in the minibuffer. Then @kbd{C-x v m} finds the changes from that -branch, or the differences between the two versions you specified, and -merges them into the current version of the current file. +branch, or the differences between the two revisions you specified, and +merges them into the current revision of the current file. As an example, suppose that you have finished a certain feature on branch 1.3.1. In the meantime, development on the trunk has proceeded -to version 1.5. To merge the changes from the branch to the trunk, -first go to the head version of the trunk, by typing @kbd{C-u C-x v v -@key{RET}}. Version 1.5 is now current. If locking is used for the file, -type @kbd{C-x v v} to lock version 1.5 so that you can change it. Next, +to revision 1.5. To merge the changes from the branch to the trunk, +first go to the head revision of the trunk, by typing @kbd{C-u C-x v v +@key{RET}}. Revision 1.5 is now current. If locking is used for the file, +type @kbd{C-x v v} to lock revision 1.5 so that you can change it. Next, type @kbd{C-x v m 1.3.1 @key{RET}}. This takes the entire set of changes on -branch 1.3.1 (relative to version 1.3, where the branch started, up to -the last version on the branch) and merges it into the current version +branch 1.3.1 (relative to revision 1.3, where the branch started, up to +the last revision on the branch) and merges it into the current revision of the work file. You can now check in the changed file, thus creating -version 1.6 containing the changes from the branch. +revision 1.6 containing the changes from the branch. It is possible to do further editing after merging the branch, before the next check-in. But it is usually wiser to check in the merged -version, then lock it and make the further changes. This will keep +revision, then lock it and make the further changes. This will keep a better record of the history of changes. @cindex conflicts @@ -2277,7 +2340,7 @@ If you say no, the conflicting changes are both inserted into the file, surrounded by @dfn{conflict markers}. The example below shows how a conflict region looks; the file is called @samp{name} and the current -master file version with user B's changes in it is 1.11. +master file revision with user B's changes in it is 1.11. @c @w here is so CVS won't think this is a conflict. @smallexample @@ -2300,12 +2363,12 @@ @subsubsection Multi-User Branching It is often useful for multiple developers to work simultaneously on -different branches of a file. CVS allows this by default; for RCS, it -is possible if you create multiple source directories. Each source -directory should have a link named @file{RCS} which points to a common -directory of RCS master files. Then each source directory can have its -own choice of selected versions, but all share the same common RCS -records. +different branches of a file. CVS and later systems allow this by +default; for RCS, it is possible if you create multiple source +directories. Each source directory should have a link named +@file{RCS} which points to a common directory of RCS master files. +Then each source directory can have its own choice of selected +revisions, but all share the same common RCS records. This technique works reliably and automatically, provided that the source files contain RCS version headers @@ -2315,13 +2378,13 @@ @ifnottex (@pxref{Version Headers}). @end ifnottex -The headers enable Emacs to be sure, at all times, which version -number is present in the work file. +The headers enable Emacs to be sure, at all times, which revision +ID is present in the work file. If the files do not have version headers, you must instead tell Emacs explicitly in each session which branch you are working on. To do this, first find the file, then type @kbd{C-u C-x v v} and specify the correct -branch number. This ensures that Emacs knows which branch it is using +branch ID. This ensures that Emacs knows which branch it is using during this particular editing session. @ifnottex
--- a/doc/emacs/misc.texi Fri Oct 12 21:57:45 2007 +0000 +++ b/doc/emacs/misc.texi Sat Oct 13 05:53:03 2007 +0000 @@ -488,12 +488,13 @@ Coding}. @cindex @env{INSIDE_EMACS} environment variable - Emacs sets the envitonment variable @env{INSIDE_EMACS} to @code{t} -in the subshell. Programs can check this variable to determine -whether they are running inside an Emacs subshell. + Emacs sets the environment variable @env{INSIDE_EMACS} (to a +comma-separated list including the Emacs version) in the subshell. +Programs can check this variable to determine whether they are running +inside an Emacs subshell. @cindex @env{EMACS} environment variable - Emacs also sets the @env{EMACS} environment variable to @code{t} if + Emacs also sets the @env{EMACS} environment variable (to @code{t}) if it is not already defined. @strong{Warning:} This environment variable is deprecated. Programs that check this variable should be changed to check @env{INSIDE_EMACS} instead.
--- a/doc/emacs/vc-xtra.texi Fri Oct 12 21:57:45 2007 +0000 +++ b/doc/emacs/vc-xtra.texi Sat Oct 13 05:53:03 2007 +0000 @@ -15,7 +15,7 @@ @menu * VC Dired Mode:: Listing files managed by version control. * VC Dired Commands:: Commands to use in a VC Dired buffer. -* Remote Repositories:: Efficient access to remote CVS servers. +* Remote Repositories:: Efficient access to remote VCS servers. * Snapshots:: Sets of file versions treated as a unit. * Miscellaneous VC:: Various other commands and features of VC. * Customizing VC:: Variables that change VC's behavior.
--- a/doc/emacs/vc1-xtra.texi Fri Oct 12 21:57:45 2007 +0000 +++ b/doc/emacs/vc1-xtra.texi Sat Oct 13 05:53:03 2007 +0000 @@ -120,21 +120,27 @@ All the usual Dired commands work normally in VC Dired mode, except for @kbd{v}, which is redefined as the version control prefix. You can invoke VC commands such as @code{vc-diff} and @code{vc-print-log} by -typing @kbd{v =}, or @kbd{v l}, and so on. Most of these commands apply -to the file name on the current line. +typing @kbd{v =}, or @kbd{v l}, and so on. These commands will apply +to the set of files you have marked for operation in the VC-Dired +buffer. The command @kbd{v v} (@code{vc-next-action}) operates on all the marked files, so that you can lock or check in several files at once. -If it operates on more than one file, it handles each file according to -its current state; thus, it might lock one file, but check in another -file. This could be confusing; it is up to you to avoid confusing -behavior by marking a set of files that are in a similar state. If no -files are marked, @kbd{v v} operates on the file in the current line. +If the underlying VC supports atomic commits of multiple-file +changesets @kbd{v v} with a selected set of modified but not committed +files wuill commit all of them at once as a single changeset. - If any files call for check-in, @kbd{v v} reads a single log entry, -then uses it for all the files being checked in. This is convenient for -registering or checking in several files at once, as part of the same -change. + When @kbd{v v} (@code{vc-next-action}) operates on a set of files, +it requires that all of those files must be in the same state; +otherwise it will throw an error. Note that this differs from the +behavior of older versions of VC, which did not have fileset +operations and simply did @code{vc-next-action} on each file +individually. + + If any files are in a state that calls for commit, @kbd{v v} reads a +single log entry and uses it for the changeset as a whole. If the +underling VCS is file- rather than changeset-oriented, the log entry +will be replicated into the history of each file. @findex vc-dired-toggle-terse-mode @findex vc-dired-mark-locked
--- a/doc/emacs/vc2-xtra.texi Fri Oct 12 21:57:45 2007 +0000 +++ b/doc/emacs/vc2-xtra.texi Sat Oct 13 05:53:03 2007 +0000 @@ -6,17 +6,24 @@ @c printed version) or in the main Emacs manual (for the on-line version). @node Remote Repositories @subsection Remote Repositories -@cindex remote repositories (CVS) +@cindex remote repositories + + A common way of using CVS and other more advanced VCSes is to set up +a central repository on some Internet host, then have each +developer check out a personal working copy of the files on his local +machine. Committing changes to the repository, and picking up changes +from other users into one's own working area, then works by direct +interactions with the repository server. - A common way of using CVS is to set up a central CVS repository on -some Internet host, then have each developer check out a personal -working copy of the files on his local machine. Committing changes to -the repository, and picking up changes from other users into one's own -working area, then works by direct interactions with the CVS server. + One difficulty is that access to a repository server is often slow, +and that developers might need to work off-line as well. While only +third-generation decentralized VCses such as GNU Arch or Mercurial +really solve this problem, VC is designed to reduce the amount of +network interaction necessary. - One difficulty is that access to the CVS server is often slow, and -that developers might need to work off-line as well. VC is designed -to reduce the amount of network interaction necessary. + If you are using a truly decentralized VCS you can skip the rest of +this section. It describes backup and local-repository techniques +that are only useful for Subversion and earlier VCSes. @menu * Version Backups:: Keeping local copies of repository versions. @@ -28,7 +35,7 @@ @cindex version backups @cindex automatic version backups - When VC sees that the CVS repository for a file is on a remote + When VC sees that the repository for a file is on a remote machine, it automatically makes local backups of unmodified versions of the file---@dfn{automatic version backups}. This means that you can compare the file to the repository version (@kbd{C-x v =}), or @@ -47,7 +54,7 @@ @end ifnottex But they follow a similar naming convention. - For a file that comes from a remote CVS repository, VC makes a + For a file that comes from a remote repository, VC makes a version backup whenever you save the first changes to the file, and removes it after you have committed your modified version to the repository. You can disable the making of automatic version backups by @@ -58,10 +65,10 @@ of file @var{file} is @code{@var{file}.~@var{version}.~}. This is almost the same as the name used by @kbd{C-x v ~} @iftex -(@pxref{Old Versions,,,emacs, the Emacs Manual}), +(@pxref{Old Revisions,,,emacs, the Emacs Manual}), @end iftex @ifnottex -(@pxref{Old Versions}), +(@pxref{Old Revisions}), @end ifnottex the only difference being the additional dot (@samp{.}) after the version number. This similarity is intentional, because both kinds of @@ -244,10 +251,10 @@ You can give a snapshot name as an argument to @kbd{C-x v =} or @kbd{C-x v ~} @iftex -(@pxref{Old Versions,,,emacs, the Emacs Manual}). +(@pxref{Old Revisions,,,emacs, the Emacs Manual}). @end iftex @ifnottex -(@pxref{Old Versions}). +(@pxref{Old Revisions}). @end ifnottex Thus, you can use it to compare a snapshot against the current files, or two snapshots against each other, or a snapshot against a named
--- a/doc/misc/ChangeLog Fri Oct 12 21:57:45 2007 +0000 +++ b/doc/misc/ChangeLog Sat Oct 13 05:53:03 2007 +0000 @@ -1,3 +1,9 @@ +2007-10-10 Michael Albinus <michael.albinus@gmx.de> + + Sync with Tramp 2.1.11. + + * trampver.texi: Update release number. + 2007-10-06 Michael Albinus <michael.albinus@gmx.de> * tramp.texi (External packages): New section.
--- a/doc/misc/cc-mode.texi Fri Oct 12 21:57:45 2007 +0000 +++ b/doc/misc/cc-mode.texi Sat Oct 13 05:53:03 2007 +0000 @@ -208,8 +208,8 @@ @vskip 0pt plus 1filll @insertcopying -This manual was generated from $Revision: 1.2 $ of $RCSfile: cc-mode.texi,v $, which can be -downloaded from +This manual was generated from cc-mode.texi, which can be downloaded +from @url{http://cvs.savannah.gnu.org/viewcvs/emacs/emacs/doc/misc/cc-mode.texi}. @end titlepage
--- a/doc/misc/trampver.texi Fri Oct 12 21:57:45 2007 +0000 +++ b/doc/misc/trampver.texi Sat Oct 13 05:53:03 2007 +0000 @@ -4,12 +4,12 @@ @c In the Tramp CVS, the version number is auto-frobbed from @c configure.ac, so you should edit that file and run @c "autoconf && ./configure" to change the version number. -@set trampver 2.1.11-pre +@set trampver 2.1.11 @c Other flags from configuration @set instprefix /usr/local @set lispdir /usr/local/share/emacs/site-lisp -@set infodir /usr/local/info +@set infodir /usr/local/share/info @c Formatting of the tramp program name consistent. @set tramp @sc{tramp}
--- a/etc/ChangeLog Fri Oct 12 21:57:45 2007 +0000 +++ b/etc/ChangeLog Sat Oct 13 05:53:03 2007 +0000 @@ -1,3 +1,7 @@ +2007-10-10 Eric S. Raymond <esr@snark.thyrsus.com> + + * NEWS: Explain the VC fileset changes a bit better. + 2007-09-28 Glenn Morris <rgm@gnu.org> * PROBLEMS: Mention Tex superscript font issue.
--- a/etc/NEWS Fri Oct 12 21:57:45 2007 +0000 +++ b/etc/NEWS Sat Oct 13 05:53:03 2007 +0000 @@ -107,6 +107,8 @@ This is a convenience alias, so that one can write `(pop argv)' inside of --eval command line arguments in order to access following arguments. + +** The abbrev file is no longer read at startup in batch mode. * Incompatible Editing Changes in Emacs 23.1 @@ -173,6 +175,11 @@ *** VC now supports applying VC operations to a set of files at a time. +This enables VC to work much more effectively with changeset-oriented +version-control systems such as Subversion, GNU Arch, Mercurial, and +Bzr. VC will now pass a multiple-file commit to these systems +as a single changeset. + ** sgml-electric-tag-pair-mode lets you simultaneously edit matched tag pairs. ** The appearance of superscript and subscript in TeX is more customizable. @@ -257,6 +264,8 @@ * Lisp Changes in Emacs 23.1 +** `frame-inherited-parameters' lets new frames inherit parameters from +the selected frame. ** New keymap `input-decode-map' overrides like key-translation-map, but applies before function-key-map. Also it is terminal-local contrary to key-translation-map. Terminal-specific key-sequences are generally added to @@ -292,10 +301,13 @@ respectively. The functions are called with the terminal id of the frame being suspended/resumed as a parameter. -*** New functions: `environment', `let-environment'. +*** New function: `environment'. *** New variable: `local-function-key-map'. -This in addition to the global function-key-map variable that already existed. +This in addition to the global function-key-map variable that +already existed. The global variable is not used directly any more; +instead, the local-function-key-map is initialized so as to inherit from +function-key-map. *** `initial-environment' holds the environment inherited from Emacs's parent.
--- a/lisp/ChangeLog Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/ChangeLog Sat Oct 13 05:53:03 2007 +0000 @@ -1,3 +1,310 @@ +2007-10-13 Glenn Morris <rgm@gnu.org> + + * woman.el (woman0-rename): Fix paren typo. + + * mail/feedmail.el (feedmail-run-the-queue) + (feedmail-look-at-queue-directory): + * mail/reporter.el (reporter-dump-state): + * net/eudc-hotlist.el (eudc-edit-hotlist): + * net/eudc.el (eudc-display-records) + (eudc-filter-duplicate-attributes) + (eudc-distribute-field-on-records, eudc-query-form) + (eudc-process-form): + * net/eudcb-bbdb.el (eudc-bbdb-filter-non-matching-record) + (eudc-bbdb-query-internal): + * net/eudcb-ldap.el (eudc-ldap-simple-query-internal): + * net/socks.el (socks-build-auth-list): + * progmodes/cc-cmds.el (top level): + * progmodes/cc-styles.el (c-make-styles-buffer-local) + (c-set-style): + * progmodes/cperl-mode.el (top level, cperl-imenu-addback) + (cperl-write-tags, cperl-tags-treeify): + * progmodes/ebnf-yac.el (ebnf-yac-token-table): + * progmodes/ebnf2ps.el (ebnf-map-name, ebnf-dimensions): + * progmodes/idlw-shell.el (idlwave-shell-filter-bp, top level): + * progmodes/idlw-toolbar.el (idlwave-toolbar-add-everywhere) + (idlwave-toolbar-remove-everywhere): + * progmodes/idlwave.el (idlwave-indent-line) + (idlwave-sintern-keyword-list, idlwave-scan-user-lib-files) + (idlwave-write-paths, idlwave-all-method-classes) + (idlwave-all-method-keyword-classes, idlwave-entry-keywords) + (idlwave-fix-keywords, idlwave-display-calling-sequence): + * textmodes/org.el (org-export-as-html, org-export-as-ascii) + (org-fast-tag-selection): Use mapc rather than mapcar. + +2007-10-13 Dan Nicolaescu <dann@ics.uci.edu> + + * diff-mode.el (diff-fine-change): Add :group. + +2007-10-12 Dan Nicolaescu <dann@ics.uci.edu> + + * cus-start.el (all): Use the same test as the 22.2 branch. + +2007-10-12 Stefan Monnier <monnier@iro.umontreal.ca> + + * diff-mode.el (diff-current-defun): Force recomputation of + change-log-default-name. + +2007-10-12 Chong Yidong <cyd@stupidchicken.com> + + * startup.el (fancy-startup-screen): Remove an unnecessary newline + and some leftover logic regarding dedicated frames. If showing + concise startup screen, fit window to buffer. + (command-line-1): If we will be using the splash screen, use + find-file instead of find-file-other-window to find additional + files. Comment out unused code for coping with the old sit-for + behavior. + +2007-10-12 Stefan Monnier <monnier@iro.umontreal.ca> + + * term/xterm.el (xterm-function-map, xterm-alternatives-map): Use the + `meta' modifier consistently, rather than using sometimes meta + sometimes alt. + +2007-10-12 Martin Rudalics <rudalics@gmx.at> + + * window.el (handle-select-window): Revert part of 2007-10-08 + change setting the input focus. + +2007-10-12 Glenn Morris <rgm@gnu.org> + + * startup.el (command-line): Do not read abbrev file in batch mode. + + * emacs-lisp/byte-opt.el (top level): + * mail/rmail.el (rmail-list-to-menu): + * obsolete/hilit19.el (hilit-mode): + * progmodes/cc-mode.el (c-postprocess-file-styles) + (c-submit-bug-report): + * textmodes/org-publish.el (org-publish-get-plist-from-filename): + * textmodes/reftex.el (reftex-erase-all-selection-and-index-buffers) + (reftex-access-parse-file): + * textmodes/reftex-cite.el (reftex-do-citation) + (reftex-insert-bib-matches): + * textmodes/reftex-ref.el (reftex-offer-label-menu): + * textmodes/reftex-sel.el (reftex-select-unmark): + * textmodes/reftex-toc.el (reftex-toc-do-promote): + * vc-mcvs.el (vc-mcvs-checkin): Use mapc rather than mapcar. + + * cus-edit.el (custom-variable-menu, custom-face-menu) + (custom-group-menu): Check init-file-user rather than + user-init-file, in case cus-edit is loaded by site-run-file. + +2007-10-11 Dan Nicolaescu <dann@ics.uci.edu> + + * vc.el (vc-deduce-fileset): Delete unused code. + (vc-next-action): Fix typos. + +2007-10-11 Juanma Barranquero <lekktu@gmail.com> + + * bs.el (bs--mark-unmark): New function. + (bs-mark-current, bs-unmark-current): Use it. + +2007-10-11 Eric S. Raymond <esr@snark.thyrsus.com> + + * vc.el (vc-diff, vc-diff-internal): Bug fixes by Juanma Barranquero. + Temporarily disable the check for his edge case, it's calling some + brittle code. + (with-vc-properties): Fievaluation time of a macro argument. + + * ediff-vers.el (ediff-vc-internal): + * vc-hooks.el: + * loaddefs.el: Follow up on VC terminology change. + +2007-10-11 Juanma Barranquero <lekktu@gmail.com> + + * follow.el (follow-stop-intercept-process-output): + Use `follow-call-process-filter' rather than `process-filter'. + Simplify. + +2007-10-11 Eric S. Raymond <esr@snark.thyrsus.com> + + * vc.el: Address an edge case in vc-diff pointed out by + Juanma Barranquero. This is an experimental fix and may change. + + * vc-hooks.el (vc-registered): Robustify this function a bit + against filenames with no directory component. + +2007-10-11 Stefan Monnier <monnier@iro.umontreal.ca> + + * international/characters.el: Undo unwanted and unexplained change. + +2007-10-10 Vinicius Jose Latorre <viniciusjl@ig.com.br> + + * ps-print.el: Fix the usage of :foreground and :background face + attributes. Reported by Nikolaj Schumacher <n_schumacher@web.de>. + (ps-print-version): New version 6.7.6. + (ps-face-attributes, ps-face-attribute-list, ps-face-background): + Fix code. + (ps-face-foreground-color-p, ps-face-background-color-p) + (ps-face-color-p): New inline funs. + +2007-10-10 Carsten Dominik <dominik@science.uva.nl> + + * org.el (org-additional-option-like-keywords): New constant. + (org-complete): Use `org-additional-option-like-keywords'. + (org-parse-local-options): New function. + +2007-10-10 Carsten Dominik <dominik@science.uva.nl> + + * org.el (org-in-clocktable-p): New function. + (org-clock-report): Only update the table at point, or insert a + new one. + (org-clock-goto): New function. + (org-open-file): Use `start-process-shell-command' instead of + `shell-command' with an ampersand. + (org-deadline, org-schedule): New argument REMOVE to remove the + date from the entry. + (org-agenda-schedule, org-agenda-deadline): Pass the prefix + argument to `org-schedule' and `org-deadline'. + (org-trim): Use the correct expressions for beginning and end of + the string. + (org-get-cleaned-entry): Trim the string before returning it. + (org-clock-find-position): New function. + (org-clock-into-drawer): New option. + (org-agenda-tags-column): Rename from + `org-agenda-align-tags-to-column'. + (org-agenda-align-tags): Allow negative values for + `org-agenda-tags-column'. + (org-insert-labeled-timestamps-before-properties-drawer): Remove var. + (org-agenda-to-appt): New optional argument FILTER. + (org-completion-fallback-command): New variable. + (org-complete): Use `org-completion-fallback-command'. + (org-find-base-buffer-visiting): Catch the case that there is no + buffer visiting the file. + (org-property-or-variable-value): New function. + (org-todo): Use `org-property-or-variable-value' + (org-agenda-compact-blocks): New option. + (org-prepare-agenda, org-agenda-list): Use `org-agenda-compact-blocks'. + (org-agenda-schedule, org-agenda-deadline): + Call `org-agenda-show-new-time'. + (org-agenda-show-new-time): New argument PREFIX. + (org-colgroup-info-to-vline-list): Fix but that cause a + shift in the vertical lines. + (org-buffer-property-keys): New argument INCLUDE-DEFAULTS. + (org-maybe-renumber-ordered-list, org-cycle-list-bullet) + (org-indent-item): No arg in call to `org-fix-bullet-type'. + (org-fix-bullet-type): Remove argument. + (org-read-date): Check for am/pm twice, to catch the end time. + (org-goto-map): Use `suppress-keymap'. + (org-remember-apply-template): Respect the dynamically scoped + selection character. + + * org.texi (Appointment reminders): New section. + +2007-10-10 Bastien Guerry <Bastien.Guerry@ens.fr> + + * org-export-latex.el (org-export-latex-protect-string): + Renaming of `org-latex-protect'. + (org-export-latex-emphasis-alist): By default, don't protect + any emphasis formatter from further conversion. + (org-export-latex-tables): Honor column grouping for tables. + (org-export-latex-title-command): New option. + (org-export-latex-treat-backslash-char): Use \textbackslash{} to + export backslash character. + +2007-10-10 Stefan Monnier <monnier@iro.umontreal.ca> + + * frame.el (frame-inherited-parameters): Remove unused `environment' + parameter, and let server.el add `client' when needed. + + * server.el (server-create-tty-frame) + (server-create-window-system-frame): Set frame-inherited-parameters. + + * frame.el (frame-inherited-parameters): New var. + (make-frame): Use it. + + * font-lock.el (lisp-font-lock-keywords-2): Remove let-environment. + + * env.el (let-environment): Remove. Unused. + (read-envvar-name): Simplify. + (setenv): Remove unused arg `frame'. + + * help-fns.el (describe-variable): Add missing " " for multiline + obsolescence info and missing EOL after global value. + +2007-10-10 Eric S. Raymond <esr@snark.thyrsus.com> + + * add-log.el: + * ediff-vers.el: + * log-view.el: + * pcvs.el: + * vc-arch.el: + * vc-bzr.el: + * vc-cvs.el: + * vc.el: + * vc-git.el: + * vc-hg.el: + * vc-hooks.el: + * vc-mcvs.el: + * vc-mtn.el: + * vc-rcs.el: + * vc-sccs.el: + * vc-svn.el: Terminology cleanup: workfile-version -> working-revision, + {find,init,next,previous,annotate-*,log}-version -> + {find,init,next,previous,annotate-*,log}-revision, + annotate-focus-version -> annotate-working-revision, The term + 'focus' is gone. The term 'revision' is now used consistently + everywhere that reference to a revision ID is intended, replacing + older use of 'version'. + +2007-10-10 Juanma Barranquero <lekktu@gmail.com> + + * follow.el: Change all instances of "Follow Mode" to "Follow + mode" in docstrings and messages. + (follow-menu-filter): Fix arg passed to `bound-and-true-p'. + +2007-10-10 Eric S. Raymond <esr@snark.thyrsus.com> + + * vc.el (vc-next-action): Rewrite completely; this principal + entry point now operates on a current fileset selected either + explicitly via VC-Dired or implicitly by visiting a file buffer, + rather than always operating on the file of the current buffer as + in older versions. Rewrite the rest of the mode to match. + (with-vc-properties): Rewrite to operate on a file list. + (with-vc-file): vc-checkin takes a file list argument now. + (vc-post-command-functions): This hook now receives a file list. + (vc-do-command): Take a either a file or a file list as argument. + (vc-deduce-fileset): New function for deducing a file list to + operate on. + (vc-next-action-on-file, vc-next-action-dired): Remove. + Merge into vc-next-action. + (vc-register): Adapt to the fact that vc-start-entry now takes a + file list. + (vc-register-with): New function. + (vc-start-entry): Take a file list argument rather than a + file argument. + (vc-checkout): Cope with vc-start-entry taking a file list. + (vc-steal-lock): Cope with with-vc-properties taking a + file list. + (vc-checkin): Take a file list argument rather than a file argument. + (vc-finish-logentry): Use the filelist passed by vc-start-entry. + (vc-diff-internal): Rewrite for filesets. + (vc-diff-sentinel): New function, tests whether changes were + written into a diff buffer. + (vc-diff): Rewrite for filesets. + (vc-version-diff): Rewrite for filesets. + (vc-print-log): Take a fileset argument. + (vc-revert): Revert the entire selected fileset, not just the + current buffer. + (vc-rollback): Roll back the entire selected fileset, if + possible. No longer accepts a prefix argument. + (vc-update): Merge new changes for the entire selected + fileset, not just the current buffer. + (vc-revert-file): Cope with with-vc-properties taking a file list. + (vc-default-dired-state-info): Add + status suffix if the file is + modified. + (vc-annotate-warp-version): Use the new diff machinery. + (vc-log-edit): Take a file list argument rather than a file argument. + +2007-10-10 Michael Albinus <michael.albinus@gmx.de> + + Sync with Tramp 2.1.11. + + * net/tramp.el (tramp-open-connection-setup-interactive-shell): + Pacify byte compiler. + + * net/trampver.el: Update release number. + 2007-10-09 Juanma Barranquero <lekktu@gmail.com> * follow.el: Require easymenu. @@ -11,7 +318,7 @@ (handle-select-window): When autoselecting window set input focus. Restructure. - * frame.el (focus-follows-mouse): Moved to frame.c. + * frame.el (focus-follows-mouse): Move to frame.c. * cus-start.el (all): Add focus-follows-mouse. 2007-10-08 Juanma Barranquero <lekktu@gmail.com> @@ -210,10 +517,10 @@ 2007-10-08 Stefan Monnier <monnier@iro.umontreal.ca> - * pcvs.el (cvs-mode-add-change-log-entry-other-window): Use - add-log-buffer-file-name-function rather than bind buffer-file-name, - so we dont end up calling change-log-mode in *cvs* when `fi' is the - ChangeLog file itself. + * pcvs.el (cvs-mode-add-change-log-entry-other-window): + Use add-log-buffer-file-name-function rather than binding + buffer-file-name, so we don't end up calling change-log-mode in *cvs* + when `fi' is the ChangeLog file itself. * outline.el (outline-flag-region): Use front-advance.
--- a/lisp/add-log.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/add-log.el Sat Oct 13 05:53:03 2007 +0000 @@ -379,7 +379,7 @@ (defun change-log-version-number-search () "Return version number of current buffer's file. -This is the value returned by `vc-workfile-version' or, if that is +This is the value returned by `vc-working-revision' or, if that is nil, by matching `change-log-version-number-regexp-list'." (let* ((size (buffer-size)) (limit @@ -390,7 +390,7 @@ ;; Apply percentage only if buffer size is bigger than ;; approx 100 lines. (if (> size (* 100 80)) (+ (point) (/ size 10))))) - (or (and buffer-file-name (vc-workfile-version buffer-file-name)) + (or (and buffer-file-name (vc-working-revision buffer-file-name)) (save-restriction (widen) (let ((regexps change-log-version-number-regexp-list)
--- a/lisp/bs.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/bs.el Sat Oct 13 05:53:03 2007 +0000 @@ -864,35 +864,32 @@ (bs--set-window-height) (bs--show-config-message what)) +(defun bs--mark-unmark (count fun) + "Call FUN on COUNT consecutive buffers of *buffer-selection*." + (let ((dir (if (> count 0) 1 -1))) + (dotimes (i (abs count)) + (let ((buffer (bs--current-buffer))) + (when buffer (funcall fun buffer)) + (bs--update-current-line) + (bs-down dir))))) + (defun bs-mark-current (count) "Mark buffers. COUNT is the number of buffers to mark. Move cursor vertically down COUNT lines." (interactive "p") - (let ((dir (if (> count 0) 1 -1)) - (count (abs count))) - (while (> count 0) - (let ((buffer (bs--current-buffer))) - (if buffer - (setq bs--marked-buffers (cons buffer bs--marked-buffers))) - (bs--update-current-line) - (bs-down dir)) - (setq count (1- count))))) + (bs--mark-unmark count + (lambda (buf) + (add-to-list 'bs--marked-buffers buf)))) (defun bs-unmark-current (count) "Unmark buffers. COUNT is the number of buffers to unmark. Move cursor vertically down COUNT lines." (interactive "p") - (let ((dir (if (> count 0) 1 -1)) - (count (abs count))) - (while (> count 0) - (let ((buffer (bs--current-buffer))) - (if buffer - (setq bs--marked-buffers (delq buffer bs--marked-buffers))) - (bs--update-current-line) - (bs-down dir)) - (setq count (1- count))))) + (bs--mark-unmark count + (lambda (buf) + (setq bs--marked-buffers (delq buf bs--marked-buffers))))) (defun bs--show-config-message (what) "Show message indicating the new showing status WHAT.
--- a/lisp/cus-edit.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/cus-edit.el Sat Oct 13 05:53:03 2007 +0000 @@ -2682,7 +2682,12 @@ `(("Set for Current Session" custom-variable-set (lambda (widget) (eq (widget-get widget :custom-state) 'modified))) - ,@(when (or custom-file user-init-file) + ;; Note that in all the backquoted code in this file, we test + ;; init-file-user rather than user-init-file. This is in case + ;; cus-edit is loaded by something in site-start.el, because + ;; user-init-file is not set at that stage. + ;; http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg00310.html + ,@(when (or custom-file init-file-user) '(("Save for Future Sessions" custom-variable-save (lambda (widget) (memq (widget-get widget :custom-state) @@ -2697,7 +2702,7 @@ (get (widget-value widget) 'saved-variable-comment)) (memq (widget-get widget :custom-state) '(modified set changed rogue))))) - ,@(when (or custom-file user-init-file) + ,@(when (or custom-file init-file-user) '(("Erase Customization" custom-variable-reset-standard (lambda (widget) (and (get (widget-value widget) 'standard-value) @@ -3371,7 +3376,7 @@ (defvar custom-face-menu `(("Set for Current Session" custom-face-set) - ,@(when (or custom-file user-init-file) + ,@(when (or custom-file init-file-user) '(("Save for Future Sessions" custom-face-save))) ("Undo Edits" custom-redraw (lambda (widget) @@ -3380,7 +3385,7 @@ (lambda (widget) (or (get (widget-value widget) 'saved-face) (get (widget-value widget) 'saved-face-comment)))) - ,@(when (or custom-file user-init-file) + ,@(when (or custom-file init-file-user) '(("Erase Customization" custom-face-reset-standard (lambda (widget) (get (widget-value widget) 'face-defface-spec))))) @@ -3978,7 +3983,7 @@ `(("Set for Current Session" custom-group-set (lambda (widget) (eq (widget-get widget :custom-state) 'modified))) - ,@(when (or custom-file user-init-file) + ,@(when (or custom-file init-file-user) '(("Save for Future Sessions" custom-group-save (lambda (widget) (memq (widget-get widget :custom-state) '(modified set)))))) @@ -3988,7 +3993,7 @@ ("Reset to Saved" custom-group-reset-saved (lambda (widget) (memq (widget-get widget :custom-state) '(modified set)))) - ,@(when (or custom-file user-init-file) + ,@(when (or custom-file init-file-user) '(("Erase Customization" custom-group-reset-standard (lambda (widget) (memq (widget-get widget :custom-state) '(modified set saved)))))))
--- a/lisp/cus-start.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/cus-start.el Sat Oct 13 05:53:03 2007 +0000 @@ -436,7 +436,7 @@ ((string-match "\\`w32-" (symbol-name symbol)) (eq system-type 'windows-nt)) ((string-match "\\`mac-" (symbol-name symbol)) - (or (eq system-type 'mac) (eq system-type 'darwin))) + (eq window-system 'mac)) ((string-match "\\`x-.*gtk" (symbol-name symbol)) (featurep 'gtk)) ((string-match "\\`x-" (symbol-name symbol))
--- a/lisp/diff-mode.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/diff-mode.el Sat Oct 13 05:53:03 2007 +0000 @@ -1578,6 +1578,10 @@ (defun diff-current-defun () "Find the name of function at point. For use in `add-log-current-defun-function'." + ;; Kill change-log-default-name so it gets recomputed each time, since + ;; each hunk may belong to another file which may belong to another + ;; directory and hence have a different ChangeLog file. + (kill-local-variable 'change-log-default-name) (save-excursion (when (looking-at diff-hunk-header-re) (forward-line 1) @@ -1649,7 +1653,8 @@ (defface diff-fine-change '((t :background "yellow")) - "Face used for char-based changes shown by `diff-fine-highlight'.") + "Face used for char-based changes shown by `diff-fine-highlight'." + :group 'diff-mode) (defun diff-fine-highlight-preproc () (while (re-search-forward "^." nil t)
--- a/lisp/ediff-vers.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/ediff-vers.el Sat Oct 13 05:53:03 2007 +0000 @@ -84,12 +84,12 @@ (setq rev1 (ediff-vc-latest-version (buffer-file-name)))) (save-window-excursion (save-excursion - (vc-version-other-window rev1) + (vc-revision-other-window rev1) (setq rev1buf (current-buffer) file1 (buffer-file-name))) (save-excursion (or (string= rev2 "") ; use current buffer - (vc-version-other-window rev2)) + (vc-revision-other-window rev2)) (setq rev2buf (current-buffer) file2 (buffer-file-name))) (setq startup-hooks @@ -191,17 +191,17 @@ (let (buf1 buf2 ancestor-buf) (save-window-excursion (save-excursion - (vc-version-other-window rev1) + (vc-revision-other-window rev1) (setq buf1 (current-buffer))) (save-excursion (or (string= rev2 "") - (vc-version-other-window rev2)) + (vc-revision-other-window rev2)) (setq buf2 (current-buffer))) (if ancestor-rev (save-excursion (if (string= ancestor-rev "") - (setq ancestor-rev (vc-workfile-version buffer-file-name))) - (vc-version-other-window ancestor-rev) + (setq ancestor-rev (vc-working-revision buffer-file-name))) + (vc-revision-other-window ancestor-rev) (setq ancestor-buf (current-buffer)))) (setq startup-hooks (cons
--- a/lisp/emacs-lisp/byte-opt.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/emacs-lisp/byte-opt.el Sat Oct 13 05:53:03 2007 +0000 @@ -2012,17 +2012,17 @@ (assq 'byte-code (symbol-function 'byte-optimize-form)) (let ((byte-optimize nil) (byte-compile-warnings nil)) - (mapcar (lambda (x) - (or noninteractive (message "compiling %s..." x)) - (byte-compile x) - (or noninteractive (message "compiling %s...done" x))) - '(byte-optimize-form - byte-optimize-body - byte-optimize-predicate - byte-optimize-binary-predicate - ;; Inserted some more than necessary, to speed it up. - byte-optimize-form-code-walker - byte-optimize-lapcode)))) + (mapc (lambda (x) + (or noninteractive (message "compiling %s..." x)) + (byte-compile x) + (or noninteractive (message "compiling %s...done" x))) + '(byte-optimize-form + byte-optimize-body + byte-optimize-predicate + byte-optimize-binary-predicate + ;; Inserted some more than necessary, to speed it up. + byte-optimize-form-code-walker + byte-optimize-lapcode)))) nil) ;; arch-tag: 0f14076b-737e-4bef-aae6-908826ec1ff1
--- a/lisp/env.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/env.el Sat Oct 13 05:53:03 2007 +0000 @@ -47,15 +47,14 @@ If it is also not t, RET does not exit if it does non-null completion." (completing-read prompt (mapcar (lambda (enventry) - (list (if enable-multibyte-characters - (decode-coding-string - (substring enventry 0 - (string-match "=" enventry)) - locale-coding-system t) - (substring enventry 0 - (string-match "=" enventry))))) + (let ((str (substring enventry 0 + (string-match "=" enventry)))) + (if (multibyte-string-p str) + (decode-coding-string + str locale-coding-system t) + str))) (append process-environment - nil ;;(frame-parameter (frame-with-environment) 'environment) + ;;(frame-environment) )) nil mustmatch nil 'read-envvar-name-history)) @@ -128,7 +127,7 @@ ;; Fixme: Should the environment be recoded if LC_CTYPE &c is set? -(defun setenv (variable &optional value substitute-env-vars frame) +(defun setenv (variable &optional value substitute-env-vars) "Set the value of the environment variable named VARIABLE to VALUE. VARIABLE should be a string. VALUE is optional; if not provided or nil, the environment variable VARIABLE will be removed. @@ -143,19 +142,11 @@ variables in VALUE with `substitute-env-vars', which see. This is normally used only for interactive calls. -If optional parameter FRAME is non-nil, this function modifies -only the frame-local value of VARIABLE on FRAME, ignoring -`process-environment'. Note that frames on the same terminal -device usually share their environment, so calling `setenv' on -one of them affects the others as well. - -If FRAME is nil, `setenv' changes the global value of VARIABLE by -modifying `process-environment'. Note that the global value -overrides any frame-local values. - The return value is the new value of VARIABLE, or nil if it was removed from the environment. +This function works by modifying `process-environment'. + As a special case, setting variable `TZ' calls `set-time-zone-rule' as a side-effect." (interactive @@ -188,12 +179,8 @@ (error "Environment variable name `%s' contains `='" variable)) (if (string-equal "TZ" variable) (set-time-zone-rule value)) - (if (null frame) - (setq process-environment (setenv-internal process-environment - variable value t)) - (setq frame (frame-with-environment frame)) - (setq process-environment (setenv-internal process-environment - variable value nil))) + (setq process-environment (setenv-internal process-environment + variable value t)) value) (defun getenv (variable &optional frame) @@ -238,8 +225,7 @@ `locale-coding-system', i.e. the elements must normally be decoded for use. See `setenv' and `getenv'." (let* ((env (append process-environment -;; (frame-parameter (frame-with-environment frame) -;; 'environment) + ;; (frame-environment frame) nil)) (scan env) prev seen) @@ -269,45 +255,6 @@ scan (cdr scan)))) env)) -(defmacro let-environment (varlist &rest body) - "Evaluate BODY with environment variables set according to VARLIST. -The environment variables are then restored to their previous -values. -The value of the last form in BODY is returned. - -Each element of VARLIST is either a string (which variable is -then removed from the environment), or a list (NAME -VALUEFORM) (which sets NAME to the value of VALUEFORM, a string). -All the VALUEFORMs are evaluated before any variables are set." - (declare (indent 2)) - (let ((old-env (make-symbol "old-env")) - (name (make-symbol "name")) - (value (make-symbol "value")) - (entry (make-symbol "entry")) - (frame (make-symbol "frame"))) - `(let ((,frame (selected-frame)) - ,old-env) - ;; Evaluate VALUEFORMs and replace them in VARLIST with their values. - (dolist (,entry ,varlist) - (unless (stringp ,entry) - (if (cdr (cdr ,entry)) - (error "`let-environment' bindings can have only one value-form")) - (setcdr ,entry (eval (cadr ,entry))))) - ;; Set the variables. - (dolist (,entry ,varlist) - (let ((,name (if (stringp ,entry) ,entry (car ,entry))) - (,value (if (consp ,entry) (cdr ,entry)))) - (setq ,old-env (cons (cons ,name (getenv ,name)) ,old-env)) - (setenv ,name ,value))) - (unwind-protect - (progn ,@body) - ;; Restore old values. - (with-selected-frame (if (frame-live-p ,frame) - ,frame - (selected-frame)) - (dolist (,entry ,old-env) - (setenv (car ,entry) (cdr ,entry)))))))) - (provide 'env) ;; arch-tag: b7d6a8f7-bc81-46db-8e39-8d721d4ed0b8
--- a/lisp/erc/ChangeLog Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/erc/ChangeLog Sat Oct 13 05:53:03 2007 +0000 @@ -1,3 +1,8 @@ +2007-10-13 Glenn Morris <rgm@gnu.org> + + * erc-track.el (erc-modified-channels-update): Use mapc rather + than mapcar. + 2007-09-18 Exal de Jesus Garcia Carrillo <exal@gmx.de> (tiny change) * erc.texi (Special-Features): Fix small typo.
--- a/lisp/erc/erc-track.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/erc/erc-track.el Sat Oct 13 05:53:03 2007 +0000 @@ -701,17 +701,17 @@ (unless erc-modified-channels-update-inside (let ((erc-modified-channels-update-inside t) (removed-channel nil)) - (mapcar (lambda (elt) - (let ((buffer (car elt))) - (when (or (not (bufferp buffer)) - (not (buffer-live-p buffer)) - (erc-buffer-visible buffer) - (and erc-track-remove-disconnected-buffers - (not (with-current-buffer buffer - erc-server-connected)))) - (setq removed-channel t) - (erc-modified-channels-remove-buffer buffer)))) - erc-modified-channels-alist) + (mapc (lambda (elt) + (let ((buffer (car elt))) + (when (or (not (bufferp buffer)) + (not (buffer-live-p buffer)) + (erc-buffer-visible buffer) + (and erc-track-remove-disconnected-buffers + (not (with-current-buffer buffer + erc-server-connected)))) + (setq removed-channel t) + (erc-modified-channels-remove-buffer buffer)))) + erc-modified-channels-alist) (when removed-channel (erc-modified-channels-display) (force-mode-line-update t)))))
--- a/lisp/follow.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/follow.el Sat Oct 13 05:53:03 2007 +0000 @@ -37,7 +37,7 @@ ;; ;; * The windows always display adjacent sections of the buffer. ;; This means that whenever one window is moved, all the -;; others will follow. (Hence the name Follow Mode.) +;; others will follow. (Hence the name Follow mode.) ;; ;; * Should the point (cursor) end up outside a window, another ;; window displaying that point is selected, if possible. This @@ -149,15 +149,15 @@ ;; The following is a list of commands useful when follow-mode is active. ;; ;; follow-scroll-up C-c . C-v -;; Scroll text in a Follow Mode window chain up. +;; Scroll text in a Follow mode window chain up. ;; ;; follow-scroll-down C-c . v ;; Like `follow-scroll-up', but in the other direction. ;; ;; follow-delete-other-windows-and-split C-c . 1 ;; Maximize the visible area of the current buffer, -;; and enter Follow Mode. This is a very convenient -;; way to start Follow Mode, hence we recomend that +;; and enter Follow mode. This is a very convenient +;; way to start Follow mode, hence we recomend that ;; this command be added to the global keymap. ;; ;; follow-recenter C-c . C-l @@ -330,7 +330,7 @@ (define-key mainmap follow-mode-prefix map) - ;; Replace the standard `end-of-buffer', when in Follow Mode. (I + ;; Replace the standard `end-of-buffer', when in Follow mode. (I ;; don't see the point in trying to replace every function that ;; could be enhanced in Follow mode. End-of-buffer is a special ;; case since it is very simple to define and it greatly enhances @@ -343,9 +343,9 @@ ;; When the mode is not activated, only one item is visible to activate ;; the mode. (defun follow-menu-filter (menu) - (if (bound-and-true-p 'follow-mode) + (if (bound-and-true-p follow-mode) menu - '(["Follow mode " follow-mode + '(["Follow mode" follow-mode :style toggle :selected follow-mode]))) ;; If there is a `tools' menu, we use it. However, we can't add a @@ -391,7 +391,7 @@ :group 'follow) (defcustom follow-intercept-processes (fboundp 'start-process) - "When non-nil, Follow Mode will monitor process output." + "When non-nil, Follow mode will monitor process output." :type 'boolean :group 'follow) @@ -401,11 +401,11 @@ A \"tail window\" is a window that displays only the end of the buffer. Normally it is practical for the user that empty windows are recentered automatically. However, when using -Follow Mode it breaks the display when the end is displayed +Follow mode it breaks the display when the end is displayed in a window \"above\" the last window. This is for example the case when displaying a short page in info. -Must be set before Follow Mode is loaded. +Must be set before Follow mode is loaded. Please note that it is not possible to fully prevent Emacs from recentering empty windows. Please report if you find a repeatable @@ -494,7 +494,7 @@ * The windows always displays adjacent sections of the buffer. This means that whenever one window is moved, all the - others will follow. (Hence the name Follow Mode.) + others will follow. (Hence the name Follow mode.) * Should the point (cursor) end up outside a window, another window displaying that point is selected, if possible. This @@ -545,7 +545,7 @@ (add-hook 'find-file-hook 'follow-find-file-hook t) (defun follow-find-file-hook () - "Find-file hook for Follow Mode. See the variable `follow-auto'." + "Find-file hook for Follow mode. See the variable `follow-auto'." (if follow-auto (follow-mode t))) ;;}}} @@ -558,7 +558,7 @@ ;;{{{ Scroll -;; `scroll-up' and `-down', but for windows in Follow Mode. +;; `scroll-up' and `-down', but for windows in Follow mode. ;; ;; Almost like the real thing, excpet when the cursor ends up outside ;; the top or bottom... In our case however, we end up outside the @@ -574,7 +574,7 @@ ;; good redisplay abstraction.) (defun follow-scroll-up (&optional arg) - "Scroll text in a Follow Mode window chain up. + "Scroll text in a Follow mode window chain up. If called with no ARG, the `next-screen-context-lines' last lines of the bottom window in the chain will be visible in the top window. @@ -582,7 +582,7 @@ If called with an argument, scroll ARG lines up. Negative ARG means scroll downward. -Works like `scroll-up' when not in Follow Mode." +Works like `scroll-up' when not in Follow mode." (interactive "P") (cond ((not (and (boundp 'follow-mode) follow-mode)) (scroll-up arg)) @@ -603,7 +603,7 @@ (defun follow-scroll-down (&optional arg) - "Scroll text in a Follow Mode window chain down. + "Scroll text in a Follow mode window chain down. If called with no ARG, the `next-screen-context-lines' top lines of the top window in the chain will be visible in the bottom window. @@ -611,7 +611,7 @@ If called with an argument, scroll ARG lines down. Negative ARG means scroll upward. -Works like `scroll-up' when not in Follow Mode." +Works like `scroll-up' when not in Follow mode." (interactive "P") (cond ((not (and (boundp 'follow-mode) follow-mode)) (scroll-up arg)) @@ -638,12 +638,12 @@ ;;;###autoload (defun follow-delete-other-windows-and-split (&optional arg) - "Create two side by side windows and enter Follow Mode. + "Create two side by side windows and enter Follow mode. Execute this command to display as much as possible of the text in the selected window. All other windows, in the current frame, are deleted and the selected window is split in two -side-by-side windows. Follow Mode is activated, hence the +side-by-side windows. Follow mode is activated, hence the two windows always will display two successive pages. \(If one window is moved, the other one will follow.) @@ -671,7 +671,7 @@ (follow-mode 1))) (defun follow-switch-to-buffer (buffer) - "Show BUFFER in all windows in the current Follow Mode window chain." + "Show BUFFER in all windows in the current Follow mode window chain." (interactive "BSwitch to Buffer: ") (let ((orig-window (selected-window)) (windows (follow-all-followers))) @@ -699,7 +699,7 @@ (defun follow-switch-to-current-buffer-all () - "Show current buffer in all windows on this frame, and enter Follow Mode. + "Show current buffer in all windows on this frame, and enter Follow mode. To bind this command to a hotkey place the following line in your `~/.emacs' file: @@ -796,10 +796,10 @@ ;;{{{ End of buffer (defun follow-end-of-buffer (&optional arg) - "Move point to the end of the buffer, Follow Mode style. + "Move point to the end of the buffer, Follow mode style. If the end is not visible, it will be displayed in the last possible -window in the Follow Mode window chain. +window in the Follow mode window chain. The mark is left at the previous position. With arg N, put point N/10 of the way from the true end." @@ -1315,7 +1315,7 @@ "Make sure windows displaying the end of a buffer aren't recentered. This is done by reading and rewriting the start position of -non-first windows in Follow Mode." +non-first windows in Follow mode." (if follow-avoid-tail-recenter-p (let* ((orig-buffer (current-buffer)) (top (frame-first-window (selected-frame))) @@ -1607,7 +1607,7 @@ (after ,(intern (concat "follow-" (symbol-name (car cmds)))) activate) - "Adviced by Follow Mode." + "Adviced by Follow mode." (follow-redraw-after-event (ad-get-arg 0)))) (setq cmds (cdr cmds)))) @@ -1718,9 +1718,9 @@ ;; filter... (defadvice set-process-filter (before follow-set-process-filter activate) - "Ensure process output will be displayed correctly in Follow Mode buffers. + "Ensure process output will be displayed correctly in Follow mode buffers. -Follow Mode inserts its own process filter to do its +Follow mode inserts its own process filter to do its magic stuff before the real process filter is called." (if follow-intercept-processes (progn @@ -1794,7 +1794,7 @@ (defun follow-intercept-process-output () "Intercept all active processes. -This is needed so that Follow Mode can track all display events in the +This is needed so that Follow mode can track all display events in the system. (See `follow-mode'.)" (interactive) (let ((list (process-list))) @@ -1808,7 +1808,7 @@ (defun follow-stop-intercept-process-output () - "Stop Follow Mode from spying on processes. + "Stop Follow mode from spying on processes. All current spypoints are removed and no new will be added. @@ -1820,17 +1820,14 @@ report this using the `report-emacs-bug' function." (interactive) (follow-tidy-process-filter-alist) - (let ((list (process-list))) - (while list - (if (eq (process-filter (car list)) 'follow-generic-filter) - (progn - (follow-call-set-process-filter - (car list) - (cdr-safe (assq (car list) follow-process-filter-alist))) - (setq follow-process-filter-alist - (delq (assq (car list) follow-process-filter-alist) - follow-process-filter-alist)))) - (setq list (cdr list)))) + (dolist (process (process-list)) + (when (eq (follow-call-process-filter process) 'follow-generic-filter) + (follow-call-set-process-filter + process + (cdr-safe (assq process follow-process-filter-alist))) + (setq follow-process-filter-alist + (delq (assq process follow-process-filter-alist) + follow-process-filter-alist)))) (setq follow-intercept-processes nil)) ;;}}} @@ -2073,7 +2070,7 @@ ;;{{{ Tail window handling ;; In Emacs (not XEmacs) windows showing nothing are sometimes -;; recentered. When in Follow Mode, this is not desirable for +;; recentered. When in Follow mode, this is not desirable for ;; non-first windows in the window chain. This section tries to ;; make the windows stay where they should be. ;; @@ -2107,10 +2104,10 @@ (if follow-avoid-tail-recenter-p (defadvice sit-for (before follow-sit-for activate) - "Adviced by Follow Mode. + "Adviced by Follow mode. Avoid to recenter windows displaying only the end of a file as when -displaying a short file in two windows, using Follow Mode." +displaying a short file in two windows, using Follow mode." (follow-avoid-tail-recenter))) @@ -2120,7 +2117,7 @@ (if (and follow-avoid-tail-recenter-p (fboundp 'move-overlay)) (defadvice move-overlay (before follow-move-overlay activate) - "Adviced by Follow Mode. + "Adviced by Follow mode. Don't recenter windows showing only the end of a buffer. This prevents `mouse-drag-region' from messing things up." (follow-avoid-tail-recenter)))
--- a/lisp/font-lock.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/font-lock.el Sat Oct 13 05:53:03 2007 +0000 @@ -2228,7 +2228,7 @@ `(;; Control structures. Emacs Lisp forms. (,(concat "(" (regexp-opt - '("cond" "if" "while" "while-no-input" "let" "let*" "let-environment" + '("cond" "if" "while" "while-no-input" "let" "let*" "prog" "progn" "progv" "prog1" "prog2" "prog*" "inline" "lambda" "save-restriction" "save-excursion" "save-window-excursion" "save-selected-window"
--- a/lisp/frame.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/frame.el Sat Oct 13 05:53:03 2007 +0000 @@ -673,6 +673,10 @@ ;; Alias, kept temporarily. (define-obsolete-function-alias 'new-frame 'make-frame "22.1") +(defvar frame-inherited-parameters '() + ;; FIXME: Shouldn't we add `font' here as well? + "Parameters `make-frame' copies from the `selected-frame' to the new frame.") + (defun make-frame (&optional parameters) "Return a newly created frame displaying the current buffer. Optional argument PARAMETERS is an alist of parameters for the new frame. @@ -723,15 +727,11 @@ (run-hooks 'before-make-frame-hook) (setq frame (funcall frame-creation-function (append parameters (cdr (assq w window-system-default-frame-alist))))) (normal-erase-is-backspace-setup-frame frame) - ;; Inherit the 'environment and 'client parameters. - (let ((env (frame-parameter oldframe 'environment)) - (client (frame-parameter oldframe 'client))) - (if (not (framep env)) - (setq env oldframe)) - (if (and env (not (assq 'environment parameters))) - (set-frame-parameter frame 'environment env)) - (if (and client (not (assq 'client parameters))) - (set-frame-parameter frame 'client client))) + ;; Inherit the original frame's parameters. + (dolist (param frame-inherited-parameters) + (unless (assq param parameters) ;Overridden by explicit parameters. + (let ((val (frame-parameter oldframe param))) + (when val (set-frame-parameter frame param val))))) (run-hook-with-args 'after-make-frame-functions frame) frame))
--- a/lisp/help-fns.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/help-fns.el Sat Oct 13 05:53:03 2007 +0000 @@ -565,7 +565,8 @@ ;; See previous comment for this function. ;; (help-xref-on-pp from (point)) (if (< (point) (+ from 20)) - (delete-region (1- from) from))))))) + (delete-region (1- from) from)))))) + (terpri)) ;; If the value is large, move it to the end. (with-current-buffer standard-output @@ -617,7 +618,7 @@ (setq extra-line t) (princ " This variable is obsolete") (if (cdr obsolete) (princ (format " since %s" (cdr obsolete)))) - (princ ";") (terpri) + (princ ";\n ") (princ (if (stringp (car obsolete)) (car obsolete) (format "use `%s' instead." (car obsolete)))) (terpri))
--- a/lisp/ldefs-boot.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/ldefs-boot.el Sat Oct 13 05:53:03 2007 +0000 @@ -29117,10 +29117,10 @@ ;;;*** -;;;### (autoloads (vc-annotate vc-branch-part vc-trunk-p vc-update-change-log -;;;;;; vc-rename-file vc-transfer-file vc-switch-backend vc-update -;;;;;; vc-rollback vc-revert vc-print-log vc-retrieve-snapshot vc-create-snapshot -;;;;;; vc-directory vc-merge vc-insert-headers vc-version-other-window +;;;### (autoloads (vc-annotate vc-update-change-log vc-rename-file +;;;;;; vc-transfer-file vc-switch-backend vc-rollback vc-update +;;;;;; vc-revert vc-print-log vc-retrieve-snapshot vc-create-snapshot +;;;;;; vc-directory vc-merge vc-insert-headers vc-revision-other-window ;;;;;; vc-diff vc-register vc-next-action vc-do-command edit-vc-file ;;;;;; with-vc-file vc-before-checkin-hook vc-checkin-hook vc-checkout-hook) ;;;;;; "vc" "vc.el" (18190 35214))
--- a/lisp/log-view.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/log-view.el Sat Oct 13 05:53:03 2007 +0000 @@ -76,7 +76,7 @@ (eval-when-compile (require 'cl)) (require 'pcvs-util) -(autoload 'vc-find-version "vc") +(autoload 'vc-find-revision "vc") (autoload 'vc-version-diff "vc") (defvar cvs-minor-wrap-function) @@ -93,7 +93,7 @@ ;; ("e" . cvs-mode-edit-log) ("d" . log-view-diff) ("a" . log-view-annotate-version) - ("f" . log-view-find-version) + ("f" . log-view-find-revision) ("n" . log-view-msg-next) ("p" . log-view-msg-prev) ("\t" . log-view-msg-next) @@ -116,7 +116,7 @@ ;; ["Kill This Buffer" kill-this-buffer] ["Mark Log Entry for Diff" set-mark-command] ["Diff Revisions" log-view-diff] - ["Visit Version" log-view-find-version] + ["Visit Version" log-view-find-revision] ["Annotate Version" log-view-annotate-version] ["Next Log Entry" log-view-msg-next] ["Previous Log Entry" log-view-msg-prev] @@ -365,12 +365,12 @@ (cvs-force-command "/F")) (funcall f)))) -(defun log-view-find-version (pos) +(defun log-view-find-revision (pos) "Visit the version at point." (interactive "d") (save-excursion (goto-char pos) - (switch-to-buffer (vc-find-version (log-view-current-file) + (switch-to-buffer (vc-find-revision (log-view-current-file) (log-view-current-tag))))) (defun log-view-annotate-version (pos)
--- a/lisp/mail/feedmail.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/mail/feedmail.el Sat Oct 13 05:53:03 2007 +0000 @@ -1588,7 +1588,7 @@ (setq list-of-possible-fqms (directory-files feedmail-queue-directory t)) (if feedmail-queue-run-orderer (setq list-of-possible-fqms (funcall feedmail-queue-run-orderer list-of-possible-fqms))) - (mapcar + (mapc '(lambda (blobby) (setq maybe-file (expand-file-name blobby feedmail-queue-directory)) (cond @@ -1835,7 +1835,7 @@ (let ((q-cnt 0) (q-oth 0) (high-water 0) (blobbet)) ;; iterate, counting things we find along the way in the directory (if (file-directory-p queue-directory) - (mapcar + (mapc '(lambda (blobby) (cond ((file-directory-p blobby) nil) ; don't care about subdirs
--- a/lisp/mail/reporter.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/mail/reporter.el Sat Oct 13 05:53:03 2007 +0000 @@ -252,7 +252,7 @@ (erase-buffer) (insert "(setq\n") (lisp-indent-line) - (mapcar + (mapc (function (lambda (varsym-or-cons-cell) (let ((varsym (or (car-safe varsym-or-cons-cell)
--- a/lisp/mail/rmail.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/mail/rmail.el Sat Oct 13 05:53:03 2007 +0000 @@ -1,7 +1,8 @@ ;;; rmail.el --- main code of "RMAIL" mail reader for Emacs ;; Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, -;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. +;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 +;; Free Software Foundation, Inc. ;; Maintainer: FSF ;; Keywords: mail @@ -1460,7 +1461,7 @@ (defun rmail-list-to-menu (menu-name l action &optional full-name) (let ((menu (make-sparse-keymap menu-name))) - (mapcar + (mapc (function (lambda (item) (let (command) (if (consp item)
--- a/lisp/net/eudc-hotlist.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/net/eudc-hotlist.el Sat Oct 13 05:53:03 2007 +0000 @@ -69,10 +69,10 @@ (switch-to-buffer (get-buffer-create "*EUDC Servers*")) (setq buffer-read-only nil) (erase-buffer) - (mapcar (function - (lambda (entry) - (setq proto-col (max (length (car entry)) proto-col)))) - eudc-server-hotlist) + (mapc (function + (lambda (entry) + (setq proto-col (max (length (car entry)) proto-col)))) + eudc-server-hotlist) (setq proto-col (+ 3 proto-col)) (setq gap (make-string (- proto-col 6) ?\ )) (insert " EUDC Servers\n" @@ -82,7 +82,7 @@ "------" gap "--------\n" "\n") (setq eudc-hotlist-list-beginning (point)) - (mapcar '(lambda (entry) + (mapc '(lambda (entry) (insert (car entry)) (indent-to proto-col) (insert (symbol-name (cdr entry)) "\n"))
--- a/lisp/net/eudc.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/net/eudc.el Sat Oct 13 05:53:03 2007 +0000 @@ -502,15 +502,15 @@ records)) ;; Display the records (setq first-record (point)) - (mapcar + (mapc (function (lambda (record) (setq beg (point)) ;; Map over the record fields to print the attribute/value pairs - (mapcar (function - (lambda (field) - (eudc-print-record-field field width))) - record) + (mapc (function + (lambda (field) + (eudc-print-record-field field width))) + record) ;; Store the record internal format in some convenient place (overlay-put (make-overlay beg (point)) 'eudc-record @@ -540,13 +540,13 @@ (if (not (and (boundp 'eudc-form-widget-list) eudc-form-widget-list)) (error "Not in a directory query form buffer") - (mapcar (function - (lambda (wid-field) - (setq value (widget-value (cdr wid-field))) - (if (not (string= value "")) - (setq query-alist (cons (cons (car wid-field) value) - query-alist))))) - eudc-form-widget-list) + (mapc (function + (lambda (wid-field) + (setq value (widget-value (cdr wid-field))) + (if (not (string= value "")) + (setq query-alist (cons (cons (car wid-field) value) + query-alist))))) + eudc-form-widget-list) (kill-buffer (current-buffer)) (eudc-display-records (eudc-query query-alist) eudc-use-raw-directory-names)))) @@ -565,15 +565,15 @@ (if (null (eudc-cdar rec)) (list record) ; No duplicate attrs in this record - (mapcar (function - (lambda (field) - (if (listp (cdr field)) - (setq duplicates (cons field duplicates)) - (setq unique (cons field unique))))) - record) + (mapc (function + (lambda (field) + (if (listp (cdr field)) + (setq duplicates (cons field duplicates)) + (setq unique (cons field unique))))) + record) (setq result (list unique)) ;; Map over the record fields that have multiple values - (mapcar + (mapc (function (lambda (field) (let ((method (if (consp eudc-duplicate-attribute-handling-method) @@ -641,7 +641,7 @@ (while values (setcdr values (delete (car values) (cdr values))) (setq values (cdr values))) - (mapcar + (mapc (function (lambda (value) (let ((result-list (copy-sequence records))) @@ -974,11 +974,11 @@ (capitalize (symbol-name field))))) fields))) ;; Loop over prompt strings to find the longest one - (mapcar (function - (lambda (prompt) - (if (> (length prompt) width) - (setq width (length prompt))))) - prompts) + (mapc (function + (lambda (prompt) + (if (> (length prompt) width) + (setq width (length prompt))))) + prompts) ;; Insert the first widget out of the mapcar to leave the cursor ;; in the first field (widget-insert "\n\n" (format (concat "%" (int-to-string width) "s: ") (car prompts))) @@ -988,15 +988,15 @@ eudc-form-widget-list)) (setq fields (cdr fields)) (setq prompts (cdr prompts)) - (mapcar (function - (lambda (field) - (widget-insert "\n\n" (format (concat "%" (int-to-string width) "s: ") (car prompts))) - (setq widget (widget-create 'editable-field - :size 15)) - (setq eudc-form-widget-list (cons (cons field widget) - eudc-form-widget-list)) - (setq prompts (cdr prompts)))) - fields) + (mapc (function + (lambda (field) + (widget-insert "\n\n" (format (concat "%" (int-to-string width) "s: ") (car prompts))) + (setq widget (widget-create 'editable-field + :size 15)) + (setq eudc-form-widget-list (cons (cons field widget) + eudc-form-widget-list)) + (setq prompts (cdr prompts)))) + fields) (widget-insert "\n\n") (widget-create 'push-button :notify (lambda (&rest ignore)
--- a/lisp/net/eudcb-bbdb.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/net/eudcb-bbdb.el Sat Oct 13 05:53:03 2007 +0000 @@ -75,7 +75,7 @@ "Return RECORD if it matches `eudc-bbdb-current-query', nil otherwise." (catch 'unmatch (progn - (mapcar + (mapc (function (lambda (condition) (let ((attr (car condition)) @@ -197,22 +197,22 @@ (if (car query-attrs) (setq records (eval `(bbdb-search ,(quote records) ,@bbdb-attrs)))) (setq query-attrs (cdr query-attrs))) - (mapcar (function - (lambda (record) - (setq filtered (eudc-filter-duplicate-attributes record)) - ;; If there were duplicate attributes reverse the order of the - ;; record so the unique attributes appear first - (if (> (length filtered) 1) - (setq filtered (mapcar (function - (lambda (rec) - (reverse rec))) - filtered))) - (setq result (append result filtered)))) - (delq nil - (mapcar 'eudc-bbdb-format-record-as-result - (delq nil - (mapcar 'eudc-bbdb-filter-non-matching-record - records))))) + (mapc (function + (lambda (record) + (setq filtered (eudc-filter-duplicate-attributes record)) + ;; If there were duplicate attributes reverse the order of the + ;; record so the unique attributes appear first + (if (> (length filtered) 1) + (setq filtered (mapcar (function + (lambda (rec) + (reverse rec))) + filtered))) + (setq result (append result filtered)))) + (delq nil + (mapcar 'eudc-bbdb-format-record-as-result + (delq nil + (mapcar 'eudc-bbdb-filter-non-matching-record + records))))) result)) ;;}}}
--- a/lisp/net/eudcb-ldap.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/net/eudcb-ldap.el Sat Oct 13 05:53:03 2007 +0000 @@ -130,7 +130,7 @@ (setq result (eudc-filter-partial-records result return-attrs))) ;; Apply eudc-duplicate-attribute-handling-method (if (not (eq 'list eudc-duplicate-attribute-handling-method)) - (mapcar + (mapc (function (lambda (record) (setq final-result (append (eudc-filter-duplicate-attributes record)
--- a/lisp/net/socks.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/net/socks.el Sat Oct 13 05:53:03 2007 +0000 @@ -247,7 +247,7 @@ (defun socks-build-auth-list () (let ((num 0) (retval "")) - (mapcar + (mapc (function (lambda (x) (if (fboundp (cdr (cdr x)))
--- a/lisp/net/tramp.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/net/tramp.el Sat Oct 13 05:53:03 2007 +0000 @@ -5695,7 +5695,7 @@ (if (featurep 'mule) ;; Use MULE to select the right EOL convention for communicating ;; with the process. - (let* ((cs (or (process-coding-system proc) + (let* ((cs (or (funcall (symbol-function 'process-coding-system) proc) (cons 'undecided 'undecided))) cs-decode cs-encode) (when (symbolp cs) (setq cs (cons cs cs))) @@ -5708,7 +5708,8 @@ (when (search-forward "\r" nil t) (setq cs-decode (tramp-coding-system-change-eol-conversion cs-decode 'dos))) - (set-buffer-process-coding-system cs-decode cs-encode)) + (funcall (symbol-function 'set-buffer-process-coding-system) + cs-decode cs-encode)) ;; Look for ^M and do something useful if found. (when (search-forward "\r" nil t) ;; We have found a ^M but cannot frob the process coding system
--- a/lisp/net/trampver.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/net/trampver.el Sat Oct 13 05:53:03 2007 +0000 @@ -30,14 +30,14 @@ ;; "autoconf && ./configure" to change them. (X)Emacs version check is defined ;; in macro AC_EMACS_INFO of aclocal.m4; should be changed only there. -(defconst tramp-version "2.1.11-pre" +(defconst tramp-version "2.1.11" "This version of Tramp.") (defconst tramp-bug-report-address "tramp-devel@gnu.org" "Email address to send bug reports to.") ;; Check for (X)Emacs version. -(let ((x (if (or (< emacs-major-version 21) (and (featurep 'xemacs) (< emacs-minor-version 4))) (format "Tramp 2.1.11-pre is not fit for %s" (when (string-match "^.*$" (emacs-version)) (match-string 0 (emacs-version)))) "ok"))) +(let ((x (if (or (< emacs-major-version 21) (and (featurep 'xemacs) (< emacs-minor-version 4))) (format "Tramp 2.1.11 is not fit for %s" (when (string-match "^.*$" (emacs-version)) (match-string 0 (emacs-version)))) "ok"))) (unless (string-match "\\`ok\\'" x) (error x))) (provide 'trampver)
--- a/lisp/obsolete/hilit19.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/obsolete/hilit19.el Sat Oct 13 05:53:03 2007 +0000 @@ -975,24 +975,24 @@ (progn ;; BUFFER highlights... - (mapcar (lambda (hook) - (if hilit-mode - (add-hook hook 'hilit-rehighlight-buffer-quietly) - (remove-hook hook 'hilit-rehighlight-buffer-quietly))) - '( - Info-selection-hook + (mapc (lambda (hook) + (if hilit-mode + (add-hook hook 'hilit-rehighlight-buffer-quietly) + (remove-hook hook 'hilit-rehighlight-buffer-quietly))) + '( + Info-selection-hook - ;; runs too early vm-summary-mode-hooks - vm-summary-pointer-hook - vm-preview-message-hook - vm-show-message-hook + ;; runs too early vm-summary-mode-hooks + vm-summary-pointer-hook + vm-preview-message-hook + vm-show-message-hook - rmail-show-message-hook - mail-setup-hook - mh-show-mode-hook + rmail-show-message-hook + mail-setup-hook + mh-show-mode-hook - dired-after-readin-hook - )) + dired-after-readin-hook + )) ) (error (message "Error loading highlight hooks: %s" c) (ding) (sit-for 1)))))
--- a/lisp/pcvs.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/pcvs.el Sat Oct 13 05:53:03 2007 +0000 @@ -2411,7 +2411,7 @@ (let* ((file (expand-file-name buffer-file-name)) (version (and (fboundp 'vc-backend) (eq (vc-backend file) 'CVS) - (vc-workfile-version file)))) + (vc-working-revision file)))) (when version (save-excursion (dolist (cvs-buf (buffer-list))
--- a/lisp/progmodes/cc-cmds.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/progmodes/cc-cmds.el Sat Oct 13 05:53:03 2007 +0000 @@ -2595,7 +2595,7 @@ ;; set up electric character functions to work with pending-del, ;; (a.k.a. delsel) mode. All symbols get the t value except ;; the functions which delete, which gets 'supersede. -(mapcar +(mapc (function (lambda (sym) (put sym 'delete-selection t) ; for delsel (Emacs)
--- a/lisp/progmodes/cc-mode.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/progmodes/cc-mode.el Sat Oct 13 05:53:03 2007 +0000 @@ -841,7 +841,7 @@ (and c-file-style (c-set-style c-file-style)) (and c-file-offsets - (mapcar + (mapc (lambda (langentry) (let ((langelem (car langentry)) (offset (cdr langentry))) @@ -1430,15 +1430,15 @@ adaptive-fill-mode adaptive-fill-regexp) nil))) - (mapcar (lambda (var) (unless (boundp var) - (setq vars (delq var vars)))) - '(signal-error-on-buffer-boundary - filladapt-mode - defun-prompt-regexp - font-lock-mode - font-lock-maximum-decoration - parse-sexp-lookup-properties - lookup-syntax-properties)) + (mapc (lambda (var) (unless (boundp var) + (setq vars (delq var vars)))) + '(signal-error-on-buffer-boundary + filladapt-mode + defun-prompt-regexp + font-lock-mode + font-lock-maximum-decoration + parse-sexp-lookup-properties + lookup-syntax-properties)) vars) (lambda () (run-hooks 'c-prepare-bug-report-hooks)
--- a/lisp/progmodes/cc-styles.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/progmodes/cc-styles.el Sat Oct 13 05:53:03 2007 +0000 @@ -381,11 +381,11 @@ ;; fallback entry. (setq c-special-indent-hook (default-value 'c-special-indent-hook))) - (mapcar (lambda (elem) - (c-set-style-1 elem dont-override)) - ;; Need to go through the variables backwards when we - ;; don't override any settings. - (if (eq dont-override t) (nreverse vars) vars))) + (mapc (lambda (elem) + (c-set-style-1 elem dont-override)) + ;; Need to go through the variables backwards when we + ;; don't override any settings. + (if (eq dont-override t) (nreverse vars) vars))) (setq c-indentation-style stylename) (c-keep-region-active)) @@ -636,7 +636,7 @@ 'make-variable-buffer-local)) (varsyms (cons 'c-indentation-style (copy-alist c-style-variables)))) (delq 'c-special-indent-hook varsyms) - (mapcar func varsyms) + (mapc func varsyms) ;; Hooks must be handled specially (if this-buf-only-p (make-local-hook 'c-special-indent-hook)
--- a/lisp/progmodes/cperl-mode.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/progmodes/cperl-mode.el Sat Oct 13 05:53:03 2007 +0000 @@ -1107,11 +1107,11 @@ ;;; (setq interpreter-mode-alist (append interpreter-mode-alist ;;; '(("miniperl" . perl-mode)))))) (eval-when-compile - (mapcar (lambda (p) - (condition-case nil - (require p) - (error nil))) - '(imenu easymenu etags timer man info)) + (mapc (lambda (p) + (condition-case nil + (require p) + (error nil))) + '(imenu easymenu etags timer man info)) (if (fboundp 'ps-extend-face-list) (defmacro cperl-ps-extend-face-list (arg) `(ps-extend-face-list ,arg)) @@ -5385,15 +5385,15 @@ (t (or name (setq name "+++BACK+++")) - (mapcar (lambda (elt) - (if (and (listp elt) (listp (cdr elt))) - (progn - ;; In the other order it goes up - ;; one level only ;-( - (setcdr elt (cons (cons name lst) - (cdr elt))) - (cperl-imenu-addback (cdr elt) t name)))) - (if isback (cdr lst) lst)) + (mapc (lambda (elt) + (if (and (listp elt) (listp (cdr elt))) + (progn + ;; In the other order it goes up + ;; one level only ;-( + (setcdr elt (cons (cons name lst) + (cdr elt))) + (cperl-imenu-addback (cdr elt) t name)))) + (if isback (cdr lst) lst)) lst))) (defun cperl-imenu--create-perl-index (&optional regexp) @@ -6986,17 +6986,17 @@ (setq cperl-unreadable-ok t tm nil) ; Return empty list (error "Aborting: unreadable directory %s" file))))))) - (mapcar (function - (lambda (file) - (cond - ((string-match cperl-noscan-files-regexp file) - nil) - ((not (file-directory-p file)) - (if (string-match cperl-scan-files-regexp file) - (cperl-write-tags file erase recurse nil t noxs topdir))) - ((not recurse) nil) - (t (cperl-write-tags file erase recurse t t noxs topdir))))) - files))) + (mapc (function + (lambda (file) + (cond + ((string-match cperl-noscan-files-regexp file) + nil) + ((not (file-directory-p file)) + (if (string-match cperl-scan-files-regexp file) + (cperl-write-tags file erase recurse nil t noxs topdir))) + ((not recurse) nil) + (t (cperl-write-tags file erase recurse t t noxs topdir))))) + files))) (t (setq xs (string-match "\\.xs$" file)) (if (not (and xs noxs)) @@ -7110,16 +7110,16 @@ (cperl-tags-hier-fill)) (or tags-table-list (call-interactively 'visit-tags-table)) - (mapcar + (mapc (function (lambda (tagsfile) (message "Updating list of classes... %s" tagsfile) (set-buffer (get-file-buffer tagsfile)) (cperl-tags-hier-fill))) - tags-table-list) + tags-table-list) (message "Updating list of classes... postprocessing...")) - (mapcar remover (car cperl-hierarchy)) - (mapcar remover (nth 1 cperl-hierarchy)) + (mapc remover (car cperl-hierarchy)) + (mapc remover (nth 1 cperl-hierarchy)) (setq to (list nil (cons "Packages: " (nth 1 cperl-hierarchy)) (cons "Methods: " (car cperl-hierarchy)))) (cperl-tags-treeify to 1) @@ -7183,40 +7183,40 @@ (setcdr to l1) ; Init to dynamic space (setq writeto to) (setq ord 1) - (mapcar move-deeper packages) + (mapc move-deeper packages) (setq ord 2) - (mapcar move-deeper methods) + (mapc move-deeper methods) (if recurse - (mapcar (function (lambda (elt) + (mapc (function (lambda (elt) (cperl-tags-treeify elt (1+ level)))) - (cdr to))) + (cdr to))) ;;Now clean up leaders with one child only - (mapcar (function (lambda (elt) - (if (not (and (listp (cdr elt)) - (eq (length elt) 2))) nil - (setcar elt (car (nth 1 elt))) - (setcdr elt (cdr (nth 1 elt)))))) - (cdr to)) + (mapc (function (lambda (elt) + (if (not (and (listp (cdr elt)) + (eq (length elt) 2))) nil + (setcar elt (car (nth 1 elt))) + (setcdr elt (cdr (nth 1 elt)))))) + (cdr to)) ;; Sort the roots of subtrees (if (default-value 'imenu-sort-function) (setcdr to (sort (cdr to) (default-value 'imenu-sort-function)))) ;; Now add back functions removed from display - (mapcar (function (lambda (elt) - (setcdr to (cons elt (cdr to))))) - (if (default-value 'imenu-sort-function) - (nreverse - (sort root-functions (default-value 'imenu-sort-function))) - root-functions)) + (mapc (function (lambda (elt) + (setcdr to (cons elt (cdr to))))) + (if (default-value 'imenu-sort-function) + (nreverse + (sort root-functions (default-value 'imenu-sort-function))) + root-functions)) ;; Now add back packages removed from display - (mapcar (function (lambda (elt) - (setcdr to (cons (cons (concat "package " (car elt)) - (cdr elt)) - (cdr to))))) - (if (default-value 'imenu-sort-function) - (nreverse - (sort root-packages (default-value 'imenu-sort-function))) - root-packages)))) + (mapc (function (lambda (elt) + (setcdr to (cons (cons (concat "package " (car elt)) + (cdr elt)) + (cdr to))))) + (if (default-value 'imenu-sort-function) + (nreverse + (sort root-packages (default-value 'imenu-sort-function))) + root-packages)))) ;;;(x-popup-menu t ;;; '(keymap "Name1"
--- a/lisp/progmodes/ebnf-yac.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/progmodes/ebnf-yac.el Sat Oct 13 05:53:03 2007 +0000 @@ -273,12 +273,12 @@ ;; control character & 8-bit character are set to `error' (let ((table (make-vector 256 'error))) ;; upper & lower case letters: - (mapcar + (mapc #'(lambda (char) (aset table char 'non-terminal)) "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") ;; printable characters: - (mapcar + (mapc #'(lambda (char) (aset table char 'character)) "!#$&()*+-.0123456789=?@[\\]^_`~")
--- a/lisp/progmodes/ebnf2ps.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/progmodes/ebnf2ps.el Sat Oct 13 05:53:03 2007 +0000 @@ -5004,11 +5004,11 @@ (defvar ebnf-map-name (let ((map (make-vector 256 ?\_))) - (mapcar #'(lambda (char) - (aset map char char)) - (concat "#$%&+-.0123456789=?@~" - "ABCDEFGHIJKLMNOPQRSTUVWXYZ" - "abcdefghijklmnopqrstuvwxyz")) + (mapc #'(lambda (char) + (aset map char char)) + (concat "#$%&+-.0123456789=?@~" + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz")) map)) @@ -5553,7 +5553,7 @@ (ebnf-log "(ebnf-dimensions tree)") (let ((ebnf-total (length tree)) (ebnf-nprod 0)) - (mapcar 'ebnf-production-dimension tree)) + (mapc 'ebnf-production-dimension tree)) tree)
--- a/lisp/progmodes/idlw-shell.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/progmodes/idlw-shell.el Sat Oct 13 05:53:03 2007 +0000 @@ -3461,12 +3461,12 @@ line (string-to-number (match-string (nth 2 indmap))) file (idlwave-shell-file-name (match-string (nth 3 indmap)))) (if (eq bp-re bp-re55) - (setq count (if (match-string 10) 1 + (setq count (if (match-string 10) 1 (if (match-string 8) (string-to-number (match-string 8)))) condition (match-string 13) disabled (not (null (match-string 15))))) - + ;; Add the breakpoint info to the list (nconc idlwave-shell-bp-alist (list (cons (list file line) @@ -3476,9 +3476,9 @@ count nil condition disabled)))))) (setq idlwave-shell-bp-alist (cdr idlwave-shell-bp-alist)) ;; Update breakpoint data - (if (eq bp-re bp-re54) - (mapcar 'idlwave-shell-update-bp old-bp-alist) - (mapcar 'idlwave-shell-update-bp-command-only old-bp-alist)))) + (if (eq bp-re bp-re54) + (mapc 'idlwave-shell-update-bp old-bp-alist) + (mapc 'idlwave-shell-update-bp-command-only old-bp-alist)))) ;; Update the breakpoint overlays (unless no-show (idlwave-shell-update-bp-overlays)) ;; Return the new list @@ -4530,27 +4530,27 @@ (if (or (featurep 'easymenu) (load "easymenu" t)) (progn - (easy-menu-define + (easy-menu-define idlwave-mode-debug-menu idlwave-mode-map "IDL debugging menus" idlwave-shell-menu-def) (easy-menu-define idlwave-shell-mode-menu idlwave-shell-mode-map "IDL shell menus" idlwave-shell-menu-def) (save-excursion - (mapcar (lambda (buf) - (set-buffer buf) - (if (eq major-mode 'idlwave-mode) - (progn - (easy-menu-remove idlwave-mode-debug-menu) - (easy-menu-add idlwave-mode-debug-menu)))) - (buffer-list))))) + (mapc (lambda (buf) + (set-buffer buf) + (if (eq major-mode 'idlwave-mode) + (progn + (easy-menu-remove idlwave-mode-debug-menu) + (easy-menu-add idlwave-mode-debug-menu)))) + (buffer-list))))) ;; The Breakpoint Glyph ------------------------------------------------------- (defvar idlwave-shell-bp-glyph nil "The glyphs to mark breakpoint lines in the source code.") -(let ((image-alist +(let ((image-alist '((bp . "/* XPM */ static char * file[] = { \"14 12 3 1\",
--- a/lisp/progmodes/idlw-toolbar.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/progmodes/idlw-toolbar.el Sat Oct 13 05:53:03 2007 +0000 @@ -916,21 +916,21 @@ (idlwave-toolbar-add)) (buffer-list))) ;; For Emacs, add the key definitions to the mode maps - (mapcar (lambda (x) - (let* ((icon (aref x 0)) - (func (aref x 1)) - (show (aref x 2)) - (help (aref x 3)) - (key (vector 'tool-bar func)) - (def (list 'menu-item - "a" - func - :image (symbol-value icon) - :visible show - :help help))) - (define-key idlwave-mode-map key def) - (define-key idlwave-shell-mode-map key def))) - (reverse idlwave-toolbar))) + (mapc (lambda (x) + (let* ((icon (aref x 0)) + (func (aref x 1)) + (show (aref x 2)) + (help (aref x 3)) + (key (vector 'tool-bar func)) + (def (list 'menu-item + "a" + func + :image (symbol-value icon) + :visible show + :help help))) + (define-key idlwave-mode-map key def) + (define-key idlwave-shell-mode-map key def))) + (reverse idlwave-toolbar))) (setq idlwave-toolbar-visible t))) (defun idlwave-toolbar-remove-everywhere () @@ -947,15 +947,15 @@ (idlwave-toolbar-remove)) (buffer-list))) ;; For Emacs, remove the key definitions from the mode maps - (mapcar (lambda (x) - (let* (;;(icon (aref x 0)) - (func (aref x 1)) - ;;(show (aref x 2)) - ;;(help (aref x 3)) - (key (vector 'tool-bar func))) - (define-key idlwave-mode-map key nil) - (define-key idlwave-shell-mode-map key nil))) - idlwave-toolbar)) + (mapc (lambda (x) + (let* (;;(icon (aref x 0)) + (func (aref x 1)) + ;;(show (aref x 2)) + ;;(help (aref x 3)) + (key (vector 'tool-bar func))) + (define-key idlwave-mode-map key nil) + (define-key idlwave-shell-mode-map key nil))) + idlwave-toolbar)) (setq idlwave-toolbar-visible nil))) (defun idlwave-toolbar-toggle (&optional force-on)
--- a/lisp/progmodes/idlwave.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/progmodes/idlwave.el Sat Oct 13 05:53:03 2007 +0000 @@ -2827,10 +2827,10 @@ ;; Before indenting, run action routines. ;; (if (and expand idlwave-do-actions) - (mapcar 'idlwave-do-action idlwave-indent-expand-table)) + (mapc 'idlwave-do-action idlwave-indent-expand-table)) ;; (if idlwave-do-actions - (mapcar 'idlwave-do-action idlwave-indent-action-table)) + (mapc 'idlwave-do-action idlwave-indent-action-table)) ;; ;; No longer expand abbrevs on the line. The user can do this ;; manually using expand-region-abbrevs. @@ -4242,9 +4242,9 @@ (defun idlwave-sintern-keyword-list (kwd-list &optional set) "Sintern a set of keywords (file (key . link) (key2 . link2) ...)" - (mapcar (lambda(x) - (setcar x (idlwave-sintern-keyword (car x) set))) - (cdr kwd-list)) + (mapc (lambda(x) + (setcar x (idlwave-sintern-keyword (car x) set))) + (cdr kwd-list)) kwd-list) (defun idlwave-sintern-rinfo-list (list &optional set default-dir) @@ -5560,11 +5560,11 @@ ;; Define the routine info list (insert "\n(setq idlwave-user-catalog-routines\n '(") (let ((standard-output (current-buffer))) - (mapcar (lambda (x) - (insert "\n ") - (prin1 x) - (goto-char (point-max))) - idlwave-user-catalog-routines)) + (mapc (lambda (x) + (insert "\n ") + (prin1 x) + (goto-char (point-max))) + idlwave-user-catalog-routines)) (insert (format "))\n\n;;; %s ends here\n" (file-name-nondirectory idlwave-user-catalog-file))) (goto-char (point-min)) @@ -5604,11 +5604,11 @@ ;; Define the variable which contains a list of all scanned directories (insert "\n(setq idlwave-path-alist\n '(") (let ((standard-output (current-buffer))) - (mapcar (lambda (x) - (insert "\n ") - (prin1 x) - (goto-char (point-max))) - idlwave-path-alist)) + (mapc (lambda (x) + (insert "\n ") + (prin1 x) + (goto-char (point-max))) + idlwave-path-alist)) (insert "))\n") (save-buffer 0) (kill-buffer (current-buffer)))) @@ -6319,12 +6319,12 @@ (if (null method) (mapcar 'car (idlwave-class-alist)) (let (rtn) - (mapcar (lambda (x) - (and (nth 2 x) - (or (not type) - (eq type (nth 1 x))) - (push (nth 2 x) rtn))) - (idlwave-all-assq method (idlwave-routines))) + (mapc (lambda (x) + (and (nth 2 x) + (or (not type) + (eq type (nth 1 x))) + (push (nth 2 x) rtn))) + (idlwave-all-assq method (idlwave-routines))) (idlwave-uniquify rtn)))) (defun idlwave-all-method-keyword-classes (method keyword &optional type) @@ -6335,13 +6335,13 @@ (null keyword)) nil (let (rtn) - (mapcar (lambda (x) - (and (nth 2 x) ; non-nil class - (or (not type) ; correct or unspecified type - (eq type (nth 1 x))) - (assoc keyword (idlwave-entry-keywords x)) - (push (nth 2 x) rtn))) - (idlwave-all-assq method (idlwave-routines))) + (mapc (lambda (x) + (and (nth 2 x) ; non-nil class + (or (not type) ; correct or unspecified type + (eq type (nth 1 x))) + (assoc keyword (idlwave-entry-keywords x)) + (push (nth 2 x) rtn))) + (idlwave-all-assq method (idlwave-routines))) (idlwave-uniquify rtn)))) (defun idlwave-members-only (list club) @@ -7551,7 +7551,7 @@ If RECORD-LINK is non-nil, the keyword text is copied and a text property indicating the link is added." (let (kwds) - (mapcar + (mapc (lambda (key-list) (let ((file (car key-list))) (mapcar (lambda (key-cons) @@ -8277,8 +8277,8 @@ (memq (nth 2 entry) super-classes) ; an inherited class (eq (nth 1 entry) type) ; correct type (eq (car entry) name) ; correct name - (mapcar (lambda (k) (add-to-list 'keywords k)) - (idlwave-entry-keywords entry 'do-link)))) + (mapc (lambda (k) (add-to-list 'keywords k)) + (idlwave-entry-keywords entry 'do-link)))) (setq keywords (idlwave-uniquify keywords))) ;; Return the final list @@ -8437,7 +8437,7 @@ (if (null keywords) (insert " No keywords accepted.") (setq col 9) - (mapcar + (mapc (lambda (x) (if (>= (+ col 1 (length (car x))) (window-width))
--- a/lisp/server.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/server.el Sat Oct 13 05:53:03 2007 +0000 @@ -561,6 +561,7 @@ (server-quote-arg text))))))))) (defun server-create-tty-frame (tty type proc) + (add-to-list 'frame-inherited-parameters 'client) (let ((frame (server-with-environment (process-get proc 'env) '("LANG" "LC_CTYPE" "LC_ALL" @@ -575,6 +576,16 @@ ;; Ignore nowait here; we always need to ;; clean up opened ttys when the client dies. `((client . ,proc) + ;; This is a leftover from an earlier + ;; attempt at making it possible for process + ;; run in the server process to use the + ;; environment of the client process. + ;; It has no effect now and to make it work + ;; we'd need to decide how to make + ;; process-environment interact with client + ;; envvars, and then to change the + ;; C functions `child_setup' and + ;; `getenv_internal' accordingly. (environment . ,(process-get proc 'env))))))) ;; ttys don't use the `display' parameter, but callproc.c does to set @@ -594,6 +605,7 @@ frame)) (defun server-create-window-system-frame (display nowait proc) + (add-to-list 'frame-inherited-parameters 'client) (if (not (fboundp 'make-frame-on-display)) (progn ;; This emacs does not support X. @@ -606,6 +618,7 @@ ;; `server-save-buffers-kill-terminal' from unexpectedly ;; killing emacs on that frame. (let* ((params `((client . ,(if nowait 'nowait proc)) + ;; This is a leftover, see above. (environment . ,(process-get proc 'env)))) (frame (make-frame-on-display (or display @@ -614,9 +627,8 @@ (error "Please specify display")) params))) (server-log (format "%s created" frame) proc) - ;; XXX We need to ensure the parameters are - ;; really set because Emacs forgets unhandled - ;; initialization parameters for X frames at + ;; XXX We need to ensure the parameters are really set because Emacs + ;; forgets unhandled initialization parameters for X frames at ;; the moment. (modify-frame-parameters frame params) (select-frame frame)
--- a/lisp/startup.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/startup.el Sat Oct 13 05:53:03 2007 +0000 @@ -875,6 +875,10 @@ ;; Run the site-start library if it exists. The point of this file is ;; that it is run before .emacs. There is no point in doing this after ;; .emacs; that is useless. + ;; Note that user-init-file is nil at this point. Code that might + ;; be loaded from site-run-file and wants to test if -q was given + ;; should check init-file-user instead, since that is already set. + ;; See cus-edit.el for an example. (if site-run-file (load site-run-file t t)) @@ -1014,11 +1018,9 @@ (with-current-buffer (window-buffer) (deactivate-mark))) - ;; If the user has a file of abbrevs, read it. - ;; FIXME: after the 22.0 release this should be changed so - ;; that it does not read the abbrev file when -batch is used - ;; on the command line. - (when (and (file-exists-p abbrev-file-name) + ;; If the user has a file of abbrevs, read it (unless -batch). + (when (and (not noninteractive) + (file-exists-p abbrev-file-name) (file-readable-p abbrev-file-name)) (quietly-read-abbrev-file abbrev-file-name)) @@ -1449,7 +1451,7 @@ (when concise (fancy-splash-insert - :face 'variable-pitch "\n\n" + :face 'variable-pitch "\n" :link '("Dismiss" (lambda (button) (when startup-screen-inhibit-startup-screen (customize-set-variable 'inhibit-startup-screen t) @@ -1489,34 +1491,39 @@ "Display fancy startup screen. If CONCISE is non-nil, display a concise version of the splash screen in another window." - (with-current-buffer (get-buffer-create "*GNU Emacs*") - (let ((inhibit-read-only t)) - (erase-buffer) - (make-local-variable 'startup-screen-inhibit-startup-screen) - (if pure-space-overflow - (insert pure-space-overflow-message)) - (unless concise - (fancy-splash-head)) - (dolist (text fancy-startup-text) - (apply #'fancy-splash-insert text) - (insert "\n")) - (skip-chars-backward "\n") - (delete-region (point) (point-max)) - (insert "\n") - (fancy-startup-tail concise)) - (use-local-map splash-screen-keymap) - (setq tab-width 22) - (set-buffer-modified-p nil) - (setq buffer-read-only t) - (if (and view-read-only (not view-mode)) - (view-mode-enter nil 'kill-buffer)) - (goto-char (point-min))) - (if (or (window-minibuffer-p) - (window-dedicated-p (selected-window))) - (pop-to-buffer (current-buffer))) - (if concise - (display-buffer (get-buffer "*GNU Emacs*")) - (switch-to-buffer "*GNU Emacs*"))) + (let ((splash-buffer (get-buffer-create "*GNU Emacs*"))) + (with-current-buffer splash-buffer + (let ((inhibit-read-only t)) + (erase-buffer) + (make-local-variable 'startup-screen-inhibit-startup-screen) + (if pure-space-overflow + (insert pure-space-overflow-message)) + (unless concise + (fancy-splash-head)) + (dolist (text fancy-startup-text) + (apply #'fancy-splash-insert text) + (insert "\n")) + (skip-chars-backward "\n") + (delete-region (point) (point-max)) + (insert "\n") + (fancy-startup-tail concise)) + (use-local-map splash-screen-keymap) + (setq tab-width 22 + buffer-read-only t) + (set-buffer-modified-p nil) + (if (and view-read-only (not view-mode)) + (view-mode-enter nil 'kill-buffer)) + (goto-char (point-max))) + (if concise + (progn + (display-buffer splash-buffer) + ;; If the splash screen is in a split window, fit it. + (let ((window (get-buffer-window splash-buffer t))) + (or (null window) + (eq window (selected-window)) + (eq window (next-window window)) + (fit-window-to-buffer window)))) + (switch-to-buffer splash-buffer)))) (defun fancy-about-screen () "Display fancy About screen." @@ -2149,9 +2156,11 @@ (expand-file-name (command-line-normalize-file-name orig-argi) dir))) - (if (= file-count 1) - (setq first-file-buffer (find-file file)) - (find-file-other-window file))) + (cond ((= file-count 1) + (setq first-file-buffer (find-file file))) + (inhibit-startup-screen + (find-file-other-window file)) + (t (find-file file)))) (or (zerop line) (goto-line line)) (setq line 0) @@ -2208,12 +2217,12 @@ ;; Don't let the hook be run twice. (setq window-setup-hook nil)) - ;; Do this now to avoid an annoying delay if the user - ;; clicks the menu bar during the sit-for. - (when (display-popup-menus-p) - (precompute-menubar-bindings)) - (with-no-warnings - (setq menubar-bindings-done t)) + ;; ;; Do this now to avoid an annoying delay if the user + ;; ;; clicks the menu bar during the sit-for. + ;; (when (display-popup-menus-p) + ;; (precompute-menubar-bindings)) + ;; (with-no-warnings + ;; (setq menubar-bindings-done t)) ;; If *scratch* exists and is empty, insert initial-scratch-message. (and initial-scratch-message
--- a/lisp/term/xterm.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/term/xterm.el Sat Oct 13 05:53:03 2007 +0000 @@ -89,18 +89,18 @@ (define-key map "\e[23;6~" [C-S-f11]) (define-key map "\e[24;6~" [C-S-f12]) - (define-key map "\eO3P" [A-f1]) - (define-key map "\eO3Q" [A-f2]) - (define-key map "\eO3R" [A-f3]) - (define-key map "\eO3S" [A-f4]) - (define-key map "\e[15;3~" [A-f5]) - (define-key map "\e[17;3~" [A-f6]) - (define-key map "\e[18;3~" [A-f7]) - (define-key map "\e[19;3~" [A-f8]) - (define-key map "\e[20;3~" [A-f9]) - (define-key map "\e[21;3~" [A-f10]) - (define-key map "\e[23;3~" [A-f11]) - (define-key map "\e[24;3~" [A-f12]) + (define-key map "\eO3P" [M-f1]) + (define-key map "\eO3Q" [M-f2]) + (define-key map "\eO3R" [M-f3]) + (define-key map "\eO3S" [M-f4]) + (define-key map "\e[15;3~" [M-f5]) + (define-key map "\e[17;3~" [M-f6]) + (define-key map "\e[18;3~" [M-f7]) + (define-key map "\e[19;3~" [M-f8]) + (define-key map "\e[20;3~" [M-f9]) + (define-key map "\e[21;3~" [M-f10]) + (define-key map "\e[23;3~" [M-f11]) + (define-key map "\e[24;3~" [M-f12]) (define-key map "\eO4P" [M-S-f1]) (define-key map "\eO4Q" [M-S-f2]) @@ -164,12 +164,12 @@ (define-key map "\e[1;8F" [C-M-S-end]) (define-key map "\e[1;8H" [C-M-S-home]) - (define-key map "\e[1;3A" [A-up]) - (define-key map "\e[1;3B" [A-down]) - (define-key map "\e[1;3C" [A-right]) - (define-key map "\e[1;3D" [A-left]) - (define-key map "\e[1;3F" [A-end]) - (define-key map "\e[1;3H" [A-home]) + (define-key map "\e[1;3A" [M-up]) + (define-key map "\e[1;3B" [M-down]) + (define-key map "\e[1;3C" [M-right]) + (define-key map "\e[1;3D" [M-left]) + (define-key map "\e[1;3F" [M-end]) + (define-key map "\e[1;3H" [M-home]) (define-key map "\e[2~" [insert]) (define-key map "\e[3~" [delete]) @@ -206,10 +206,10 @@ (define-key map "\e[5;8~" [C-M-S-prior]) (define-key map "\e[6;8~" [C-M-S-next]) - (define-key map "\e[2;3~" [A-insert]) - (define-key map "\e[3;3~" [A-delete]) - (define-key map "\e[5;3~" [A-prior]) - (define-key map "\e[6;3~" [A-next]) + (define-key map "\e[2;3~" [M-insert]) + (define-key map "\e[3;3~" [M-delete]) + (define-key map "\e[5;3~" [M-prior]) + (define-key map "\e[6;3~" [M-next]) (define-key map "\e[4~" [select]) (define-key map "\e[29~" [print]) @@ -425,18 +425,18 @@ (define-key map [f47] [C-S-f11]) (define-key map [f48] [C-S-f12]) - (define-key map [f49] [A-f1]) - (define-key map [f50] [A-f2]) - (define-key map [f51] [A-f3]) - (define-key map [f52] [A-f4]) - (define-key map [f53] [A-f5]) - (define-key map [f54] [A-f6]) - (define-key map [f55] [A-f7]) - (define-key map [f56] [A-f8]) - (define-key map [f57] [A-f9]) - (define-key map [f58] [A-f10]) - (define-key map [f59] [A-f11]) - (define-key map [f60] [A-f12]) + (define-key map [f49] [M-f1]) + (define-key map [f50] [M-f2]) + (define-key map [f51] [M-f3]) + (define-key map [f52] [M-f4]) + (define-key map [f53] [M-f5]) + (define-key map [f54] [M-f6]) + (define-key map [f55] [M-f7]) + (define-key map [f56] [M-f8]) + (define-key map [f57] [M-f9]) + (define-key map [f58] [M-f10]) + (define-key map [f59] [M-f11]) + (define-key map [f60] [M-f12]) map) "Keymap of possible alternative meanings for some keys.")
--- a/lisp/textmodes/org-export-latex.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/textmodes/org-export-latex.el Sat Oct 13 05:53:03 2007 +0000 @@ -1,10 +1,15 @@ -;;; org-export-latex.el --- LaTeX exporter for Org-mode + ;;; org-export-latex.el --- LaTeX exporter for org-mode +;; ;; Copyright (C) 2007 Free Software Foundation, Inc. ;; +;; Emacs Lisp Archive Entry +;; Filename: org-export-latex.el +;; Version: 5.11 ;; Author: Bastien Guerry <bzg AT altern DOT org> -;; Keywords: org organizer latex export convert -;; Homepage: http://www.cognition.ens.fr/~guerry/u/org-export-latex.el -;; Version: 5.09 +;; Maintainer: Bastien Guerry <bzg AT altern DOT org> +;; Keywords: org, wp, tex +;; Description: Converts an org-mode buffer into LaTeX +;; URL: http://www.cognition.ens.fr/~guerry/u/org-export-latex.el ;; ;; This file is part of GNU Emacs. ;; @@ -17,7 +22,7 @@ ;; 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 @@ -83,12 +88,17 @@ :type 'alist) (defcustom org-export-latex-emphasis-alist - '(("*" "\\textbf{%s}") - ("/" "\\emph{%s}") - ("_" "\\underline{%s}") - ("+" "\\texttt{%s}") - ("=" "\\texttt{%s}")) - "Alist of LaTeX expressions to convert emphasis fontifiers." + '(("*" "\\textbf{%s}" nil) + ("/" "\\emph{%s}" nil) + ("_" "\\underline{%s}" nil) + ("+" "\\texttt{%s}" nil) + ("=" "\\texttt{%s}" nil)) + "Alist of LaTeX expressions to convert emphasis fontifiers. +Each element of the list is a list of three elements. +The first element is the character used as a marker for fontification. +The second element is a formatting string to wrap fontified text with. +The third element decides whether to protect converted text from other +conversions." :group 'org-export-latex :type 'alist) @@ -101,6 +111,14 @@ :group 'org-export-latex :type 'string) +(defcustom org-export-latex-title-command "\\maketitle" + "The command used to insert the title just after \\begin{document}. +If this string contains the formatting specification \"%s\" then +it will be used as a formatting string, passing the title as an +argument." + :group 'org-export-latex + :type 'string) + (defcustom org-export-latex-date-format "%d %B %Y" "Format string for \\date{...}." @@ -124,11 +142,14 @@ :type 'alist) (defcustom org-export-latex-low-levels 'description - "Choice for converting sections that are below the current -admitted level of sectioning. This can be either nil (ignore the -sections), 'description (convert them as description lists) or a -string to be used instead of \\section{%s} (a %s for inserted the -headline is mandatory)." + "How to convert sections below the current level of sectioning, +as specified by `org-export-headline-levels' or the value of \"H:\" +in Org's #+OPTION line. + +This can be either nil (skip the sections), 'description (convert +the sections as descriptive lists) or a string to be used instead +of \\section{%s}. In this latter case, the %s stands here for the +inserted headline and is mandatory." :group 'org-export-latex :type '(choice (const :tag "Ignore" nil) (symbol :tag "Convert as descriptive list" description) @@ -248,7 +269,8 @@ (message "Exporting to LaTeX...") (org-update-radio-target-regexp) (org-export-latex-set-initial-vars ext-plist) - (let* ((opt-plist org-latex-options-plist) + (let* ((wcf (current-window-configuration)) + (opt-plist org-latex-options-plist) (filename (concat (file-name-as-directory (org-export-directory :LaTeX ext-plist)) (file-name-sans-extension @@ -284,15 +306,27 @@ region :emph-multiline t :for-LaTeX t :comments nil - :add-text text + :add-text (if (eq to-buffer 'string) nil text) :skip-before-1st-heading skip :LaTeX-fragments nil))) - (set-buffer buffer) + + (set-buffer buffer) (erase-buffer) - (unless body-only (insert preamble)) - (when text (insert (org-export-latex-content text) "\n\n")) - (unless skip (insert first-lines)) + (and (fboundp 'set-buffer-file-coding-system) + (set-buffer-file-coding-system coding-system-for-write)) + + ;; insert the preamble and initial document commands + (unless (or (eq to-buffer 'string) body-only) + (insert preamble)) + + ;; insert text found in #+TEXT + (when (and text (not (eq to-buffer 'string))) + (insert (org-export-latex-content text) "\n\n")) + + ;; insert lines before the first headline + (unless (or skip (eq to-buffer 'string)) + (insert first-lines)) ;; handle the case where the region does not begin with a section (when region-p @@ -300,25 +334,30 @@ (insert string-for-export) (org-export-latex-first-lines)))) + ;; export the content of headlines (org-export-latex-global (with-temp-buffer (insert string-for-export) (goto-char (point-min)) - (re-search-forward "^\\(\\*+\\) " nil t) - (let* ((asters (length (match-string 1))) - (level (if odd (- asters 2) (- asters 1)))) - (setq org-latex-add-level - (if odd (1- (/ (1+ asters) 2)) (1- asters))) - (org-export-latex-parse-global level odd)))) - + (when (re-search-forward "^\\(\\*+\\) " nil t) + (let* ((asters (length (match-string 1))) + (level (if odd (- asters 2) (- asters 1)))) + (setq org-latex-add-level + (if odd (1- (/ (1+ asters) 2)) (1- asters))) + (org-export-latex-parse-global level odd))))) + + ;; finalization (unless body-only (insert "\n\\end{document}")) (or to-buffer (save-buffer)) (goto-char (point-min)) (message "Exporting to LaTeX...done") - (if (eq to-buffer 'string) - (prog1 (buffer-substring (point-min) (point-max)) - (kill-buffer (current-buffer))) - (current-buffer)))) + (prog1 + (if (eq to-buffer 'string) + (prog1 (buffer-substring (point-min) (point-max)) + (kill-buffer (current-buffer))) + (current-buffer)) + (set-window-configuration wcf)))) + ;;; Parsing functions: (defun org-export-latex-parse-global (level odd) @@ -484,8 +523,11 @@ ;;; Exporting internals: -(defun org-latex-protect (string) - (add-text-properties 0 (length string) '(org-protected t) string) string) +(defun org-export-latex-protect-string (string) + "Prevent further conversion for STRING by adding the +org-protect property." + (add-text-properties + 0 (length string) '(org-protected t) string) string) (defun org-export-latex-protect-char-in-string (char-list string) "Add org-protected text-property to char from CHAR-LIST in STRING." @@ -518,54 +560,65 @@ "Make the LaTeX preamble and return it as a string. Argument OPT-PLIST is the options plist for current buffer." (let ((toc (plist-get opt-plist :table-of-contents))) - (concat (if (plist-get opt-plist :time-stamp-file) - (format-time-string "% Created %Y-%m-%d %a %H:%M\n")) - - ;; LaTeX custom preamble - org-export-latex-preamble "\n" - - ;; LaTeX packages - (if org-export-latex-packages-alist - (mapconcat (lambda(p) - (if (equal "" (car p)) - (format "\\usepackage{%s}" (cadr p)) - (format "\\usepackage[%s]{%s}" - (car p) (cadr p)))) - org-export-latex-packages-alist "\n") "") - "\n\\begin{document}\n\n" - - ;; title - (format - "\\title{%s}\n" - (or (plist-get opt-plist :title) - (and (not - (plist-get opt-plist :skip-before-1st-heading)) - (org-export-grab-title-from-buffer)) - (and buffer-file-name - (file-name-sans-extension - (file-name-nondirectory buffer-file-name))) - "UNTITLED")) - - ;; author info - (if (plist-get opt-plist :author-info) - (format "\\author{%s}\n" - (or (plist-get opt-plist :author) user-full-name)) - (format "%%\\author{%s}\n" - (or (plist-get opt-plist :author) user-full-name))) - - ;; date - (format "\\date{%s}\n" - (format-time-string - (or (plist-get opt-plist :date) - org-export-latex-date-format))) - - "\\maketitle\n\n" - ;; table of contents - (if (and (plist-get opt-plist :section-numbers) toc) - (format "\\setcounter{tocdepth}{%s}\n" - (plist-get opt-plist :headline-levels)) "") - (if (and (plist-get opt-plist :section-numbers) toc) - "\\tableofcontents\n" "\n")))) + (concat + (if (plist-get opt-plist :time-stamp-file) + (format-time-string "% Created %Y-%m-%d %a %H:%M\n")) + + ;; insert LaTeX custom preamble + org-export-latex-preamble "\n" + + ;; insert information on LaTeX packages + (when org-export-latex-packages-alist + (mapconcat (lambda(p) + (if (equal "" (car p)) + (format "\\usepackage{%s}" (cadr p)) + (format "\\usepackage[%s]{%s}" + (car p) (cadr p)))) + org-export-latex-packages-alist "\n")) + + ;; insert the title + (format + "\\title{%s}\n" + (or (plist-get opt-plist :title) + (and (not + (plist-get opt-plist :skip-before-1st-heading)) + (org-export-grab-title-from-buffer)) + (and buffer-file-name + (file-name-sans-extension + (file-name-nondirectory buffer-file-name))) + "UNTITLED")) + + ;; insert author info + (if (plist-get opt-plist :author-info) + (format "\\author{%s}\n" + (or (plist-get opt-plist :author) user-full-name)) + (format "%%\\author{%s}\n" + (or (plist-get opt-plist :author) user-full-name))) + + ;; insert the date + (format "\\date{%s}\n" + (format-time-string + (or (plist-get opt-plist :date) + org-export-latex-date-format))) + + ;; beginning of the document + "\n\\begin{document}\n\n" + + ;; insert the title command + (if (string-match "%s" org-export-latex-title-command) + (format org-export-latex-title-command + (plist-get opt-plist :title)) + org-export-latex-title-command) + "\n\n" + + ;; table of contents + (when (and org-export-with-toc + (plist-get opt-plist :section-numbers)) + (cond ((numberp toc) + (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\n" + (min toc (plist-get opt-plist :headline-levels)))) + (toc (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\n" + (plist-get opt-plist :headline-levels)))))))) (defun org-export-latex-first-lines (&optional comments) "Export the first lines before first headline. @@ -640,6 +693,7 @@ (plist-get org-latex-options-plist :tables)) (org-export-latex-fixed-width (plist-get org-latex-options-plist :fixed-width)) + ;; return string (buffer-substring (point-min) (point-max)))) (defun org-export-latex-quotation-marks () @@ -658,7 +712,7 @@ (mapc (lambda(l) (goto-char (point-min)) (while (re-search-forward (car l) nil t) (let ((rpl (concat (match-string 1) (cadr l)))) - (org-latex-protect rpl) + (org-export-latex-protect-string rpl) (org-if-unprotected (replace-match rpl t t))))) quote-rpl))) @@ -688,42 +742,42 @@ ;; Put the point where to check for org-protected (unless (get-text-property (match-beginning 2) 'org-protected) (cond ((member (match-string 2) '("\\$" "$")) - (if (equal (match-string 2) "\\$") - (replace-match (concat (match-string 1) "$" - (match-string 3)) t t) - (replace-match (concat (match-string 1) "\\$" - (match-string 3)) t t))) - ((member (match-string 2) '("&" "#" "%")) - (if (equal (match-string 1) "\\") - (replace-match (match-string 2) t t) - (replace-match (concat (match-string 1) "\\" - (match-string 2)) t t))) - ((equal (match-string 2) "~") - (cond ((equal (match-string 1) "\\") nil) - ((eq 'org-link (get-text-property 0 'face (match-string 2))) - (replace-match (concat (match-string 1) "\\~") t t)) - (t (replace-match - (org-latex-protect - (concat (match-string 1) "\\~{}")) t t)))) - ((member (match-string 2) '("{" "}")) - (unless (save-match-data (org-inside-LaTeX-fragment-p)) - (if (equal (match-string 1) "\\") - (replace-match (match-string 2) t t) - (replace-match (concat (match-string 1) "\\" - (match-string 2)) t t))))) + (if (equal (match-string 2) "\\$") + (replace-match (concat (match-string 1) "$" + (match-string 3)) t t) + (replace-match (concat (match-string 1) "\\$" + (match-string 3)) t t))) + ((member (match-string 2) '("&" "%" "#")) + (if (equal (match-string 1) "\\") + (replace-match (match-string 2) t t) + (replace-match (concat (match-string 1) "\\" + (match-string 2)) t t))) + ((equal (match-string 2) "~") + (cond ((equal (match-string 1) "\\") nil) + ((eq 'org-link (get-text-property 0 'face (match-string 2))) + (replace-match (concat (match-string 1) "\\~") t t)) + (t (replace-match + (org-export-latex-protect-string + (concat (match-string 1) "\\~{}")) t t)))) + ((member (match-string 2) '("{" "}")) + (unless (save-match-data (org-inside-LaTeX-fragment-p)) + (if (equal (match-string 1) "\\") + (replace-match (match-string 2) t t) + (replace-match (concat (match-string 1) "\\" + (match-string 2)) t t))))) (unless (save-match-data (org-inside-LaTeX-fragment-p)) - (cond ((equal (match-string 2) "\\") - (replace-match (or (save-match-data - (org-export-latex-treat-backslash-char - (match-string 1) - (match-string 3))) "") t t)) - ((member (match-string 2) '("_" "^")) - (replace-match (or (save-match-data - (org-export-latex-treat-sub-super-char - sub-superscript - (match-string 1) - (match-string 2) - (match-string 3))) "") t t))))))) + (cond ((equal (match-string 2) "\\") + (replace-match (or (save-match-data + (org-export-latex-treat-backslash-char + (match-string 1) + (match-string 3))) "") t t)) + ((member (match-string 2) '("_" "^")) + (replace-match (or (save-match-data + (org-export-latex-treat-sub-super-char + sub-superscript + (match-string 1) + (match-string 2) + (match-string 3))) "") t t))))))) '("^\\([^\n$]*?\\|^\\)\\(\\\\?\\$\\)\\([^\n$]*\\)$" "\\([a-za-z0-9]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\([a-za-z0-9]+\\|[ \t\n]\\|[:punct:]\\|{[a-za-z0-9]+}\\|([a-za-z0-9]+)\\)" "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|[a-zA-Z&#%{}\"]+\\)" @@ -732,7 +786,10 @@ "\\(.\\|^\\)\\(%\\)" "\\(.\\|^\\)\\({\\)" "\\(.\\|^\\)\\(}\\)" - "\\(.\\|^\\)\\(~\\)"))) + "\\(.\\|^\\)\\(~\\)" + ;; (?\< . "\\textless{}") + ;; (?\> . "\\textgreater{}") + ))) (defun org-export-latex-treat-sub-super-char (subsup string-before char string-after) @@ -759,9 +816,9 @@ (format "$%s%s{%s}$" string-before char (match-string 1 string-after))) (subsup (concat "$" string-before char string-after "$")) - (t (org-latex-protect + (t (org-export-latex-protect-string (concat string-before "\\" char "{}" string-after))))) - (t (org-latex-protect + (t (org-export-latex-protect-string (concat string-before "\\" char "{}" string-after))))) (defun org-export-latex-treat-backslash-char (string-before string-after) @@ -775,17 +832,21 @@ ((and (not (string-match "^[ \n\t]" string-after)) (not (string-match "[ \t]\\'\\|^" string-before))) ;; backslash is inside a word - (concat string-before "$\\backslash$" string-after)) + (org-export-latex-protect-string + (concat string-before "\\textbackslash{}" string-after))) ((not (or (equal string-after "") (string-match "^[ \t\n]" string-after))) ;; backslash might escape a character (like \#) or a user TeX ;; macro (like \setcounter) - (concat string-before "\\" string-after)) + (org-export-latex-protect-string + (concat string-before "\\" string-after))) ((and (string-match "^[ \t\n]" string-after) (string-match "[ \t\n]\\'" string-before)) ;; backslash is alone, convert it to $\backslash$ - (concat string-before "$\\backslash$" string-after)) - (t (concat string-before "$\\backslash$" string-after)))) + (org-export-latex-protect-string + (concat string-before "\\textbackslash{}" string-after))) + (t (org-export-latex-protect-string + (concat string-before "\\textbackslash{}" string-after))))) (defun org-export-latex-keywords (timestamps) "Convert special keywords to LaTeX. @@ -801,6 +862,7 @@ (defun org-export-latex-fixed-width (opt) "When OPT is non-nil convert fixed-width sections to LaTeX." (goto-char (point-min)) + ;; FIXME the search shouldn't be performed on already converted text (while (re-search-forward "^[ \t]*:" nil t) (if opt (progn (goto-char (match-beginning 0)) @@ -816,7 +878,6 @@ (match-string 2)) t t) (forward-line)))))) -;; FIXME Use org-export-highlight-first-table-line ? (defun org-export-latex-lists () "Convert lists to LaTeX." (goto-char (point-min)) @@ -883,52 +944,87 @@ ;; Add a trailing \n after list conversion "\n")) -(defun org-export-latex-tables (opt) - "When OPT is non-nil convert tables to LaTeX." +;; FIXME Use org-export-highlight-first-table-line ? +(defun org-export-latex-tables (insert) + "Convert tables to LaTeX and INSERT it." (goto-char (point-min)) (while (re-search-forward "^\\([ \t]*\\)|" nil t) - ;; Re-align the table to update org-table-last-alignment - ;; (save-excursion (save-match-data (org-table-align))) - (let (tbl-list - (beg (match-beginning 0)) - (end (save-excursion - (re-search-forward - (concat "^" (regexp-quote (match-string 1)) - "[^|]\\|\\'") nil t) (match-beginning 0)))) - (beginning-of-line) + ;; FIXME really need to save-excursion? + (save-excursion (org-table-align)) + (let* ((beg (org-table-begin)) + (end (org-table-end)) + (raw-table (buffer-substring-no-properties beg end)) + fnum line lines olines gr colgropen line-fmt alignment) (if org-export-latex-tables-verbatim - (let* ((raw-table (buffer-substring beg end)) - (tbl (concat "\\begin{verbatim}\n" raw-table + (let* ((tbl (concat "\\begin{verbatim}\n" raw-table "\\end{verbatim}\n"))) (apply 'delete-region (list beg end)) (insert tbl)) - (progn - (while (not (eq end (point))) - (if (looking-at "[ \t]*|\\([^-|].+\\)|[ \t]*$") - (push (split-string (org-trim (match-string 1)) "|") tbl-list) - (push 'hline tbl-list)) - (forward-line)) - ;; comment region out instead of deleting it ? + (progn + (setq lines (split-string raw-table "\n" t)) (apply 'delete-region (list beg end)) - (when opt (insert (orgtbl-to-latex (nreverse tbl-list) - nil) "\n\n"))))))) + (when org-export-table-remove-special-lines + (setq lines (org-table-clean-before-export lines))) + ;; make a formatting string to reflect aligment + (setq olines lines) + (while (and (not line-fmt) (setq line (pop olines))) + (unless (string-match "^[ \t]*|-" line) + (setq fields (org-split-string line "[ \t]*|[ \t]*")) + (setq fnum (make-vector (length fields) 0)) + (setq line-fmt + (mapconcat + (lambda (x) + (setq gr (pop org-table-colgroup-info)) + (format "%s%%s%s" + (cond ((eq gr ':start) + (prog1 (if colgropen "|" "") + (setq colgropen t))) + ((eq gr ':startend) + (prog1 (if colgropen "|" "|") + (setq colgropen nil))) + (t "")) + (if (memq gr '(:end :startend)) + (progn (setq colgropen nil) "|") + ""))) + fnum "")))) + ;; maybe remove the first and last "|" + (when (string-match "^\\(|\\)?\\(.+\\)|$" line-fmt) + (setq line-fmt (match-string 2 line-fmt))) + ;; format alignment + (setq align (apply 'format + (cons line-fmt + (mapcar (lambda (x) (if x "r" "l")) + org-table-last-alignment)))) + ;; prepare the table to send to orgtbl-to-latex + (setq lines + (mapcar + (lambda(elem) + (or (and (string-match "[ \t]*|-+" elem) 'hline) + (split-string (org-trim elem) "|" t))) + lines)) + (when insert + (insert (orgtbl-to-latex + lines `(:tstart ,(concat "\\begin{tabular}{" align "}"))) + "\n\n"))))))) (defun org-export-latex-fontify () "Convert fontification to LaTeX." (goto-char (point-min)) (while (re-search-forward org-emph-re nil t) ;; The match goes one char after the *string* - (unless (get-text-property (1- (point)) 'org-protected) - (replace-match - (concat (match-string 1) - (format - (org-export-latex-protect-char-in-string - '("\\" "{" "}") - (cadr (assoc (match-string 3) - org-export-latex-emphasis-alist))) - (match-string 4)) - (match-string 5)) t t) - (backward-char)))) + (let ((emph (assoc (match-string 3) + org-export-latex-emphasis-alist)) + rpl) + (unless (get-text-property (1- (point)) 'org-protected) + (setq rpl (concat (match-string 1) + (format (org-export-latex-protect-char-in-string + '("\\" "{" "}") (cadr emph)) + (match-string 4)) + (match-string 5))) + (if (caddr emph) + (setq rpl (org-export-latex-protect-string rpl))) + (replace-match rpl t t))) + (backward-char))) (defun org-export-latex-links () ;; Make sure to use the LaTeX hyperref and graphicx package @@ -982,12 +1078,6 @@ (&optional commentsp) "Clean stuff in the LaTeX export." - ;; align all tables - (goto-char (point-min)) - (while (re-search-forward "^\\([ \t]*\\)|" nil t) - ;; Re-align the table to update org-table-last-alignment - (org-table-align)) - ;; Preserve line breaks (goto-char (point-min)) (while (re-search-forward "\\\\\\\\" nil t) @@ -998,13 +1088,13 @@ (goto-char (point-min)) (let ((case-fold-search nil) rpl) (while (re-search-forward "\\([^+_]\\)LaTeX" nil t) - (replace-match (org-latex-protect + (replace-match (org-export-latex-protect-string (concat (match-string 1) "\\LaTeX{}")) t t))) ;; Convert horizontal rules (goto-char (point-min)) (while (re-search-forward "^----+.$" nil t) - (replace-match (org-latex-protect "\\hrule") t t)) + (replace-match (org-export-latex-protect-string "\\hrule") t t)) ;; Protect LaTeX \commands{...} (goto-char (point-min)) @@ -1018,7 +1108,7 @@ (concat "<<<?" org-latex-all-targets-regexp ">>>?\\((INVISIBLE)\\)?") nil t) (replace-match - (org-latex-protect + (org-export-latex-protect-string (format "\\label{%s}%s"(match-string 1) (if (match-string 2) "" (match-string 1)))) t t)) @@ -1035,7 +1125,7 @@ (while (re-search-forward "\\[[0-9]+\\]" nil t) (when (save-match-data (save-excursion (beginning-of-line) - (looking-at "[^:|]"))) + (looking-at "[^:|#]"))) (let ((foot-beg (match-beginning 0)) (foot-end (match-end 0)) (foot-prefix (match-string 0))
--- a/lisp/textmodes/org-publish.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/textmodes/org-publish.el Sat Oct 13 05:53:03 2007 +0000 @@ -426,7 +426,7 @@ (defun org-publish-get-plist-from-filename (filename) "Return publishing configuration plist for file FILENAME." (let ((found nil)) - (mapcar + (mapc (lambda (plist) (let ((files (org-publish-get-base-files plist))) (if (member (expand-file-name filename) files)
--- a/lisp/textmodes/org.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/textmodes/org.el Sat Oct 13 05:53:03 2007 +0000 @@ -5,7 +5,7 @@ ;; Author: Carsten Dominik <carsten at orgmode dot org> ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://orgmode.org -;; Version: 5.08 +;; Version: 5.11b ;; ;; This file is part of GNU Emacs. ;; @@ -83,7 +83,7 @@ ;;; Version -(defconst org-version "5.09" +(defconst org-version "5.11" "The version number of the file org.el.") (defun org-version () (interactive) @@ -120,7 +120,16 @@ (unwind-protect (progn ,@body) (goto-line _line) - (move-to-column _col)))) + (move-to-column _col)))) + +(defmacro org-without-partial-completion (&rest body) + `(let ((pc-mode (and (boundp 'partial-completion-mode) + partial-completion-mode))) + (unwind-protect + (progn + (if pc-mode (partial-completion-mode -1)) + ,@body) + (if pc-mode (partial-completion-mode 1))))) ;;; The custom variables @@ -131,6 +140,13 @@ :group 'hypermedia :group 'calendar) +;; FIXME: Needs a separate group... +(defcustom org-completion-fallback-command 'hippie-expand + "The expansion command called by \\[org-complete] in normal context. +Normal means, no org-mode-specific context." + :group 'org + :type 'function) + (defgroup org-startup nil "Options concerning startup of Org-mode." :tag "Org Startup" @@ -415,7 +431,7 @@ :tag "Org Cycle" :group 'org-structure) -(defcustom org-drawers '("PROPERTIES") +(defcustom org-drawers '("PROPERTIES" "CLOCK") "Names of drawers. Drawers are not opened by cycling on the headline above. Drawers only open with a TAB on the drawer line itself. A drawer looks like this: @@ -714,7 +730,9 @@ (string :tag "Use this keyword"))) (defcustom org-archive-stamp-time t - "Non-nil means, add a time stamp to entries moved to an archive file." + "Non-nil means, add a time stamp to entries moved to an archive file. +This variable is obsolete and has no effect anymore, instead add ot remove +`time' from the variablle `org-archive-save-context-info'." :group 'org-archive :type 'boolean) @@ -736,7 +754,8 @@ the archived entry, with a prefix \"PRE_ARCHIVE_\", to remember this information." :group 'org-archive - :type '(set + :type '(set :greedy t + (const :tag "Time" time) (const :tag "File" file) (const :tag "Category" category) (const :tag "TODO state" todo) @@ -1599,7 +1618,10 @@ #+STARTUP: nologging #+STARTUP: lognotedone #+STARTUP: lognotestate - #+STARTUP: lognoteclock-out" + #+STARTUP: lognoteclock-out + +You can have local logging settings for a subtree by setting the LOGGING +property to one or more of these keywords." :group 'org-todo :group 'org-progress :type '(choice @@ -1646,11 +1668,32 @@ (defcustom org-log-repeat t "Non-nil means, prompt for a note when REPEAT is resetting a TODO entry. -When nil, no note will be taken." +When nil, no note will be taken. +This option can also be set with on a per-file-basis with + + #+STARTUP: logrepeat + #+STARTUP: nologrepeat + +You can have local logging settings for a subtree by setting the LOGGING +property to one or more of these keywords." :group 'org-todo :group 'org-progress :type 'boolean) +(defcustom org-clock-into-drawer 2 + "Should clocking info be wrapped into a drawer? +When t, clocking info will always be inserted into a :CLOCK: drawer. +If necessary, the drawer will be created. +When nil, the drawer will not be created, but used when present. +When an integer and the number of clocking entries in an item +reaches or exceeds this number, a drawer will be created." + :group 'org-todo + :group 'org-progress + :type '(choice + (const :tag "Always" t) + (const :tag "Only when drawer exists" nil) + (integer :tag "When at least N clock entries"))) + (defcustom org-clock-out-when-done t "When t, the clock will be stopped when the relevant entry is marked DONE. Nil means, clock will keep running until stopped explicitly with @@ -1681,6 +1724,13 @@ :group 'org-priorities :type 'character) +(defcustom org-priority-start-cycle-with-default t + "Non-nil means, start with default priority when starting to cycle. +When this is nil, the first step in the cycle will be (depending on the +command used) one higher or lower that the default priority." + :group 'org-priorities + :type 'boolean) + (defgroup org-time nil "Options concerning time stamps and deadlines in Org-mode." :tag "Org Time" @@ -1694,15 +1744,6 @@ :group 'org-time :type 'boolean) -(defcustom org-insert-labeled-timestamps-before-properties-drawer t - "Non-nil means, always insert planning info before property drawer. -When this is nil and there is a property drawer *directly* after -the headline, move the planning info into the drawer. If the property -drawer separated from the headline by at least one line, this variable -has no effect." - :group 'org-time - :type 'boolean) - (defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>") "Formats for `format-time-string' which are used for time stamps. It is not recommended to change this constant.") @@ -1824,11 +1865,11 @@ "Non-nil means, fast tags selection interface will also offer TODO states. This is an undocumented feature, you should not rely on it.") -(defcustom org-tags-column 48 +(defcustom org-tags-column -80 "The column to which tags should be indented in a headline. If this number is positive, it specifies the column. If it is negative, it means that the tags should be flushright to that column. For example, --79 works well for a normal 80 character screen." +-80 works well for a normal 80 character screen." :group 'org-tags :type 'integer) @@ -1962,6 +2003,12 @@ :group 'org-agenda :type 'sexp) +(defcustom org-agenda-compact-blocks nil + "Non-nil means, make the block agenda more compact. +This is done by leaving out unnecessary lines." + :group 'org-agenda + :type nil) + (defgroup org-agenda-export nil "Options concerning exporting agenda views in Org-mode." :tag "Org Agenda Export" @@ -2192,7 +2239,7 @@ (defcustom org-agenda-skip-scheduled-if-done nil "Non-nil means don't show scheduled items in agenda when they are done. This is relevant for the daily/weekly agenda, not for the TODO list. And -it applied only to the actualy date of the scheduling. Warnings about +it applies only to the actual date of the scheduling. Warnings about an item with a past scheduling dates are always turned off when the item is DONE." :group 'org-agenda-skip @@ -2467,9 +2514,9 @@ :group 'org-agenda-sorting :type 'boolean) -(defgroup org-agenda-prefix nil +(defgroup org-agenda-line-format nil "Options concerning the entry prefix in the Org-mode agenda display." - :tag "Org Agenda Prefix" + :tag "Org Agenda Line Format" :group 'org-agenda) (defcustom org-agenda-prefix-format @@ -2532,7 +2579,7 @@ (cons (const timeline) (string :tag "Format")) (cons (const todo) (string :tag "Format")) (cons (const tags) (string :tag "Format")))) - :group 'org-agenda-prefix) + :group 'org-agenda-line-format) (defvar org-prefix-format-compiled nil "The compiled version of the most recently used prefix format. @@ -2549,7 +2596,7 @@ The option can be t or nil. It may also be the symbol `beg', indicating that the time should only be removed what it is located at the beginning of the headline/diary entry." - :group 'org-agenda-prefix + :group 'org-agenda-line-format :type '(choice (const :tag "Always" t) (const :tag "Never" nil) @@ -2560,7 +2607,7 @@ "Default duration for appointments that only have a starting time. When nil, no duration is specified in such cases. When non-nil, this must be the number of minutes, e.g. 60 for one hour." - :group 'org-agenda-prefix + :group 'org-agenda-line-format :type '(choice (integer :tag "Minutes") (const :tag "No default duration"))) @@ -2570,7 +2617,7 @@ "Non-nil means, remove the tags from the headline copy in the agenda. When this is the symbol `prefix', only remove tags when `org-agenda-prefix-format' contains a `%T' specifier." - :group 'org-agenda-prefix + :group 'org-agenda-line-format :type '(choice (const :tag "Always" t) (const :tag "Never" nil) @@ -2580,11 +2627,17 @@ (defvaralias 'org-agenda-remove-tags-when-in-prefix 'org-agenda-remove-tags)) -(defcustom org-agenda-align-tags-to-column 65 - "Shift tags in agenda items to this column." - :group 'org-agenda-prefix +(defcustom org-agenda-tags-column -80 + "Shift tags in agenda items to this column. +If this number is positive, it specifies the column. If it is negative, +it means that the tags should be flushright to that column. For example, +-80 works well for a normal 80 character screen." + :group 'org-agenda-line-format :type 'integer) +(if (fboundp 'defvaralias) + (defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column)) + (defgroup org-latex nil "Options for embedding LaTeX code into Org-mode" :tag "Org LaTeX" @@ -2610,7 +2663,7 @@ \"$$\" find math expressions surrounded by $$....$$ \"\\(\" find math expressions surrounded by \\(...\\) \"\\ [\" find math expressions surrounded by \\ [...\\]" - :group 'org-export-latex + :group 'org-latex :type 'plist) (defcustom org-format-latex-header "\\documentclass{article} @@ -2622,7 +2675,7 @@ \\usepackage[mathscr]{eucal} \\pagestyle{empty} % do not remove" "The document header used for processing LaTeX fragments." - :group 'org-export-latex + :group 'org-latex :type 'string) (defgroup org-export nil @@ -2980,6 +3033,11 @@ :group 'org-export-html :type 'coding-system) +(defcustom org-export-html-extension "html" + "The extension for exported HTML files." + :group 'org-export-html + :type 'string) + (defcustom org-export-html-style "<style type=\"text/css\"> html { @@ -3114,7 +3172,7 @@ (defcustom org-combined-agenda-icalendar-file "~/org.ics" "The file name for the iCalendar file covering all agenda files. This file is created with the command \\[org-export-icalendar-all-agenda-files]. -The file name should be absolute." +The file name should be absolute, the file will be overwritten without warning." :group 'org-export-icalendar :type 'file) @@ -3132,6 +3190,17 @@ :group 'org-export-icalendar :type 'boolean) +(defcustom org-icalendar-include-body 100 + "Amount of text below headline to be included in iCalendar export. +This is a number of characters that should maximally be included. +Properties, scheduling and clocking lines will always be removed. +The text will be inserted into the DESCRIPTION field." + :group 'org-export-icalendar + :type '(choice + (const :tag "Nothing" nil) + (const :tag "Everything" t) + (integer :tag "Max characters"))) + (defcustom org-icalendar-combined-name "OrgMode" "Calendar name for the combined iCalendar representing all agenda files." :group 'org-export-icalendar @@ -3281,8 +3350,6 @@ :tag "Org Faces" :group 'org-font-lock) -;; FIXME: convert that into a macro? Not critical, because this -;; is only executed a few times at load time. (defun org-compatible-face (inherits specs) "Make a compatible face specification. If INHERITS is an existing face and if the Emacs version supports it, @@ -4117,7 +4184,6 @@ (defvar org-org-menu) (defvar org-tbl-menu) (defvar org-agenda-keymap) -(defvar org-category-table) ;;;; Emacs/XEmacs compatibility @@ -4163,7 +4229,6 @@ (overlay-get ovl prop))) (defun org-overlays-at (pos) (if (featurep 'xemacs) (extents-at pos) (overlays-at pos))) -;; FIXME: this is currently not used (defun org-overlays-in (&optional start end) (if (featurep 'xemacs) (extent-list nil start end) @@ -4172,7 +4237,6 @@ (if (featurep 'xemacs) (extent-start-position o) (overlay-start o))) (defun org-overlay-end (o) (if (featurep 'xemacs) (extent-end-position o) (overlay-end o))) -;; FIXME: this is currently not used (defun org-find-overlays (prop &optional pos delete) "Find all overlays specifying PROP at POS or point. If DELETE is non-nil, delete all those overlays." @@ -4226,7 +4290,6 @@ (setq buffer-invisibility-spec (delete arg buffer-invisibility-spec))))) -;; FIXME: this is currently not used (defun org-in-invisibility-spec-p (arg) "Is ARG a member of `buffer-invisibility-spec'?" (if (consp buffer-invisibility-spec) @@ -4483,9 +4546,9 @@ This one does not require the space after the date.") (defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) \\([^]0-9>\r\n]*\\)\\(\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" "Regular expression matching time strings for analysis.") -(defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,11\\}>") +(defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,16\\}>") "Regular expression matching time stamps, with groups.") -(defconst org-ts-regexp3 (concat "[[<]" org-ts-regexp1 "[^]>\n]\\{0,11\\}[]>]") +(defconst org-ts-regexp3 (concat "[[<]" org-ts-regexp1 "[^]>\n]\\{0,16\\}[]>]") "Regular expression matching time stamps (also [..]), with groups.") (defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp) "Regular expression matching a time stamp range.") @@ -4570,6 +4633,9 @@ (insert string) (and move (backward-char 1)))) +(defconst org-nonsticky-props + '(mouse-face highlight keymap invisible intangible help-echo org-linked-text)) + (defun org-activate-plain-links (limit) "Run through the buffer and add overlays to links." (catch 'exit @@ -4581,7 +4647,7 @@ nil (add-text-properties (match-beginning 0) (match-end 0) (list 'mouse-face 'highlight - 'rear-nonsticky t + 'rear-nonsticky org-nonsticky-props 'keymap org-mouse-map )) (throw 'exit t)))))) @@ -4592,7 +4658,7 @@ (progn (add-text-properties (match-beginning 0) (match-end 0) (list 'mouse-face 'highlight - 'rear-nonsticky t + 'rear-nonsticky org-nonsticky-props 'keymap org-mouse-map )) t))) @@ -4618,10 +4684,10 @@ ;; but that requires another match, protecting match data, ;; a lot of overhead for font-lock. (ip (org-maybe-intangible - (list 'invisible 'org-link 'rear-nonsticky t + (list 'invisible 'org-link 'rear-nonsticky org-nonsticky-props 'keymap org-mouse-map 'mouse-face 'highlight 'help-echo help))) - (vp (list 'rear-nonsticky t + (vp (list 'rear-nonsticky org-nonsticky-props 'keymap org-mouse-map 'mouse-face 'highlight 'help-echo help))) ;; We need to remove the invisible property here. Table narrowing @@ -4644,7 +4710,7 @@ (progn (add-text-properties (match-beginning 0) (match-end 0) (list 'mouse-face 'highlight - 'rear-nonsticky t + 'rear-nonsticky org-nonsticky-props 'keymap org-mouse-map)) (when org-display-custom-times (if (match-end 3) @@ -4669,7 +4735,7 @@ (progn (add-text-properties (match-beginning 0) (match-end 0) (list 'mouse-face 'highlight - 'rear-nonsticky t + 'rear-nonsticky org-nonsticky-props 'keymap org-mouse-map 'help-echo "Radio target link" 'org-linked-text t)) @@ -4696,7 +4762,6 @@ (defun org-restart-font-lock () "Restart font-lock-mode, to force refontification." (when (and (boundp 'font-lock-mode) font-lock-mode) - ;; FIXME: Could font-lock-fontify-buffer be enough??? (font-lock-mode -1) (font-lock-mode 1))) @@ -4732,7 +4797,7 @@ (progn (add-text-properties (match-beginning 1) (match-end 1) (list 'mouse-face 'highlight - 'rear-nonsticky t + 'rear-nonsticky org-nonsticky-props 'keymap org-mouse-map)) t))) @@ -4855,7 +4920,6 @@ deactivate-mark buffer-file-name buffer-file-truename) (remove-text-properties beg end '(mouse-face t keymap t org-linked-text t - rear-nonsticky t invisible t intangible t)))) ;;;; Visibility cycling, including org-goto and indirect buffer @@ -5176,6 +5240,7 @@ (let ((cmds '(isearch-forward isearch-backward kill-ring-save set-mark-command mouse-drag-region universal-argument org-occur)) cmd) (while (setq cmd (pop cmds)) (substitute-key-definition cmd cmd map global-map))) + (suppress-keymap map) (org-defkey map "\C-m" 'org-goto-ret) (org-defkey map [(left)] 'org-goto-left) (org-defkey map [(right)] 'org-goto-right) @@ -5196,9 +5261,6 @@ (org-defkey map "\C-c\C-f" 'outline-forward-same-level) (org-defkey map "\C-c\C-b" 'outline-backward-same-level) (org-defkey map "\C-c\C-u" 'outline-up-heading) - ;; FIXME: Could we use suppress-keymap? - (let ((l '(1 2 3 4 5 6 7 8 9 0))) - (while l (org-defkey map (int-to-string (pop l)) 'digit-argument))) map)) (defconst org-goto-help @@ -5440,6 +5502,14 @@ (unless (= (point) pos) (just-one-space) (backward-delete-char 1)) (run-hooks 'org-insert-heading-hook))))) +(defun org-insert-heading-after-current () + "Insert a new heading with same level as current, after current subtree." + (interactive) + (org-back-to-heading) + (org-insert-heading) + (org-move-subtree-down) + (end-of-line 1)) + (defun org-insert-todo-heading (arg) "Insert a new heading with the same level and TODO state as current heading. If the heading has no TODO state, or if the state is DONE, use the first @@ -6380,7 +6450,7 @@ (org-at-item-p)) (if (match-beginning 3) (org-renumber-ordered-list 1) - (org-fix-bullet-type 1)))) + (org-fix-bullet-type)))) (defun org-maybe-renumber-ordered-list-safe () (condition-case nil @@ -6412,7 +6482,7 @@ ((string-match ")" current) "-") (t (error "This should not happen")))) (and (looking-at "\\([ \t]*\\)\\S-+") (replace-match (concat "\\1" new))) - (org-fix-bullet-type 1) + (org-fix-bullet-type) (org-maybe-renumber-ordered-list)))) (defun org-get-string-indentation (s) @@ -6463,9 +6533,9 @@ (goto-line line) (move-to-column col))) -(defun org-fix-bullet-type (arg) - "Make sure all items in this list have the same bullet." - (interactive "p") +(defun org-fix-bullet-type () + "Make sure all items in this list have the same bullet as the firsst item." + (interactive) (unless (org-at-item-p) (error "This is not a list")) (let ((line (org-current-line)) (col (current-column)) @@ -6558,15 +6628,18 @@ (delete-region (point-at-bol) (point)) (or (eolp) (indent-to-column (+ ind1 delta))) (beginning-of-line 2)))) + (org-fix-bullet-type) (org-maybe-renumber-ordered-list-safe) (save-excursion (beginning-of-line 0) (condition-case nil (org-beginning-of-item) (error nil)) (org-maybe-renumber-ordered-list-safe))) - (defun org-item-indent-positions () - "Assumes cursor in item line. FIXME" + "Return indentation for plain list items. +This returns a list with three values: The current indentation, the +parent indentation and the indentation a child should habe. +Assumes cursor in item line." (let* ((bolpos (point-at-bol)) (ind (org-get-indentation)) ind-down ind-up pos) @@ -6617,6 +6690,9 @@ (defvar orgstruct-mode-map (make-sparse-keymap) "Keymap for the minor `orgstruct-mode'.") +(defvar org-local-vars nil + "List of local variables, for use by `orgstruct-mode'") + ;;;###autoload (define-minor-mode orgstruct-mode "Toggle the minor more `orgstruct-mode'. @@ -6648,14 +6724,28 @@ "Unconditionally turn on `orgstruct-mode'." (orgstruct-mode 1)) +;;;###autoload +(defun turn-on-orgstruct++ () + "Unconditionally turn on `orgstruct-mode', and force org-mode indentations. +In addition to setting orgstruct-mode, this also exports all indentation and +autofilling variables from org-mode into the buffer. Note that turning +off orgstruct-mode will *not* remove these additonal settings." + (orgstruct-mode 1) + (let (var val) + (mapc + (lambda (x) + (when (string-match + "^\\(paragraph-\\|auto-fill\\|fill-paragraph\\|adaptive-fill\\|indent-\\)" + (symbol-name (car x))) + (setq var (car x) val (nth 1 x)) + (org-set-local var (if (eq (car-safe val) 'quote) (nth 1 val) val)))) + org-local-vars))) + (defun orgstruct-error () "Error when there is no default binding for a structure key." (interactive) (error "This key is has no function outside structure elements")) -(defvar org-local-vars nil - "List of local variables, for use by `orgstruct-mode'") - (defun orgstruct-setup () "Setup orgstruct keymaps." (let ((nfunc 0) @@ -6731,7 +6821,8 @@ '('orgstruct-error)))))))) (defun org-context-p (&rest contexts) - "FIXME:" + "Check if local context is and of CONTEXTS. +Possible values in the list of contexts are `table', `headline', and `item'." (let ((pos (point))) (goto-char (point-at-bol)) (prog1 (or (and (memq 'table contexts) @@ -6805,14 +6896,18 @@ (substring (cdr org-time-stamp-formats) 1 -1) (current-time))) afile heading buffer level newfile-p - category todo priority ltags itags) + category todo priority ltags itags prop) ;; Try to find a local archive location (save-excursion (save-restriction (widen) - (if (or (re-search-backward re nil t) (re-search-forward re nil t)) - (setq org-archive-location (match-string 1))))) + (setq prop (org-entry-get nil "ARCHIVE" 'inherit)) + (if (and prop (string-match "\\S-" prop)) + (setq org-archive-location prop) + (if (or (re-search-backward re nil t) + (re-search-forward re nil t)) + (setq org-archive-location (match-string 1)))))) (if (string-match "\\(.*\\)::\\(.*\\)" org-archive-location) (progn @@ -6833,8 +6928,8 @@ (save-excursion (org-back-to-heading t) ;; Get context information that will be lost by moving the tree - (setq org-category-table (org-get-category-table) - category (org-get-category) + (org-refresh-category-properties) + (setq category (org-get-category) todo (and (looking-at org-todo-line-regexp) (match-string 2)) priority (org-get-priority (if (match-end 3) (match-string 3) "")) @@ -6922,6 +7017,35 @@ (concat "under heading: " heading) (concat "in file: " (abbreviate-file-name afile))))))) +(defun org-refresh-category-properties () + "Refresh category text properties in teh buffer." + (let ((def-cat (cond + ((null org-category) + (if buffer-file-name + (file-name-sans-extension + (file-name-nondirectory buffer-file-name)) + "???")) + ((symbolp org-category) (symbol-name org-category)) + (t org-category))) + beg end cat pos optionp) + (org-unmodified + (save-excursion + (save-restriction + (widen) + (goto-char (point-min)) + (put-text-property (point) (point-max) 'org-category def-cat) + (while (re-search-forward + "^\\(#\\+CATEGORY:\\|[ \t]*:CATEGORY:\\)\\(.*\\)" nil t) + (setq pos (match-end 0) + optionp (equal (char-after (match-beginning 0)) ?#) + cat (org-trim (match-string 2))) + (if optionp + (setq beg (point-at-bol) end (point-max)) + (org-back-to-heading t) + (setq beg (point) end (org-end-of-subtree t t))) + (put-text-property beg end 'org-category cat) + (goto-char pos))))))) + (defun org-archive-all-done (&optional tag) "Archive sublevels of the current tree without open TODO items. If the cursor is not on a headline, try all level 1 trees. If @@ -7161,7 +7285,9 @@ (defun org-table-create-or-convert-from-region (arg) "Convert region to table, or create an empty table. If there is an active region, convert it to a table, using the function -`org-table-convert-region'. +`org-table-convert-region'. See the documentation of that function +to learn how the prefix argument is interpreted to determine the field +separator. If there is no such region, create an empty table with `org-table-create'." (interactive "P") (if (org-region-active-p) @@ -7200,36 +7326,46 @@ (goto-char pos))) (org-table-align))) -(defun org-table-convert-region (beg0 end0 &optional nspace) +(defun org-table-convert-region (beg0 end0 &optional separator) "Convert region to a table. The region goes from BEG0 to END0, but these borders will be moved slightly, to make sure a beginning of line in the first line is included. -When NSPACE is non-nil, it indicates the minimum number of spaces that -separate columns. By default, the function first checks if every line -contains at lease one TAB. If yes, it assumes that the material is TAB -separated. If not, it assumes a single space as separator." + +SEPARATOR specifies the field separator in the lines. It can have the +following values: + +'(4) Use the comma as a field separator +'(16) Use a TAB as field separator +integer When a number, use that many spaces as field separator +nil When nil, the command tries to be smart and figure out the + separator in the following way: + - when each line contains a TAB, assume TAB-separated material + - when each line contains a comme, assume CSV material + - else, assume one or more SPACE charcters as separator." (interactive "rP") (let* ((beg (min beg0 end0)) (end (max beg0 end0)) - (tabsep t) - re) + sep-re re) (goto-char beg) (beginning-of-line 1) (setq beg (move-marker (make-marker) (point))) (goto-char end) (if (bolp) (backward-char 1) (end-of-line 1)) (setq end (move-marker (make-marker) (point))) - ;; Lets see if this is tab-separated material. If every nonempty line - ;; contains a tab, we will assume that it is tab-separated material - (if nspace - (setq tabsep nil) + ;; Get the right field separator + (unless separator (goto-char beg) - (and (re-search-forward "^[^\n\t]+$" end t) (setq tabsep nil))) - (if nspace (setq tabsep nil)) - (if tabsep - (setq re "^\\|\t") - (setq re (format "^ *\\| *\t *\\| \\{%d,\\}" - (max 1 (prefix-numeric-value nspace))))) + (setq separator + (cond + ((not (re-search-forward "^[^\n\t]+$" end t)) '(16)) + ((not (re-search-forward "^[^\n,]+$" end t)) '(4)) + (t 1)))) + (setq re (cond + ((equal separator '(4)) "^\\|\"?[ \t]*,[ \t]*\"?") + ((equal separator '(16)) "^\\|\t") + ((integerp separator) + (format "^ *\\| *\t *\\| \\{%d,\\}" separator)) + (t (error "This should not happen")))) (goto-char beg) (while (re-search-forward re end t) (replace-match "| " t t)) @@ -8401,8 +8537,8 @@ (defun org-trim (s) "Remove whitespace at beginning and end of string." - (if (string-match "^[ \t\n\r]+" s) (setq s (replace-match "" t t s))) - (if (string-match "[ \t\n\r]+$" s) (setq s (replace-match "" t t s))) + (if (string-match "\\`[ \t\n\r]+" s) (setq s (replace-match "" t t s))) + (if (string-match "[ \t\n\r]+\\'" s) (setq s (replace-match "" t t s))) s) (defun org-wrap (string &optional width lines) @@ -9295,8 +9431,6 @@ (goto-line (nth 1 a)) (org-table-goto-column (nth 2 a)) (push (append a (list (cdr eq))) eqlname1) -;; FIXME (org-table-eval-formula nil (cdr eq) 'noalign 'nocst -;; FIXME 'nostore 'noanalysis) (org-table-put-field-property :org-untouchable t))) ;; Now evauluate the column formulas, but skip fields covered by @@ -9522,7 +9656,7 @@ ((and (> (match-beginning 0) 0) (equal ?. (aref s (max (1- (match-beginning 0)) 0))) (not (equal ?. (aref s (max (- (match-beginning 0) 2) 0))))) - ;; 3.e5 or something like this. FIXME: is this ok???? + ;; 3.e5 or something like this. (setq start (match-end 0))) (t (setq start (match-beginning 0) @@ -11143,29 +11277,37 @@ ("=" . "%3D") ("+" . "%2B") ) - "Association list of escapes for some characters problematic in links.") - -(defun org-link-escape (text) + "Association list of escapes for some characters problematic in links. +This is the list that is used for internal purposes.") + +(defconst org-link-escape-chars-browser + '((" " . "%20")) + "Association list of escapes for some characters problematic in links. +This is the list that is used before handing over to the browser.") + +(defun org-link-escape (text &optional table) "Escape charaters in TEXT that are problematic for links." + (setq table (or table org-link-escape-chars)) (when text (let ((re (mapconcat (lambda (x) (regexp-quote (car x))) - org-link-escape-chars "\\|"))) + table "\\|"))) (while (string-match re text) (setq text (replace-match - (cdr (assoc (match-string 0 text) org-link-escape-chars)) + (cdr (assoc (match-string 0 text) table)) t t text))) text))) -(defun org-link-unescape (text) +(defun org-link-unescape (text &optional table) "Reverse the action of `org-link-escape'." + (setq table (or table org-link-escape-chars)) (when text (let ((re (mapconcat (lambda (x) (regexp-quote (cdr x))) - org-link-escape-chars "\\|"))) + table "\\|"))) (while (string-match re text) (setq text (replace-match - (car (rassoc (match-string 0 text) org-link-escape-chars)) + (car (rassoc (match-string 0 text) table)) t t text))) text))) @@ -11240,12 +11382,13 @@ With three \\[universal-argument] prefixes, negate the meaning of `org-keep-stored-link-after-insertion'." (interactive "P") - (let ((wcf (current-window-configuration)) - (region (if (org-region-active-p) - (prog1 (buffer-substring (region-beginning) (region-end)) - (delete-region (region-beginning) (region-end))))) - tmphist ; byte-compile incorrectly complains about this - link desc entry remove file) + (let* ((wcf (current-window-configuration)) + (region (if (org-region-active-p) + (buffer-substring (region-beginning) (region-end)))) + (remove (and region (list (region-beginning) (region-end)))) + (desc region) + tmphist ; byte-compile incorrectly complains about this + link entry file) (cond ((org-in-regexp org-bracket-link-regexp 1) ;; We do have a link at point, and we are going to edit it. @@ -11283,7 +11426,7 @@ (with-output-to-temp-buffer "*Org Links*" (princ "Insert a link. Use TAB to complete valid link prefixes.\n") (when org-stored-links - (princ "\nStored links are available with <up>/<down> (most recent with RET):\n\n") + (princ "\nStored links are available with <up>/<down> or M-p/n (most recent with RET):\n\n") (princ (mapconcat (lambda (x) (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x))) @@ -11315,7 +11458,7 @@ (not org-keep-stored-link-after-insertion)) (setq org-stored-links (delq (assoc link org-stored-links) org-stored-links))) - (setq desc (or region desc (nth 1 entry))))) + (setq desc (or desc (nth 1 entry))))) (if (string-match org-plain-link-re link) ;; URL-like link, normalize the use of angular brackets. @@ -11336,6 +11479,7 @@ ;; Check if we can/should use a relative path. If yes, simplify the link (when (string-match "\\<file:\\(.*\\)" link) (let* ((path (match-string 1 link)) + (origpath path) (desc-is-link (equal link desc)) (case-fold-search nil)) (cond @@ -11355,7 +11499,8 @@ (setq path (substring (expand-file-name path) (match-end 0))))))) (setq link (concat "file:" path)) - (if desc (setq desc link)))) + (if (equal desc origpath) + (setq desc path)))) (setq desc (read-string "Description: " desc)) (unless (string-match "\\S-" desc) (setq desc nil)) @@ -11519,7 +11664,8 @@ (apply cmd (nreverse args1)))) ((member type '("http" "https" "ftp" "news")) - (browse-url (concat type ":" path))) + (browse-url (concat type ":" (org-link-escape + path org-link-escape-chars-browser)))) ((string= type "tags") (org-tags-view in-emacs path)) @@ -11601,7 +11747,7 @@ ((string= type "shell") (let ((cmd path)) - ;; FIXME: the following is only for backward compatibility + ;; The following is only for backward compatibility (while (string-match "@{" cmd) (setq cmd (replace-match "<" t t cmd))) (while (string-match "@}" cmd) (setq cmd (replace-match ">" t t cmd))) (if (or (not org-confirm-shell-link-function) @@ -12219,7 +12365,7 @@ (setq cmd (replace-match "%s" t t cmd))) (setq cmd (format cmd (shell-quote-argument file))) (save-window-excursion - (shell-command (concat cmd " &")))) + (start-process-shell-command cmd nil cmd))) ((or (stringp cmd) (eq cmd 'emacs)) (funcall (cdr (assq 'file org-link-frame-setup)) file) @@ -12278,6 +12424,7 @@ <left>/<right> -> before/after current headline, same headings level") (defvar org-remember-previous-location nil) +(defvar org-force-remember-template-char) ;; dynamically scoped ;;;###autoload (defun org-remember-apply-template (&optional use-char skip-interactive) @@ -12287,13 +12434,20 @@ (if org-remember-templates (let* ((char (or use-char - (if (= (length org-remember-templates) 1) - (caar org-remember-templates) + (cond + ((= (length org-remember-templates) 1) + (caar org-remember-templates)) + ((and (boundp 'org-force-remember-template-char) + org-force-remember-template-char) + (if (string-p org-force-remember-template-char) + (string-to-char org-force-remember-template-char) + org-force-remember-template-char)) + (t (message "Select template: %s" (mapconcat (lambda (x) (char-to-string (car x))) org-remember-templates " ")) - (read-char-exclusive)))) + (read-char-exclusive))))) (entry (cdr (assoc char org-remember-templates))) (tpl (car entry)) (plist-p (if org-store-link-plist t nil)) @@ -12402,7 +12556,7 @@ (org-set-local 'org-finish-function 'remember-buffer))) ;;;###autoload -(defun org-remember () +(defun org-remember (&optional org-force-remember-template-char) "Call `remember'. If this is already a remember buffer, re-apply template. If there is an active region, make sure remember uses it as initial content of the remember buffer." @@ -12459,6 +12613,8 @@ (goto-char (point-min)) (while (looking-at "^[ \t]*\n\\|^##.*\n") (replace-match "")) + (goto-char (point-max)) + (unless (equal (char-before) ?\n) (insert "\n")) (catch 'quit (let* ((txt (buffer-substring (point-min) (point-max))) (fastp (org-xor (equal current-prefix-arg '(4)) @@ -12501,7 +12657,7 @@ (widen) (and (goto-char (point-min)) (not (re-search-forward "^\\* " nil t)) - (insert "\n* Notes\n")) + (insert "\n* " (or heading "Notes") "\n")) (setq reversed (org-notes-order-reversed-p)) ;; Find the default location @@ -12511,7 +12667,12 @@ (concat "^\\*+[ \t]+" (regexp-quote heading) (org-re "\\([ \t]+:[[:alnum:]@_:]*\\)?[ \t]*$")) nil t) - (setq org-goto-start-pos (match-beginning 0)))) + (setq org-goto-start-pos (match-beginning 0)) + (when fastp + (goto-char (point-max)) + (unless (bolp) (newline)) + (insert "* " heading "\n") + (setq org-goto-start-pos (point-at-bol 0))))) ;; Ask the User for a location (if fastp @@ -12639,7 +12800,7 @@ (unless (looking-at org-dblock-start-re) (error "Not at a dynamic block")) (let* ((begdel (1+ (match-end 0))) - (name (match-string 1)) + (name (org-no-properties (match-string 1))) (params (append (list :name name) (read (concat "(" (match-string 3) ")"))))) (unless (re-search-forward org-dblock-end-re nil t) @@ -12680,12 +12841,16 @@ "Update the dynamic block at point This means to empty the block, parse for parameters and then call the correct writing function." - (let* ((pos (point)) - (params (org-prepare-dblock)) - (name (plist-get params :name)) - (cmd (intern (concat "org-dblock-write:" name)))) - (funcall cmd params) - (goto-char pos))) + (save-window-excursion + (let* ((pos (point)) + (line (org-current-line)) + (params (org-prepare-dblock)) + (name (plist-get params :name)) + (cmd (intern (concat "org-dblock-write:" name)))) + (message "Updating dynamic block `%s' at line %d..." name line) + (funcall cmd params) + (message "Updating dynamic block `%s' at line %d...done" name line) + (goto-char pos)))) (defun org-beginning-of-dblock () "Find the beginning of the dynamic block at point. @@ -12710,6 +12875,10 @@ ;;;; Completion +(defconst org-additional-option-like-keywords + '("BEGIN_HTML" "BEGIN_LaTeX" "END_HTML" "END_LaTeX" + "ORGTBL" "HTML:" "LaTeX:")) + (defun org-complete (&optional arg) "Perform completion on word at point. At the beginning of a headline, this completes TODO keywords as given in @@ -12719,99 +12888,108 @@ If the current word is preceded by \"#+\", completes special words for setting file options. In the line after \"#+STARTUP:, complete valid keywords.\" -At all other locations, this simply calls `ispell-complete-word'." - (interactive "P") - (catch 'exit - (let* ((end (point)) - (beg1 (save-excursion - (skip-chars-backward (org-re "[:alnum:]_@")) +At all other locations, this simply calls the value of +`org-completion-fallback-command'." + (interactive "P") + (org-without-partial-completion + (catch 'exit + (let* ((end (point)) + (beg1 (save-excursion + (skip-chars-backward (org-re "[:alnum:]_@")) + (point))) + (beg (save-excursion + (skip-chars-backward "a-zA-Z0-9_:$") (point))) - (beg (save-excursion - (skip-chars-backward "a-zA-Z0-9_:$") - (point))) - (confirm (lambda (x) (stringp (car x)))) - (searchhead (equal (char-before beg) ?*)) - (tag (and (equal (char-before beg1) ?:) - (equal (char-after (point-at-bol)) ?*))) - (prop (and (equal (char-before beg1) ?:) - (not (equal (char-after (point-at-bol)) ?*)))) - (texp (equal (char-before beg) ?\\)) - (link (equal (char-before beg) ?\[)) - (opt (equal (buffer-substring (max (point-at-bol) (- beg 2)) - beg) - "#+")) - (startup (string-match "^#\\+STARTUP:.*" - (buffer-substring (point-at-bol) (point)))) - (completion-ignore-case opt) - (type nil) - (tbl nil) - (table (cond - (opt - (setq type :opt) - (mapcar (lambda (x) - (string-match "^#\\+\\(\\([A-Z_]+:?\\).*\\)" x) - (cons (match-string 2 x) (match-string 1 x))) - (org-split-string (org-get-current-options) "\n"))) - (startup - (setq type :startup) - org-startup-options) - (link (append org-link-abbrev-alist-local - org-link-abbrev-alist)) - (texp - (setq type :tex) - org-html-entities) - ((string-match "\\`\\*+[ \t]+\\'" - (buffer-substring (point-at-bol) beg)) - (setq type :todo) - (mapcar 'list org-todo-keywords-1)) - (searchhead - (setq type :searchhead) - (save-excursion - (goto-char (point-min)) - (while (re-search-forward org-todo-line-regexp nil t) - (push (list - (org-make-org-heading-search-string - (match-string 3) t)) - tbl))) - tbl) - (tag (setq type :tag beg beg1) - (or org-tag-alist (org-get-buffer-tags))) - (prop (setq type :prop beg beg1) - (mapcar 'list (org-buffer-property-keys))) - (t (progn (ispell-complete-word arg) (throw 'exit nil))))) - (pattern (buffer-substring-no-properties beg end)) - (completion (try-completion pattern table confirm))) - (cond ((eq completion t) - (if (equal type :opt) - (insert (substring (cdr (assoc (upcase pattern) table)) - (length pattern))) - (if (memq type '(:tag :prop)) (insert ":")))) - ((null completion) - (message "Can't find completion for \"%s\"" pattern) - (ding)) - ((not (string= pattern completion)) - (delete-region beg end) - (if (string-match " +$" completion) - (setq completion (replace-match "" t t completion))) - (insert completion) - (if (get-buffer-window "*Completions*") - (delete-window (get-buffer-window "*Completions*"))) - (if (assoc completion table) - (if (eq type :todo) (insert " ") - (if (memq type '(:tag :prop)) (insert ":")))) - (if (and (equal type :opt) (assoc completion table)) - (message "%s" (substitute-command-keys - "Press \\[org-complete] again to insert example settings")))) - (t - (message "Making completion list...") - (let ((list (sort (all-completions pattern table confirm) - 'string<))) - (with-output-to-temp-buffer "*Completions*" - (condition-case nil - ;; Protection needed for XEmacs and emacs 21 - (display-completion-list list pattern) - (error (display-completion-list list))))) - (message "Making completion list...%s" "done")))))) + (confirm (lambda (x) (stringp (car x)))) + (searchhead (equal (char-before beg) ?*)) + (tag (and (equal (char-before beg1) ?:) + (equal (char-after (point-at-bol)) ?*))) + (prop (and (equal (char-before beg1) ?:) + (not (equal (char-after (point-at-bol)) ?*)))) + (texp (equal (char-before beg) ?\\)) + (link (equal (char-before beg) ?\[)) + (opt (equal (buffer-substring (max (point-at-bol) (- beg 2)) + beg) + "#+")) + (startup (string-match "^#\\+STARTUP:.*" + (buffer-substring (point-at-bol) (point)))) + (completion-ignore-case opt) + (type nil) + (tbl nil) + (table (cond + (opt + (setq type :opt) + (append + (mapcar + (lambda (x) + (string-match "^#\\+\\(\\([A-Z_]+:?\\).*\\)" x) + (cons (match-string 2 x) (match-string 1 x))) + (org-split-string (org-get-current-options) "\n")) + (mapcar 'list org-additional-option-like-keywords))) + (startup + (setq type :startup) + org-startup-options) + (link (append org-link-abbrev-alist-local + org-link-abbrev-alist)) + (texp + (setq type :tex) + org-html-entities) + ((string-match "\\`\\*+[ \t]+\\'" + (buffer-substring (point-at-bol) beg)) + (setq type :todo) + (mapcar 'list org-todo-keywords-1)) + (searchhead + (setq type :searchhead) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward org-todo-line-regexp nil t) + (push (list + (org-make-org-heading-search-string + (match-string 3) t)) + tbl))) + tbl) + (tag (setq type :tag beg beg1) + (or org-tag-alist (org-get-buffer-tags))) + (prop (setq type :prop beg beg1) + (mapcar 'list (org-buffer-property-keys))) + (t (progn + (call-interactively org-completion-fallback-command) + (throw 'exit nil))))) + (pattern (buffer-substring-no-properties beg end)) + (completion (try-completion pattern table confirm))) + (cond ((eq completion t) + (if (not (assoc (upcase pattern) table)) + (message "Already complete") + (if (equal type :opt) + (insert (substring (cdr (assoc (upcase pattern) table)) + (length pattern))) + (if (memq type '(:tag :prop)) (insert ":"))))) + ((null completion) + (message "Can't find completion for \"%s\"" pattern) + (ding)) + ((not (string= pattern completion)) + (delete-region beg end) + (if (string-match " +$" completion) + (setq completion (replace-match "" t t completion))) + (insert completion) + (if (get-buffer-window "*Completions*") + (delete-window (get-buffer-window "*Completions*"))) + (if (assoc completion table) + (if (eq type :todo) (insert " ") + (if (memq type '(:tag :prop)) (insert ":")))) + (if (and (equal type :opt) (assoc completion table)) + (message "%s" (substitute-command-keys + "Press \\[org-complete] again to insert example settings")))) + (t + (message "Making completion list...") + (let ((list (sort (all-completions pattern table confirm) + 'string<))) + (with-output-to-temp-buffer "*Completions*" + (condition-case nil + ;; Protection needed for XEmacs and emacs 21 + (display-completion-list list pattern) + (error (display-completion-list list))))) + (message "Making completion list...%s" "done"))))))) ;;;; TODO, DEADLINE, Comments @@ -12835,6 +13013,15 @@ (defvar org-setting-tags nil) ; dynamically skiped +;; FIXME: better place +(defun org-property-or-variable-value (var &optional inherit) + "Check if there is a property fixing the value of VAR. +If yes, return this value. If not, return the current value of the variable." + (let ((prop (org-entry-get nil (symbol-name var) inherit))) + (if (and prop (stringp prop) (string-match "\\S-" prop)) + (read prop) + (symbol-value var)))) + (defun org-todo (&optional arg) "Change the TODO state of an item. The state of an item is given by a keyword at the start of the heading, @@ -12865,7 +13052,11 @@ (if (looking-at outline-regexp) (goto-char (1- (match-end 0)))) (or (looking-at (concat " +" org-todo-regexp " *")) (looking-at " *")) - (let* ((this (match-string 1)) + (let* ((logging (save-match-data (org-entry-get nil "LOGGING" t))) + (org-log-done (org-parse-local-options logging 'org-log-done)) + (org-log-repeat (org-parse-local-options logging 'org-log-repeat)) + (this (match-string 1)) + (hl-pos (match-beginning 0)) (head (org-get-todo-sequence-head this)) (ass (assoc head org-todo-kwd-alist)) (interpret (nth 1 ass)) @@ -12882,7 +13073,9 @@ (not (eq org-use-fast-todo-selection 'prefix))))) ;; Use fast selection (org-fast-todo-selection)) - ((and (equal arg '(4)) (eq org-use-fast-todo-selection nil)) + ((and (equal arg '(4)) + (or (not org-use-fast-todo-selection) + (not org-todo-key-trigger))) ;; Read a state with completion (completing-read "State: " (mapcar (lambda(x) (list x)) org-todo-keywords-1) @@ -12931,6 +13124,8 @@ (next (if state (concat " " state " ") " ")) dostates) (replace-match next t t) + (unless (pos-visible-in-window-p hl-pos) + (message "TODO state changed to %s" (org-trim next))) (unless head (setq head (org-get-todo-sequence-head state) ass (assoc head org-todo-kwd-alist) @@ -12963,9 +13158,6 @@ ((and (member state org-done-keywords) (not (member this org-done-keywords))) ;; It is now done, and it was not done before - ;; FIXME: We used to remove scheduling info.... -; (org-add-planning-info 'closed (org-current-time) -; (if (org-get-repeat) nil 'scheduled)) (org-add-planning-info 'closed (org-current-time)) (org-add-log-maybe 'done state 'findpos)))) ;; Fixup tag positioning @@ -13058,7 +13250,7 @@ ((or (= c ?\C-g) (and (= c ?q) (not (rassoc c fulltable)))) (setq quit-flag t)) - ((= c ?\ ) 'none) + ((= c ?\ ) nil) ((setq e (rassoc c fulltable) tg (car e)) tg) (t (setq quit-flag t)))))) @@ -13139,19 +13331,25 @@ (message "%d TODO entries found" (org-occur (concat "^" outline-regexp " *" kwd-re ))))) -(defun org-deadline () - "Insert the DEADLINE: string to make a deadline. -A timestamp is also inserted - use \\[org-timestamp-up] and \\[org-timestamp-down] -to modify it to the correct date." - (interactive) - (org-add-planning-info 'deadline nil 'closed)) - -(defun org-schedule () - "Insert the SCHEDULED: string to schedule a TODO item. -A timestamp is also inserted - use \\[org-timestamp-up] and \\[org-timestamp-down] -to modify it to the correct date." - (interactive) - (org-add-planning-info 'scheduled nil 'closed)) +(defun org-deadline (&optional remove) + "Insert the \"DEADLINE:\" string with a timestamp to make a deadline. +With argument REMOVE, remove any deadline from the item." + (interactive "P") + (if remove + (progn + (org-add-planning-info nil nil 'deadline) + (message "Item no longer has a deadline.")) + (org-add-planning-info 'deadline nil 'closed))) + +(defun org-schedule (&optional remove) + "Insert the SCHEDULED: string with a timestamp to schedule a TODO item. +With argument REMOVE, remove any scheduling date from the item." + (interactive "P") + (if remove + (progn + (org-add-planning-info nil nil 'scheduled) + (message "Item is no longer scheduled.")) + (org-add-planning-info 'scheduled nil 'closed))) (defun org-add-planning-info (what &optional time &rest remove) "Insert new timestamp with keyword in the line directly after the headline. @@ -13179,11 +13377,6 @@ (goto-char (match-end 0)) (if (eobp) (insert "\n")) (forward-char 1) - (when (and (not org-insert-labeled-timestamps-before-properties-drawer) - (looking-at "[ \t]*:PROPERTIES:[ \t]*$")) - (goto-char (match-end 0)) - (if (eobp) (insert "\n")) - (forward-char 1)) (if (and (not (looking-at outline-regexp)) (looking-at (concat "[^\r\n]*?" org-keyword-time-regexp "[^\r\n]*")) @@ -13215,12 +13408,12 @@ ((eq what 'deadline) org-deadline-string) ((eq what 'closed) org-closed-string)) " ") - (org-insert-time-stamp - time - (or org-time-was-given - (and (eq what 'closed) org-log-done-with-time)) - (eq what 'closed) - nil nil (list org-end-time-was-given)) + (setq ts (org-insert-time-stamp + time + (or org-time-was-given + (and (eq what 'closed) org-log-done-with-time)) + (eq what 'closed) + nil nil (list org-end-time-was-given))) (end-of-line 1)) (goto-char (point-min)) (widen) @@ -13477,9 +13670,15 @@ (error "Priority must be between `%c' and `%c'" org-highest-priority org-lowest-priority)))) ((eq action 'up) - (setq new (1- current))) + (if (and (not have) (eq last-command this-command)) + (setq new org-lowest-priority) + (setq new (if (and org-priority-start-cycle-with-default (not have)) + org-default-priority (1- current))))) ((eq action 'down) - (setq new (1+ current))) + (if (and (not have) (eq last-command this-command)) + (setq new org-highest-priority) + (setq new (if (and org-priority-start-cycle-with-default (not have)) + org-default-priority (1+ current))))) (t (error "Invalid action"))) (if (or (< (upcase new) org-highest-priority) (> (upcase new) org-lowest-priority)) @@ -13792,8 +13991,9 @@ (if org-fast-tag-selection-include-todo org-todo-key-alist)) (let ((org-add-colon-after-tag-completion t)) (org-trim - (completing-read "Tags: " 'org-tags-completion-function - nil nil current 'org-tags-history)))))) + (org-without-partial-completion + (completing-read "Tags: " 'org-tags-completion-function + nil nil current 'org-tags-history))))))) (while (string-match "[-+&]+" tags) ;; No boolean logic, just a list (setq tags (replace-match ":" t t tags)))) @@ -14069,9 +14269,9 @@ (setq current (delete tg current)) (loop for g in groups do (if (member tg g) - (mapcar (lambda (x) - (setq current (delete x current))) - g))) + (mapc (lambda (x) + (setq current (delete x current))) + g))) (push tg current)) (if exit-after-next (setq exit-after-next 'now)))) @@ -14134,8 +14334,7 @@ ;;; Setting and retrieving properties (defconst org-special-properties - '("TODO" "TAGS" "ALLTAGS" "DEADLINE" "SCHEDULED" - "CLOCK" "PRIORITY") + '("TODO" "TAGS" "ALLTAGS" "DEADLINE" "SCHEDULED" "CLOCK" "PRIORITY") "The special properties valid in Org-mode. These are properties that are not defined in the property drawer, @@ -14364,23 +14563,28 @@ (error "The %s property can not yet be set with `org-entry-put'" property)) (t ; a non-special property - (setq range (org-get-property-block beg end 'force)) - (goto-char (car range)) - (if (re-search-forward - (concat "^[ \t]*:" property ":\\(.*\\)") (cdr range) t) - (progn - (delete-region (match-beginning 1) (match-end 1)) - (goto-char (match-beginning 1))) - (goto-char (cdr range)) - (insert "\n") - (backward-char 1) - (org-indent-line-function) - (insert ":" property ":")) - (and value (insert " " value)) - (org-indent-line-function)))))) - -(defun org-buffer-property-keys (&optional include-specials) - "Get all property keys in the current buffer." + (let ((buffer-invisibility-spec (org-inhibit-invisibility))) ; Emacs 21 + (setq range (org-get-property-block beg end 'force)) + (goto-char (car range)) + (if (re-search-forward + (concat "^[ \t]*:" property ":\\(.*\\)") (cdr range) t) + (progn + (delete-region (match-beginning 1) (match-end 1)) + (goto-char (match-beginning 1))) + (goto-char (cdr range)) + (insert "\n") + (backward-char 1) + (org-indent-line-function) + (insert ":" property ":")) + (and value (insert " " value)) + (org-indent-line-function))))))) + +(defun org-buffer-property-keys (&optional include-specials include-defaults) + "Get all property keys in the current buffer. +With INCLUDE-SPECIALS, also list the special properties that relect things +like tags and TODO state. +With INCLUDE-DEFAULTS, also include properties that has special meaning +internally: ARCHIVE, CATEGORY, SUMMARY, DESCRIPTION, LOCATION, and LOGGING." (let (rtn range) (save-excursion (save-restriction @@ -14396,6 +14600,9 @@ (outline-next-heading)))) (when include-specials (setq rtn (append org-special-properties rtn))) + (when include-defaults + (add-to-list rtn "CATEGORY") + (add-to-list rtn "ARCHIVE")) (sort rtn (lambda (a b) (string< (upcase a) (upcase b)))))) (defun org-insert-property-drawer () @@ -14477,7 +14684,9 @@ (defvar org-columns-current-fmt-compiled) ; defined below (defun org-compute-property-at-point () - "FIXME:" + "Compute the property at point. +This looks for an enclosing column format, extracts the operator and +then applies it to the proerty in the column format's scope." (interactive) (unless (org-at-property-p) (error "Not at a property")) @@ -14745,16 +14954,24 @@ (org-unmodified (org-columns-remove-overlays) (let ((inhibit-read-only t)) - ;; FIXME: is this safe??? - ;; or are there other reasons why there may be a read-only property???? (remove-text-properties (point-min) (point-max) '(read-only t)))) (when (eq major-mode 'org-agenda-mode) - (message "Modification not yet reflected in Agenda buffer, use `r' to refresh"))) + (message + "Modification not yet reflected in Agenda buffer, use `r' to refresh"))) + +(defun org-columns-check-computed () + "Check if this column value is computed. +If yes, throw an error indicating that changing it does not make sense." + (let ((val (get-char-property (point) 'org-columns-value))) + (when (and (stringp val) + (get-char-property 0 'org-computed val)) + (error "This value is computed from the entry's children")))) (defun org-columns-edit-value () "Edit the value of the property at point in column view. Where possible, use the standard interface for changing this line." (interactive) + (org-columns-check-computed) (let* ((col (current-column)) (key (get-char-property (point) 'org-columns-key)) (value (get-char-property (point) 'org-columns-value)) @@ -14847,6 +15064,7 @@ (defun org-columns-next-allowed-value (&optional previous) "Switch to the next allowed value for this column." (interactive) + (org-columns-check-computed) (let* ((col (current-column)) (key (get-char-property (point) 'org-columns-key)) (value (get-char-property (point) 'org-columns-value)) @@ -15130,8 +15348,10 @@ (setq pos (org-overlay-start ov)) (goto-char pos) (when (setq val (cdr (assoc property - (get-text-property (point-at-bol) 'org-summaries)))) + (get-text-property + (point-at-bol) 'org-summaries)))) (setq fmt (org-overlay-get ov 'org-columns-format)) + (org-overlay-put ov 'org-columns-value val) (org-overlay-put ov 'display (format fmt val))))) org-columns-overlays)))) @@ -15141,11 +15361,12 @@ (let* ((re (concat "^" outline-regexp)) (lmax 30) ; Does anyone use deeper levels??? (lsum (make-vector lmax 0)) + (lflag (make-vector lmax nil)) (level 0) (ass (assoc property org-columns-current-fmt-compiled)) (format (nth 4 ass)) (beg org-columns-top-level-marker) - last-level val end sumpos sum-alist sum str) + last-level val valflag flag end sumpos sum-alist sum str str1 useval) (save-excursion ;; Find the region to compute (goto-char beg) @@ -15156,29 +15377,41 @@ (setq sumpos (match-beginning 0) last-level level level (org-outline-level) - val (org-entry-get nil property)) + val (org-entry-get nil property) + valflag (and val (string-match "\\S-" val))) (cond ((< level last-level) ;; put the sum of lower levels here as a property - (setq sum (aref lsum last-level) + (setq sum (aref lsum last-level) ; current sum + flag (aref lflag last-level) ; any valid entries from children? str (org-column-number-to-string sum format) + str1 (org-add-props (copy-sequence str) nil 'org-computed t 'face 'bold) + useval (if flag str1 (if valflag val "")) sum-alist (get-text-property sumpos 'org-summaries)) (if (assoc property sum-alist) - (setcdr (assoc property sum-alist) str) - (push (cons property str) sum-alist) + (setcdr (assoc property sum-alist) useval) + (push (cons property useval) sum-alist) (org-unmodified (add-text-properties sumpos (1+ sumpos) (list 'org-summaries sum-alist)))) - (when val ;?????????????????????????????????? and force????? - (org-entry-put nil property str)) + (when val + (org-entry-put nil property (if flag str val))) ;; add current to current level accumulator - (aset lsum level (+ (aref lsum level) sum)) + (when (or flag valflag) + ;; FIXME: is this ok????????? + (aset lsum level (+ (aref lsum level) + (if flag sum (org-column-string-to-number + (if flag str val) format)))) + (aset lflag level t)) ;; clear accumulators for deeper levels - (loop for l from (1+ level) to (1- lmax) do (aset lsum l 0))) + (loop for l from (1+ level) to (1- lmax) do + (aset lsum l 0) + (aset lflag l nil))) ((>= level last-level) ;; add what we have here to the accumulator for this level (aset lsum level (+ (aref lsum level) - (org-column-string-to-number (or val "0") format)))) + (org-column-string-to-number (or val "0") format))) + (and valflag (aset lflag level t))) (t (error "This should not happen"))))))) (defun org-columns-redo () @@ -15254,7 +15487,14 @@ (org-trim rtn))) (defun org-columns-compile-format (fmt) - "FIXME" + "Turn a column format string into an alist of specifications. +The alist has one entry for each column in the format. The elements of +that list are: +property the property +title the title field for the columns +width the column width in characters, can be nil for automatic +operator the operator if any +format the output format for computed results, derived from operator" (let ((start 0) width prop title op f) (setq org-columns-current-fmt-compiled nil) (while (string-match @@ -15292,18 +15532,28 @@ will represent the current date/time. If there is already a timestamp at the cursor, it will be modified." (interactive "P") - (let (org-time-was-given org-end-time-was-given time) + (let ((default-time + ;; Default time is either today, or, when entering a range, + ;; the range start. + (if (or (org-at-timestamp-p t) + (save-excursion + (re-search-backward + (concat org-ts-regexp "--?-?\\=") ; 1-3 minuses + (- (point) 20) t))) + (apply 'encode-time (org-parse-time-string (match-string 1))) + (current-time))) + org-time-was-given org-end-time-was-given time) (cond ((and (org-at-timestamp-p) (eq last-command 'org-time-stamp) (eq this-command 'org-time-stamp)) (insert "--") (setq time (let ((this-command this-command)) - (org-read-date arg 'totime))) + (org-read-date arg 'totime nil nil default-time))) (org-insert-time-stamp time (or org-time-was-given arg))) ((org-at-timestamp-p) (setq time (let ((this-command this-command)) - (org-read-date arg 'totime))) + (org-read-date arg 'totime nil nil default-time))) (when (org-at-timestamp-p) ; just to get the match data (replace-match "") (setq org-last-changed-timestamp @@ -15313,9 +15563,9 @@ (message "Timestamp updated")) (t (setq time (let ((this-command this-command)) - (org-read-date arg 'totime))) + (org-read-date arg 'totime nil nil default-time))) (org-insert-time-stamp time (or org-time-was-given arg) - nil nil nil (list org-end-time-was-given)))))) + nil nil nil (list org-end-time-was-given)))))) (defun org-time-stamp-inactive (&optional arg) "Insert an inactive time stamp. @@ -15337,12 +15587,15 @@ (defvar org-ans2) ; dynamically scoped parameter (defvar org-plain-time-of-day-regexp) ; defined below -(defun org-read-date (&optional with-time to-time from-string prompt) +(defun org-read-date (&optional with-time to-time from-string prompt + default-time) "Read a date and make things smooth for the user. The prompt will suggest to enter an ISO date, but you can also enter anything which will at least partially be understood by `parse-time-string'. Unrecognized parts of the date will default to the current day, month, year, -hour and minute. For example, +hour and minute. If this command is called to replace a timestamp at point, +of to enter the second timestamp of a range, the default time is taken from the +existing stamp. For example, 3-2-5 --> 2003-02-05 feb 15 --> currentyear-02-15 sep 12 9 --> 2009-09-12 @@ -15368,32 +15621,25 @@ insert a time. Note that when WITH-TIME is not set, you can still enter a time, and this function will inform the calling routine about this change. The calling routine may then choose to change the format -used to insert the time stamp into the buffer to include the time." +used to insert the time stamp into the buffer to include the time. +With optional argument FROM-STRING, read fomr this string instead from +the user. PROMPT can overwrite the default prompt. DEFAULT-TIME is +the time/date that is used for everything that is not specified by the +user." (require 'parse-time) (let* ((org-time-stamp-rounding-minutes (if (equal with-time '(16)) 0 org-time-stamp-rounding-minutes)) (ct (org-current-time)) - (default-time - ;; Default time is either today, or, when entering a range, - ;; the range start. - (if (save-excursion - (re-search-backward - (concat org-ts-regexp "--?-?\\=") ; 1-3 minuses - (- (point) 20) t)) - (apply - 'encode-time - (mapcar (lambda(x) (or x 0)) - (parse-time-string (match-string 1)))) - ct)) + (def (or default-time ct)) (calendar-move-hook nil) (view-diary-entries-initially nil) (view-calendar-holidays-initially nil) (timestr (format-time-string - (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") default-time)) + (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") def)) (prompt (concat (if prompt (concat prompt " ") "") (format "Date and/or time (default [%s]): " timestr))) ans (org-ans0 "") org-ans1 org-ans2 (deltadays 0) - second minute hour day month year tl wday wday1 pm) + second minute hour day month year tl wday wday1 pm h2 m2) (cond (from-string (setq ans from-string)) @@ -15401,7 +15647,7 @@ (save-excursion (save-window-excursion (calendar) - (calendar-forward-day (- (time-to-days default-time) + (calendar-forward-day (- (time-to-days def) (calendar-absolute-from-gregorian (calendar-current-date)))) (org-eval-in-calendar nil t) @@ -15467,16 +15713,28 @@ ;; Help matching am/pm times, because `parse-time-string' does not do that. ;; If there is a time with am/pm, and *no* time without it, we convert ;; so that matching will be successful. - ;; FIXME: make this replace twice, so that we catch the end time. - (when (and (not (string-match "[012]?[0-9]:[0-9][0-9]\\([ \t\n]\\|$\\)" ans)) - (string-match "\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\(am\\|AM\\|pm\\|PM\\)\\>" ans)) + (loop for i from 1 to 2 do ; twice, for end time as well + (when (and (not (string-match "\\(\\`\\|[^+]\\)[012]?[0-9]:[0-9][0-9]\\([ \t\n]\\|$\\)" ans)) + (string-match "\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\(am\\|AM\\|pm\\|PM\\)\\>" ans)) + (setq hour (string-to-number (match-string 1 ans)) + minute (if (match-end 3) + (string-to-number (match-string 3 ans)) + 0) + pm (equal ?p + (string-to-char (downcase (match-string 4 ans))))) + (if (and (= hour 12) (not pm)) + (setq hour 0) + (if (and pm (< hour 12)) (setq hour (+ 12 hour)))) + (setq ans (replace-match (format "%02d:%02d" hour minute) + t t ans)))) + + ;; Check if a time range is given as a duration + (when (string-match "\\([012]?[0-9]\\):\\([0-6][0-9]\\)\\+\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?" ans) (setq hour (string-to-number (match-string 1 ans)) - minute (if (match-end 3) (string-to-number (match-string 3 ans)) 0) - pm (equal ?p (string-to-char (downcase (match-string 4 ans))))) - (if (and (= hour 12) (not pm)) - (setq hour 0) - (if (and pm (< hour 12)) (setq hour (+ 12 hour)))) - (setq ans (replace-match (format "%02d:%02d" hour minute) t t ans))) + h2 (+ hour (string-to-number (match-string 3 ans))) + minute (string-to-number (match-string 2 ans)) + m2 (+ minute (if (match-end 5) (string-to-number (match-string 5 ans))0))) + (setq ans (replace-match (format "%02d:%02d-%02d:%02d" hour minute h2 m2) t t ans))) ;; Check if there is a time range (when (and (boundp 'org-end-time-was-given) @@ -15487,11 +15745,11 @@ (substring ans (match-end 7))))) (setq tl (parse-time-string ans) - year (or (nth 5 tl) (string-to-number (format-time-string "%Y" ct))) - month (or (nth 4 tl) (string-to-number (format-time-string "%m" ct))) - day (or (nth 3 tl) (string-to-number (format-time-string "%d" ct))) - hour (or (nth 2 tl) (string-to-number (format-time-string "%H" ct))) - minute (or (nth 1 tl) (string-to-number (format-time-string "%M" ct))) + year (or (nth 5 tl) (string-to-number (format-time-string "%Y" def))) + month (or (nth 4 tl) (string-to-number (format-time-string "%m" def))) + day (or (nth 3 tl) (string-to-number (format-time-string "%d" def))) + hour (or (nth 2 tl) (string-to-number (format-time-string "%H" def))) + minute (or (nth 1 tl) (string-to-number (format-time-string "%M" def))) second (or (nth 0 tl) 0) wday (nth 6 tl)) (setq day (+ day deltadays)) @@ -15723,10 +15981,10 @@ (or (org-clock-update-time-maybe) (save-excursion - (unless (org-at-date-range-p) + (unless (org-at-date-range-p t) (goto-char (point-at-bol)) - (re-search-forward org-tr-regexp (point-at-eol) t)) - (if (not (org-at-date-range-p)) + (re-search-forward org-tr-regexp-both (point-at-eol) t)) + (if (not (org-at-date-range-p t)) (error "Not at a time-stamp range, and none found in current line"))) (let* ((ts1 (match-string 1)) (ts2 (match-string 2)) @@ -15835,7 +16093,8 @@ (t nil)))) (defun org-diary-to-ical-string (frombuf) - "FIXME" + "Get iCalendar entreis from diary entries in buffer FROMBUF. +This uses the icalendar.el library." (let* ((tmpdir (if (featurep 'xemacs) (temp-directory) temporary-file-directory)) @@ -15992,7 +16251,7 @@ (ans (or (looking-at tsr) (save-excursion (skip-chars-backward "^[<\n\r\t") - (if (> (point) 1) (backward-char 1)) + (if (> (point) (point-min)) (backward-char 1)) (and (looking-at tsr) (> (- (match-end 0) pos) -1)))))) (and (boundp 'org-ts-what) @@ -16073,8 +16332,9 @@ (memq org-ts-what '(day month year))) (org-recenter-calendar (time-to-days time))))) +;; FIXME: does not yet work for lead times (defun org-modify-ts-extra (s pos n) - "FIXME" + "Change the different parts of the lead-time and repeat fields in timestamp." (let ((idx '(("d" . 0) ("w" . 1) ("m" . 2) ("y" . 3) ("d" . -1) ("y" . 4))) ng h m new) (when (string-match "\\(-\\([012][0-9]\\):\\([0-5][0-9]\\)\\)?\\( \\+\\([0-9]+\\)\\([dmwy]\\)\\)?" s) @@ -16140,6 +16400,55 @@ (interactive) (org-timestamp-change 0 'calendar)) +;; Make appt aware of appointments from the agenda +(defun org-agenda-to-appt (&optional filter) + "Activate appointments found in `org-agenda-files'. +When prefixed, prompt for a regular expression and use it as a +filter: only add entries if they match this regular expression. + +FILTER can be a string. In this case, use this string as a +regular expression to filter results. + +FILTER can also be an alist, with the car of each cell being +either 'headline or 'category. For example: + + '((headline \"IMPORTANT\") + (category \"Work\")) + +will only add headlines containing IMPORTANT or headlines +belonging to the category \"Work\"." + (interactive "P") + (require 'org) + (if (equal filter '(4)) + (setq filter (read-from-minibuffer "Regexp filter: "))) + (let* ((today (org-date-to-gregorian + (time-to-days (current-time)))) + (files org-agenda-files) entries file) + (while (setq file (pop files)) + (setq entries (append entries (org-agenda-get-day-entries + file today :timestamp)))) + (setq entries (delq nil entries)) + (mapc + (lambda(x) + (let* ((evt (org-trim (get-text-property 1 'txt x))) + (cat (get-text-property 1 'org-category x)) + (tod (get-text-property 1 'time-of-day x)) + (ok (or (and (stringp filter) (string-match filter evt)) + (and (not (null filter)) (listp filter) + (or (string-match + (cadr (assoc 'category filter)) cat) + (string-match + (cadr (assoc 'headline filter)) evt)))))) + ;; (setq evt (set-text-properties 0 (length event) nil evt)) + (when (and ok tod) + (setq tod (number-to-string tod) + tod (when (string-match + "\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)" tod) + (concat (match-string 1 tod) ":" + (match-string 2 tod)))) + (appt-add tod evt)))) entries) + nil)) + ;;; The clock for measuring work time. (defvar org-mode-line-string "") @@ -16176,15 +16485,8 @@ (setq org-clock-heading (match-string 3)) (setq org-clock-heading "???")) (setq org-clock-heading (propertize org-clock-heading 'face nil)) - (beginning-of-line 2) - (while - (or (and (looking-at (concat "[ \t]*" org-keyword-time-regexp)) - (not (equal (match-string 1) org-clock-string))) - (and (looking-at "[ \t]*:PROPERTIES:") - (not org-insert-labeled-timestamps-before-properties-drawer))) - ;; Scheduling info, or properties drawer, move one line further - (beginning-of-line 2) - (or (bolp) (newline))) + (org-clock-find-position) + (insert "\n") (backward-char 1) (indent-relative) (insert org-clock-string " ") @@ -16199,6 +16501,57 @@ (setq org-mode-line-timer (run-with-timer 60 60 'org-update-mode-line)) (message "Clock started at %s" ts)))) +(defun org-clock-find-position () + "Find the location where the next clock line should be inserted." + (org-back-to-heading t) + (catch 'exit + (let ((beg (point-at-bol 2)) (end (progn (outline-next-heading) (point))) + (re (concat "^[ \t]*" org-clock-string)) + (cnt 0) + first last) + (goto-char beg) + (when (eobp) (newline) (setq end (max (point) end))) + (when (re-search-forward "^[ \t]*:CLOCK:" end t) + ;; we seem to have a CLOCK drawer, so go there. + (beginning-of-line 2) + (throw 'exit t)) + ;; Lets count the CLOCK lines + (goto-char beg) + (while (re-search-forward re end t) + (setq first (or first (match-beginning 0)) + last (match-beginning 0) + cnt (1+ cnt))) + (when (and (integerp org-clock-into-drawer) + (>= (1+ cnt) org-clock-into-drawer)) + ;; Wrap current entries into a new drawer + (goto-char last) + (beginning-of-line 2) + (if (org-at-item-p) (org-end-of-item)) + (insert ":END:\n") + (beginning-of-line 0) + (org-indent-line-function) + (goto-char first) + (insert ":CLOCK:\n") + (beginning-of-line 0) + (org-indent-line-function) + (org-flag-drawer t) + (beginning-of-line 2) + (throw 'exit nil)) + + (goto-char beg) + (while (and (looking-at (concat "[ \t]*" org-keyword-time-regexp)) + (not (equal (match-string 1) org-clock-string))) + ;; Planning info, skip to after it + (beginning-of-line 2) + (or (bolp) (newline))) + (when (eq t org-clock-into-drawer) + (insert ":CLOCK:\n:END:\n") + (beginning-of-line -1) + (org-indent-line-function) + (org-flag-drawer t) + (beginning-of-line 2) + (org-indent-line-function))))) + (defun org-clock-out (&optional fail-quietly) "Stop the currently running clock. If there is no running clock, throw an error, unless FAIL-QUIETLY is set." @@ -16227,7 +16580,10 @@ s (- s (* 60 s))) (insert " => " (format "%2d:%02d" h m)) (move-marker org-clock-marker nil) - (org-add-log-maybe 'clock-out) + (let* ((logging (save-match-data (org-entry-get nil "LOGGING" t))) + (org-log-done (org-parse-local-options logging 'org-log-done)) + (org-log-repeat (org-parse-local-options logging 'org-log-repeat))) + (org-add-log-maybe 'clock-out)) (when org-mode-line-timer (cancel-timer org-mode-line-timer) (setq org-mode-line-timer nil)) @@ -16247,6 +16603,19 @@ (delete-region (1- (point-at-bol)) (point-at-eol))) (message "Clock canceled")) +(defun org-clock-goto (&optional delete-windows) + "Go to the currently clocked-in entry." + (interactive "P") + (if (not (marker-buffer org-clock-marker)) + (error "No active clock")) + (switch-to-buffer-other-window + (marker-buffer org-clock-marker)) + (if delete-windows (delete-other-windows)) + (goto-char org-clock-marker) + (org-show-entry) + (org-back-to-heading) + (recenter)) + (defvar org-clock-file-total-minutes nil "Holds the file total time in minutes, after a call to `org-clock-sum'.") (make-variable-buffer-local 'org-clock-file-total-minutes) @@ -16310,7 +16679,10 @@ (unless total-only (save-excursion (goto-char (point-min)) - (while (setq p (next-single-property-change (point) :org-clock-minutes)) + (while (or (and (equal (setq p (point)) (point-min)) + (get-text-property p :org-clock-minutes)) + (setq p (next-single-property-change + (point) :org-clock-minutes))) (goto-char p) (when (setq time (get-text-property p :org-clock-minutes)) (org-put-clock-overlay time (funcall outline-level)))) @@ -16393,25 +16765,32 @@ (when (y-or-n-p "Save changed buffer?") (save-buffer)))) -(defun org-clock-report () +(defun org-clock-report (&optional arg) "Create a table containing a report about clocked time. -If the buffer contains lines -#+BEGIN: clocktable :maxlevel 3 :emphasize nil - -#+END: clocktable -then the table will be inserted between these lines, replacing whatever -is was there before. If these lines are not in the buffer, the table -is inserted at point, surrounded by the special lines. -The BEGIN line can contain parameters. Allowed are: -:maxlevel The maximum level to be included in the table. Default is 3. -:emphasize t/nil, if levell 1 and level 2 should be bold/italic in the table." - (interactive) +If the cursor is inside an existing clocktable block, then the table +will be updated. If not, a new clocktable will be inserted. +When called with a prefix argument, move to the first clock table in the +buffer and update it." + (interactive "P") (org-remove-clock-overlays) - (unless (org-find-dblock "clocktable") + (when arg (org-find-dblock "clocktable")) + (if (org-in-clocktable-p) + (goto-char (org-in-clocktable-p)) (org-create-dblock (list :name "clocktable" - :maxlevel 2 :emphasize nil))) + :maxlevel 2 :scope 'file))) (org-update-dblock)) +(defun org-in-clocktable-p () + "Check if the cursor is in a clocktable." + (let ((pos (point)) start) + (save-excursion + (end-of-line 1) + (and (re-search-backward "^#\\+BEGIN:[ \t]+clocktable" nil t) + (setq start (match-beginning 0)) + (re-search-forward "^#\\+END:.*" nil t) + (>= (match-end 0) pos) + start)))) + (defun org-clock-update-time-maybe () "If this is a CLOCK line, update it and return t. Otherwise, return nil." @@ -16485,12 +16864,16 @@ (defun org-dblock-write:clocktable (params) "Write the standard clocktable." - (let ((hlchars '((1 . "*") (2 . ?/))) + (let ((hlchars '((1 . "*") (2 . "/"))) (emph nil) (ins (make-marker)) + (total-time nil) ipos time h m p level hlc hdl maxlevel - ts te cc block) - (setq maxlevel (or (plist-get params :maxlevel) 3) + ts te cc block beg end pos scope tbl tostring multifile) + (setq scope (plist-get params :scope) + tostring (plist-get params :tostring) + multifile (plist-get params :multifile) + maxlevel (or (plist-get params :maxlevel) 3) emph (plist-get params :emphasize) ts (plist-get params :tstart) te (plist-get params :tend) @@ -16504,48 +16887,114 @@ (apply 'encode-time (org-parse-time-string te))))) (move-marker ins (point)) (setq ipos (point)) - (insert-before-markers "Clock summary at [" - (substring - (format-time-string (cdr org-time-stamp-formats)) - 1 -1) - "]." - (if block - (format " Considered range is /%s/." block) - "") - "\n\n|L|Headline|Time|\n") - (org-clock-sum ts te) - (setq h (/ org-clock-file-total-minutes 60) - m (- org-clock-file-total-minutes (* 60 h))) - (insert-before-markers "|-\n|0|" "*Total file time*| " - (format "*%d:%02d*" h m) - "|\n") - (goto-char (point-min)) - (while (setq p (next-single-property-change (point) :org-clock-minutes)) - (goto-char p) - (when (setq time (get-text-property p :org-clock-minutes)) - (save-excursion - (beginning-of-line 1) - (when (and (looking-at (org-re "\\(\\*+\\)[ \t]+\\(.*?\\)\\([ \t]+:[[:alnum:]_@:]+:\\)?[ \t]*$")) - (setq level (- (match-end 1) (match-beginning 1))) - (<= level maxlevel)) - (setq hlc (if emph (or (cdr (assoc level hlchars)) "") "") - hdl (match-string 2) - h (/ time 60) - m (- time (* 60 h))) - (goto-char ins) - (if (= level 1) (insert-before-markers "|-\n")) - (insert-before-markers - "| " (int-to-string level) "|" hlc hdl hlc " |" - (make-string (1- level) ?|) - hlc - (format "%d:%02d" h m) - hlc - " |\n"))))) - (goto-char ins) - (backward-delete-char 1) - (goto-char ipos) - (skip-chars-forward "^|") - (org-table-align))) + + ;; Get the right scope + (setq pos (point)) + (save-restriction + (cond + ((not scope)) + ((eq scope 'file) (widen)) + ((eq scope 'subtree) (org-narrow-to-subtree)) + ((eq scope 'tree) + (while (org-up-heading-safe)) + (org-narrow-to-subtree)) + ((and (symbolp scope) (string-match "^tree\\([0-9]+\\)$" + (symbol-name scope))) + (setq level (string-to-number (match-string 1 (symbol-name scope)))) + (catch 'exit + (while (org-up-heading-safe) + (looking-at outline-regexp) + (if (<= (org-reduced-level (funcall outline-level)) level) + (throw 'exit nil)))) + (org-narrow-to-subtree)) + ((or (listp scope) (eq scope 'agenda)) + (let* ((files (if (listp scope) scope (org-agenda-files))) + (scope 'agenda) + (p1 (copy-sequence params)) + file) + (plist-put p1 :tostring t) + (plist-put p1 :multifile t) + (plist-put p1 :scope 'file) + (org-prepare-agenda-buffers files) + (while (setq file (pop files)) + (with-current-buffer (find-buffer-visiting file) + (push (org-clocktable-add-file + file (org-dblock-write:clocktable p1)) tbl) + (setq total-time (+ (or total-time 0) + org-clock-file-total-minutes))))))) + (goto-char pos) + + (unless (eq scope 'agenda) + (org-clock-sum ts te) + (goto-char (point-min)) + (while (setq p (next-single-property-change (point) :org-clock-minutes)) + (goto-char p) + (when (setq time (get-text-property p :org-clock-minutes)) + (save-excursion + (beginning-of-line 1) + (when (and (looking-at (org-re "\\(\\*+\\)[ \t]+\\(.*?\\)\\([ \t]+:[[:alnum:]_@:]+:\\)?[ \t]*$")) + (setq level (org-reduced-level + (- (match-end 1) (match-beginning 1)))) + (<= level maxlevel)) + (setq hlc (if emph (or (cdr (assoc level hlchars)) "") "") + hdl (match-string 2) + h (/ time 60) + m (- time (* 60 h))) + (if (and (not multifile) (= level 1)) (push "|-" tbl)) + (push (concat + "| " (int-to-string level) "|" hlc hdl hlc " |" + (make-string (1- level) ?|) + hlc (format "%d:%02d" h m) hlc + " |") tbl)))))) + (setq tbl (nreverse tbl)) + (if tostring + (if tbl (mapconcat 'identity tbl "\n") nil) + (goto-char ins) + (insert-before-markers + "Clock summary at [" + (substring + (format-time-string (cdr org-time-stamp-formats)) + 1 -1) + "]." + (if block + (format " Considered range is /%s/." block) + "") + "\n\n" + (if (eq scope 'agenda) "|File" "") + "|L|Headline|Time|\n") + (setq total-time (or total-time org-clock-file-total-minutes) + h (/ total-time 60) + m (- total-time (* 60 h))) + (insert-before-markers + "|-\n|" + (if (eq scope 'agenda) "|" "") + "|" + "*Total time*| " + (format "*%d:%02d*" h m) + "|\n|-\n") + (setq tbl (delq nil tbl)) + (if (and (stringp (car tbl)) (> (length (car tbl)) 1) + (equal (substring (car tbl) 0 2) "|-")) + (pop tbl)) + (insert-before-markers (mapconcat + 'identity (delq nil tbl) + (if (eq scope 'agenda) "\n|-\n" "\n"))) + (backward-delete-char 1) + (goto-char ipos) + (skip-chars-forward "^|") + (org-table-align))))) + +(defun org-clocktable-add-file (file table) + (if table + (let ((lines (org-split-string table "\n")) + (ff (file-name-nondirectory file))) + (mapconcat 'identity + (mapcar (lambda (x) + (if (string-match org-table-dataline-regexp x) + (concat "|" ff x) + x)) + lines) + "\n")))) ;; FIXME: I don't think anybody uses this, ask David (defun org-collect-clock-time-entries () @@ -16694,12 +17143,13 @@ (org-defkey org-agenda-mode-map "x" 'org-agenda-exit) (org-defkey org-agenda-mode-map "\C-x\C-w" 'org-write-agenda) (org-defkey org-agenda-mode-map "s" 'org-save-all-org-buffers) +(org-defkey org-agenda-mode-map "\C-x\C-s" 'org-save-all-org-buffers) (org-defkey org-agenda-mode-map "P" 'org-agenda-show-priority) (org-defkey org-agenda-mode-map "T" 'org-agenda-show-tags) (org-defkey org-agenda-mode-map "n" 'next-line) (org-defkey org-agenda-mode-map "p" 'previous-line) -(org-defkey org-agenda-mode-map "\C-n" 'org-agenda-next-date-line) -(org-defkey org-agenda-mode-map "\C-p" 'org-agenda-previous-date-line) +(org-defkey org-agenda-mode-map "\C-c\C-n" 'org-agenda-next-date-line) +(org-defkey org-agenda-mode-map "\C-c\C-p" 'org-agenda-previous-date-line) (org-defkey org-agenda-mode-map "," 'org-agenda-priority) (org-defkey org-agenda-mode-map "\C-c," 'org-agenda-priority) (org-defkey org-agenda-mode-map "i" 'org-agenda-diary-entry) @@ -16712,9 +17162,14 @@ (org-defkey org-agenda-mode-map "S" 'org-agenda-sunrise-sunset) (org-defkey org-agenda-mode-map "h" 'org-agenda-holidays) (org-defkey org-agenda-mode-map "H" 'org-agenda-holidays) +(org-defkey org-agenda-mode-map "\C-c\C-x\C-i" 'org-agenda-clock-in) (org-defkey org-agenda-mode-map "I" 'org-agenda-clock-in) +(org-defkey org-agenda-mode-map "\C-c\C-x\C-o" 'org-agenda-clock-out) (org-defkey org-agenda-mode-map "O" 'org-agenda-clock-out) +(org-defkey org-agenda-mode-map "\C-c\C-x\C-x" 'org-agenda-clock-cancel) (org-defkey org-agenda-mode-map "X" 'org-agenda-clock-cancel) +(org-defkey org-agenda-mode-map "\C-c\C-x\C-j" 'org-clock-goto) +(org-defkey org-agenda-mode-map "J" 'org-clock-goto) (org-defkey org-agenda-mode-map "+" 'org-agenda-priority-up) (org-defkey org-agenda-mode-map "-" 'org-agenda-priority-down) (org-defkey org-agenda-mode-map [(shift up)] 'org-agenda-priority-up) @@ -16767,6 +17222,11 @@ ["Change Date +1 day" org-agenda-date-later (org-agenda-check-type nil 'agenda 'timeline)] ["Change Date -1 day" org-agenda-date-earlier (org-agenda-check-type nil 'agenda 'timeline)] ["Change Date to ..." org-agenda-date-prompt (org-agenda-check-type nil 'agenda 'timeline)]) + ("Clock" + ["Clock in" org-agenda-clock-in t] + ["Clock out" org-agenda-clock-out t] + ["Clock cancel" org-agenda-clock-cancel t] + ["Goto running clock" org-clock-goto t]) ("Priority" ["Set Priority" org-agenda-priority t] ["Increase Priority" org-agenda-priority-up t] @@ -16901,7 +17361,7 @@ "Dispatch agenda commands to collect entries to the agenda buffer. Prompts for a character to select a command. Any prefix arg will be passed on to the selected command. The default selections are: -g + a Call `org-agenda-list' to display the agenda for current day or week. t Call `org-todo-list' to display the global todo list. T Call `org-todo-list' to display the global todo list, select only @@ -17188,7 +17648,8 @@ (princ "\n")))))) (defun org-fix-agenda-info (props) - "FIXME" + "Make sure all properties on an agenda item have a canonical form, +so the the export commands caneasily use it." (let (tmp re) (when (setq tmp (plist-get props 'tags)) (setq props (plist-put props 'tags (mapconcat 'identity tmp ":")))) @@ -17479,7 +17940,7 @@ (progn (setq buffer-read-only nil) (goto-char (point-max)) - (unless (bobp) + (unless (or (bobp) org-agenda-compact-blocks) (insert "\n" (make-string (window-width) ?=) "\n")) (narrow-to-region (point) (point-max))) (org-agenda-maybe-reset-markers 'force) @@ -17547,6 +18008,7 @@ (set-buffer (org-get-agenda-file-buffer file)) (widen) (setq bmp (buffer-modified-p)) + (org-refresh-category-properties) (setq org-todo-keywords-for-agenda (append org-todo-keywords-for-agenda org-todo-keywords-1)) (setq org-done-keywords-for-agenda @@ -17649,38 +18111,10 @@ (with-current-buffer buf (save-buffer))) (kill-buffer buf)))) -(defvar org-category-table nil) -(defun org-get-category-table () - "Get the table of categories and positions in current buffer." - (let (tbl) - (save-excursion - (save-restriction - (widen) - (goto-char (point-min)) - (while (re-search-forward "^#\\+CATEGORY:[ \t]*\\(.*\\)" - nil t) - (push (cons (match-beginning 1) - (org-trim (match-string 1))) tbl)))) - tbl)) - (defun org-get-category (&optional pos) "Get the category applying to position POS." - (if (not org-category-table) - (cond - ((null org-category) - (setq org-category - (if buffer-file-name - (file-name-sans-extension - (file-name-nondirectory buffer-file-name)) - "???"))) - ((symbolp org-category) (symbol-name org-category)) - (t org-category)) - (let ((tbl org-category-table) - (pos (or pos (point)))) - (while (and tbl (> (caar tbl) pos)) - (pop tbl)) - (or (cdar tbl) (cdr (nth (1- (length org-category-table)) - org-category-table)))))) + (get-text-property (or pos (point)) 'org-category)) + ;;; Agenda timeline (defun org-timeline (&optional include-all) @@ -17739,8 +18173,8 @@ (setq date (calendar-gregorian-from-absolute d)) (setq s (point)) (setq rtn (and (not emptyp) - (apply 'org-agenda-get-day-entries - entry date args))) + (apply 'org-agenda-get-day-entries entry + date args))) (if (or rtn (equal d today) org-timeline-show-empty-dates) (progn (insert @@ -17888,11 +18322,12 @@ (add-text-properties (point-min) (1- (point)) (list 'face 'org-agenda-structure)) (insert (org-finalize-agenda-entries rtnall) "\n"))) - (setq s (point)) - (insert (capitalize (symbol-name (org-agenda-ndays-to-span nd))) - "-agenda:\n") - (add-text-properties s (1- (point)) (list 'face 'org-agenda-structure - 'org-date-line t)) + (unless org-agenda-compact-blocks + (setq s (point)) + (insert (capitalize (symbol-name (org-agenda-ndays-to-span nd))) + "-agenda:\n") + (add-text-properties s (1- (point)) (list 'face 'org-agenda-structure + 'org-date-line t))) (while (setq d (pop day-numbers)) (setq date (calendar-gregorian-from-absolute d) s (point)) @@ -18061,7 +18496,6 @@ (with-current-buffer buffer (unless (org-mode-p) (error "Agenda file %s is not in `org-mode'" file)) - (setq org-category-table (org-get-category-table)) (save-excursion (save-restriction (if org-agenda-restrict @@ -18113,11 +18547,11 @@ (and skip end))) (defun org-agenda-skip-entry-if (&rest conditions) - "Skip entry is any of CONDITIONS is true. + "Skip entry if any of CONDITIONS is true. See `org-agenda-skip-if for details." (org-agenda-skip-if nil conditions)) (defun org-agenda-skip-subtree-if (&rest conditions) - "Skip entry is any of CONDITIONS is true. + "Skip entry if any of CONDITIONS is true. See `org-agenda-skip-if for details." (org-agenda-skip-if t conditions)) @@ -18230,7 +18664,9 @@ (org-disable-agenda-to-diary t)) (save-excursion (save-window-excursion - (list-diary-entries date 1))) ;; Keep this name for now, compatibility + (funcall (if (fboundp 'diary-list-entries) + 'diary-list-entries 'list-diary-entries) + date 1))) (if (not (get-buffer fancy-diary-buffer)) (setq entries nil) (with-current-buffer fancy-diary-buffer @@ -18325,7 +18761,7 @@ date range matching the selected date. Deadlines will also be listed, on the expiration day. - :sexp FIXME + :sexp List entries resulting from diary-like sexps. :deadline List any deadlines past due, or due within `org-deadline-warning-days'. The listing occurs only @@ -18398,7 +18834,6 @@ (with-current-buffer buffer (unless (org-mode-p) (error "Agenda file %s is not in `org-mode'" file)) - (setq org-category-table (org-get-category-table)) (let ((case-fold-search nil)) (save-excursion (save-restriction @@ -18432,7 +18867,7 @@ (setq results (append results rtn)))))))) results)))) -;; FIXME: this works only if the cursor is not at the +;; FIXME: this works only if the cursor is *not* at the ;; beginning of the entry (defun org-entry-is-done-p () "Is the current entry marked DONE?" @@ -18832,7 +19267,7 @@ 'org-hd-marker (org-agenda-new-marker pos1) 'type (if pastschedp "past-scheduled" "scheduled") 'date (if pastschedp d2 date) - 'priority (+ (- 5 diff) (org-get-priority txt)) + 'priority (+ 94 (- 5 diff) (org-get-priority txt)) 'org-category category) (push txt ee)))))) (nreverse ee))) @@ -18904,6 +19339,18 @@ 1 the first time, range or not 8 the second time, if it is a range.") +(defconst org-plain-time-extension-regexp + (concat + "\\(\\<[012]?[0-9]" + "\\(\\(:\\([0-5][0-9]\\([AaPp][Mm]\\)?\\)\\)\\|\\([AaPp][Mm]\\)\\)\\>\\)" + "\\+\\([0-9]+\\)\\(:\\([0-5][0-9]\\)\\)?") + "Regular expression to match a time range like 13:30+2:10 = 13:30-15:40. +Examples: 11:45 or 8am-13:15 or 2:45-2:45pm. After a match, the following +groups carry important information: +0 the full match +7 hours of duration +9 minutes of duration") + (defconst org-stamp-time-of-day-regexp (concat "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +\\sw+ +\\)" @@ -19396,7 +19843,7 @@ sd)))) (cons sd nd))) -;; FIXME: this no longer works if user make date format that starts with a blank +;; FIXME: does not work if user makes date format that starts with a blank (defun org-agenda-next-date-line (&optional arg) "Jump to the next line indicating a date in agenda buffer." (interactive "p") @@ -19434,7 +19881,6 @@ (defun org-highlight-until-next-command (beg end &optional buffer) (org-highlight beg end buffer) (add-hook 'pre-command-hook 'org-unhighlight-once)) - (defun org-unhighlight-once () (remove-hook 'pre-command-hook 'org-unhighlight-once) (org-unhighlight)) @@ -19784,20 +20230,25 @@ (beginning-of-line 0))) (org-finalize-agenda))) -;; FIXME: allow negative value for org-agenda-align-tags-to-column -;; See the code in set-tags for the way to do this. (defun org-agenda-align-tags (&optional line) - "Align all tags in agenda items to `org-agenda-align-tags-to-column'." - (let ((inhibit-read-only t)) + "Align all tags in agenda items to `org-agenda-tags-column'." + (let ((inhibit-read-only t) l c) (save-excursion (goto-char (if line (point-at-bol) (point-min))) - (while (re-search-forward (org-re "\\([ \t]+\\):[[:alnum:]_@:]+:[ \t]*$") + (while (re-search-forward (org-re "\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$") (if line (point-at-eol) nil) t) + (add-text-properties + (match-beginning 2) (match-end 2) + (list 'face (list 'org-tag (get-text-property + (match-beginning 2) 'face)))) + (setq l (- (match-end 2) (match-beginning 2)) + c (if (< org-agenda-tags-column 0) + (- (abs org-agenda-tags-column) l) + org-agenda-tags-column)) (delete-region (match-beginning 1) (match-end 1)) (goto-char (match-beginning 1)) (insert (org-add-props - (make-string (max 1 (- org-agenda-align-tags-to-column - (current-column))) ?\ ) + (make-string (max 1 (- c (current-column))) ?\ ) (text-properties-at (point)))))))) (defun org-agenda-priority-up () @@ -19941,11 +20392,11 @@ (interactive "p") (org-agenda-date-later (- arg) what)) -(defun org-agenda-show-new-time (marker stamp) +(defun org-agenda-show-new-time (marker stamp &optional prefix) "Show new date stamp via text properties." ;; We use text properties to make this undoable (let ((inhibit-read-only t)) - (setq stamp (concat " => " stamp)) + (setq stamp (concat " " prefix " => " stamp)) (save-excursion (goto-char (point-max)) (while (not (bobp)) @@ -20001,8 +20452,9 @@ (with-current-buffer buffer (widen) (goto-char pos) - (setq ts (org-schedule)) - (message "Item scheduled for %s" ts))))) + (setq ts (org-schedule arg))) + (org-agenda-show-new-time marker ts "S")) + (message "Item scheduled for %s" ts))) (defun org-agenda-deadline (arg) "Schedule the item at point." @@ -20019,8 +20471,9 @@ (with-current-buffer buffer (widen) (goto-char pos) - (setq ts (org-deadline)) - (message "Deadline for this item set to %s" ts))))) + (setq ts (org-deadline arg))) + (org-agenda-show-new-time marker ts "S")) + (message "Deadline for this item set to %s" ts))) (defun org-get-heading (&optional no-tags) "Return the heading of the current entry, without the stars." @@ -20542,6 +20995,7 @@ (:agenda-style . org-agenda-export-html-style) ;; FIXME: Does this work???? (:convert-org-links . org-export-html-link-org-files-as-html) (:inline-images . org-export-html-inline-images) + (:html-extension . org-export-html-extension) (:expand-quoted-html . org-export-html-expand) (:timestamp . org-export-html-with-timestamp) (:publishing-directory . org-export-publishing-directory) @@ -21373,7 +21827,7 @@ :archived-trees (plist-get opt-plist :archived-trees) :add-text (plist-get opt-plist :text)) - "[\r\n]")) ;; FIXME: why \r here???/ + "\n")) thetoc have-headings first-heading-pos table-open table-buffer) @@ -21395,10 +21849,10 @@ (fundamental-mode) ;; create local variables for all options, to make sure all called ;; functions get the correct information - (mapcar (lambda (x) - (set (make-local-variable (cdr x)) - (plist-get opt-plist (car x)))) - org-export-plist-vars) + (mapc (lambda (x) + (set (make-local-variable (cdr x)) + (plist-get opt-plist (car x)))) + org-export-plist-vars) (org-set-local 'org-odd-levels-only odd) (setq umax (if arg (prefix-numeric-value arg) org-export-headline-levels)) @@ -21430,49 +21884,49 @@ (progn (push (concat (nth 3 lang-words) "\n") thetoc) (push (concat (make-string (length (nth 3 lang-words)) ?=) "\n") thetoc) - (mapcar '(lambda (line) - (if (string-match org-todo-line-regexp - line) - ;; This is a headline - (progn - (setq have-headings t) - (setq level (- (match-end 1) (match-beginning 1)) - level (org-tr-level level) - txt (match-string 3 line) - todo - (or (and org-export-mark-todo-in-toc - (match-beginning 2) - (not (member (match-string 2 line) - org-done-keywords))) + (mapc '(lambda (line) + (if (string-match org-todo-line-regexp + line) + ;; This is a headline + (progn + (setq have-headings t) + (setq level (- (match-end 1) (match-beginning 1)) + level (org-tr-level level) + txt (match-string 3 line) + todo + (or (and org-export-mark-todo-in-toc + (match-beginning 2) + (not (member (match-string 2 line) + org-done-keywords))) ; TODO, not DONE - (and org-export-mark-todo-in-toc - (= level umax-toc) + (and org-export-mark-todo-in-toc + (= level umax-toc) (org-search-todo-below line lines level)))) - (setq txt (org-html-expand-for-ascii txt)) - - (if (and (memq org-export-with-tags '(not-in-toc nil)) - (string-match - (org-re "[ \t]+:[[:alnum:]_@:]+:[ \t]*$") - txt)) - (setq txt (replace-match "" t t txt))) - (if (string-match quote-re0 txt) - (setq txt (replace-match "" t t txt))) - - (if org-export-with-section-numbers - (setq txt (concat (org-section-number level) - " " txt))) - (if (<= level umax-toc) - (progn - (push - (concat - (make-string - (* (max 0 (- level org-min-level)) 4) ?\ ) - (format (if todo "%s (*)\n" "%s\n") txt)) - thetoc) - (setq org-last-level level)) - )))) - lines) + (setq txt (org-html-expand-for-ascii txt)) + + (if (and (memq org-export-with-tags '(not-in-toc nil)) + (string-match + (org-re "[ \t]+:[[:alnum:]_@:]+:[ \t]*$") + txt)) + (setq txt (replace-match "" t t txt))) + (if (string-match quote-re0 txt) + (setq txt (replace-match "" t t txt))) + + (if org-export-with-section-numbers + (setq txt (concat (org-section-number level) + " " txt))) + (if (<= level umax-toc) + (progn + (push + (concat + (make-string + (* (max 0 (- level org-min-level)) 4) ?\ ) + (format (if todo "%s (*)\n" "%s\n") txt)) + thetoc) + (setq org-last-level level)) + )))) + lines) (setq thetoc (if have-headings (nreverse thetoc) nil)))) (org-init-section-numbers) @@ -21941,7 +22395,7 @@ (org-entry-get (region-beginning) "EXPORT_FILE_NAME" t)) (file-name-nondirectory buffer-file-name))) - ".html"))) + "." org-export-html-extension))) (current-dir (if buffer-file-name (file-name-directory buffer-file-name) default-directory)) @@ -22044,10 +22498,10 @@ (org-odd-levels-only odd)) ;; create local variables for all options, to make sure all called ;; functions get the correct information - (mapcar (lambda (x) - (set (make-local-variable (cdr x)) - (plist-get opt-plist (car x)))) - org-export-plist-vars) + (mapc (lambda (x) + (set (make-local-variable (cdr x)) + (plist-get opt-plist (car x)))) + org-export-plist-vars) (setq umax (if arg (prefix-numeric-value arg) org-export-headline-levels)) (setq umax-toc (if (integerp org-export-with-toc) @@ -22262,7 +22716,7 @@ (org-solidify-link-text (save-match-data (org-link-unescape path)) target-alist) "\">" desc "</a>"))) - ((member type '("http" "https")) ; FIXME: need to test this. + ((member type '("http" "https")) ;; standard URL, just check if we need to inline an image (if (and (or (eq t org-export-html-inline-images) (and org-export-html-inline-images (not descp))) @@ -22293,7 +22747,7 @@ (string-match "\\.org$" thefile)) (setq thefile (concat (substring thefile 0 (match-beginning 0)) - ".html")) + "." org-export-html-extension)) (if (and search ;; make sure this is can be used as target search (not (string-match "^[0-9]*$" search)) @@ -22528,7 +22982,7 @@ (kill-buffer (current-buffer))) (current-buffer))))) -(defvar org-table-colgroup-info nil) ;; FIXME: mode to a better place +(defvar org-table-colgroup-info nil) (defun org-format-table-ascii (lines) "Format a table for ascii export." (if (stringp lines) @@ -22569,8 +23023,9 @@ (memq new '(:start :startend))) (push t vl) (push nil vl))) - (setq vl (cons nil (nreverse vl))))) - + (setq vl (nreverse vl)) + (and vl (setcar vl nil)) + vl)) (defun org-format-table-html (lines olines) "Find out which HTML converter to use and return the HTML code." @@ -23086,13 +23541,13 @@ When COMBINE is non nil, add the category to each line." (let ((re1 (concat org-ts-regexp "\\|<%%([^>\n]+>")) (re2 (concat "--?-?\\(" org-ts-regexp "\\)")) - (org-category-table (org-get-category-table)) (dts (org-ical-ts-to-string (format-time-string (cdr org-time-stamp-formats) (current-time)) "DTSTART")) hd ts ts2 state status (inc t) pos b sexp rrule - scheduledp deadlinep tmp pri category + scheduledp deadlinep tmp pri category entry location summary desc (sexp-buffer (get-buffer-create "*ical-tmp*"))) + (org-refresh-category-properties) (save-excursion (goto-char (point-min)) (while (re-search-forward re1 nil t) @@ -23102,6 +23557,10 @@ ts (match-string 0) inc t hd (org-get-heading) + summary (org-entry-get nil "SUMMARY") + desc (or (org-entry-get nil "DESCRIPTION") + (org-get-cleaned-entry org-icalendar-include-body)) + location (org-entry-get nil "LOCATION") category (org-get-category)) (if (looking-at re2) (progn @@ -23131,24 +23590,32 @@ ("m" . "MONTHLY")("y" . "YEARLY")))) ";INTERVAL=" (match-string 1 ts))) (setq rrule "")) - (if (string-match org-bracket-link-regexp hd) - (setq hd (replace-match (if (match-end 3) (match-string 3 hd) - (match-string 1 hd)) - t t hd))) - (if deadlinep (setq hd (concat "DL: " hd))) - (if scheduledp (setq hd (concat "S: " hd))) + (setq summary (or summary hd)) + (if (string-match org-bracket-link-regexp summary) + (setq summary + (replace-match (if (match-end 3) + (match-string 3 summary) + (match-string 1 summary)) + t t summary))) + (if deadlinep (setq summary (concat "DL: " summary))) + (if scheduledp (setq summary (concat "S: " summary))) (if (string-match "\\`<%%" ts) (with-current-buffer sexp-buffer - (insert (substring ts 1 -1) " " hd "\n")) + (insert (substring ts 1 -1) " " summary "\n")) (princ (format "BEGIN:VEVENT %s %s%s -SUMMARY:%s +SUMMARY:%s%s%s CATEGORIES:%s END:VEVENT\n" (org-ical-ts-to-string ts "DTSTART") (org-ical-ts-to-string ts2 "DTEND" inc) - rrule hd category))))) + rrule summary + (if (and desc (string-match "\\S-" desc)) + (concat "\nDESCRIPTION: " desc) "") + (if (and location (string-match "\\S-" location)) + (concat "\nLOCATION: " location) "") + category))))) (when (and org-icalendar-include-sexps (condition-case nil (require 'icalendar) (error nil)) @@ -23180,7 +23647,11 @@ (eq org-icalendar-include-todo 'all)) (not (member org-archive-tag (org-get-tags-at))) ) - (setq hd (match-string 3)) + (setq hd (match-string 3) + summary (org-entry-get nil "SUMMARY") + desc (or (org-entry-get nil "DESCRIPTION") + (org-get-cleaned-entry org-icalendar-include-body)) + location (org-entry-get nil "LOCATION")) (if (string-match org-bracket-link-regexp hd) (setq hd (replace-match (if (match-end 3) (match-string 3 hd) (match-string 1 hd)) @@ -23195,13 +23666,38 @@ (princ (format "BEGIN:VTODO %s -SUMMARY:%s +SUMMARY:%s%s%s CATEGORIES:%s SEQUENCE:1 PRIORITY:%d STATUS:%s END:VTODO\n" - dts hd category pri status))))))))) + dts + (or summary hd) + (if (and location (string-match "\\S-" location)) + (concat "\nLOCATION: " location) "") + (if (and desc (string-match "\\S-" desc)) + (concat "\nDESCRIPTION: " desc) "") + category pri status))))))))) + +(defun org-get-cleaned-entry (what) + "Clean-up description string." + (when what + (save-excursion + (org-back-to-heading t) + (let ((s (buffer-substring (point-at-bol 2) (org-end-of-subtree t))) + (re (concat org-drawer-regexp "[^\000]*?:END:.*\n?")) + (re2 (concat "^[ \t]*" org-keyword-time-regexp ".*\n?"))) + (while (string-match re s) (setq s (replace-match "" t t s))) + (while (string-match re2 s) (setq s (replace-match "" t t s))) + (if (string-match "[ \t\r\n]+\\'" s) (setq s (replace-match "" t t s))) + (while (string-match "[ \t]*\n[ \t]*" s) + (setq s (replace-match "\\n" t t s))) + (setq s (org-trim s)) + (if (and (numberp what) + (> (length s) what)) + (substring s 0 what) + s))))) (defun org-start-icalendar-file (name) "Start an iCalendar file by inserting the header." @@ -23415,9 +23911,11 @@ (org-defkey org-mode-map "\C-c\C-v" 'org-show-todo-tree) (org-defkey org-mode-map "\C-c\C-w" 'org-check-deadlines) (org-defkey org-mode-map "\C-c/" 'org-occur) ; Minor-mode reserved +(org-defkey org-mode-map "\C-c\C-x/" 'org-occur-in-agenda-files) (org-defkey org-mode-map "\C-c\\" 'org-tags-sparse-tree) ; Minor-mode res. (org-defkey org-mode-map "\C-c\C-m" 'org-ctrl-c-ret) (org-defkey org-mode-map "\M-\C-m" 'org-insert-heading) +(org-defkey org-mode-map [(control return)] 'org-insert-heading-after-current) (org-defkey org-mode-map "\C-c\C-x\C-n" 'org-next-link) (org-defkey org-mode-map "\C-c\C-x\C-p" 'org-previous-link) (org-defkey org-mode-map "\C-c\C-l" 'org-insert-link) @@ -23465,6 +23963,7 @@ (org-defkey org-mode-map "\C-c\C-x\C-t" 'org-toggle-time-stamp-overlays) (org-defkey org-mode-map "\C-c\C-x\C-i" 'org-clock-in) (org-defkey org-mode-map "\C-c\C-x\C-o" 'org-clock-out) +(org-defkey org-mode-map "\C-c\C-x\C-j" 'org-clock-goto) (org-defkey org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel) (org-defkey org-mode-map "\C-c\C-x\C-d" 'org-clock-display) (org-defkey org-mode-map "\C-c\C-x\C-r" 'org-clock-report) @@ -23574,6 +24073,13 @@ (put 'org-delete-char 'flyspell-delayed t) (put 'org-delete-backward-char 'flyspell-delayed t) +(eval-after-load "pabbrev" + '(progn + (add-to-list 'pabbrev-expand-after-command-list + 'orgtbl-self-insert-command t) + (add-to-list 'pabbrev-expand-after-command-list + 'org-self-insert-command t))) + ;; How to do this: Measure non-white length of current string ;; If equal to column width, we should realign. @@ -23819,6 +24325,8 @@ - If the cursor is on a #+TBLFM line, re-apply the formulas to the entire table. +- If the cursor is a the beginning of a dynamic block, update it. + - If the cursor is inside a table created by the table.el package, activate that table. @@ -23863,6 +24371,10 @@ (call-interactively 'org-toggle-checkbox)) ((org-at-item-p) (call-interactively 'org-maybe-renumber-ordered-list)) + ((save-excursion (beginning-of-line 1) (looking-at "#\\+BEGIN:")) + ;; Dynamic block + (beginning-of-line 1) + (org-update-dblock)) ((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)")) (cond ((equal (match-string 1) "TBLFM") @@ -24054,7 +24566,7 @@ ["Priority Down" org-shiftdown t]) ("TAGS and Properties" ["Set Tags" 'org-ctrl-c-ctrl-c (org-at-heading-p)] - ["Change tag in region" 'org-change-tag-in-region (org-region-active-p)] ;FIXME + ["Change tag in region" 'org-change-tag-in-region (org-region-active-p)] ["Column view of properties" org-columns t]) ("Dates and Scheduling" ["Timestamp" org-time-stamp t] @@ -24077,6 +24589,7 @@ ["Clock in" org-clock-in t] ["Clock out" org-clock-out t] ["Clock cancel" org-clock-cancel t] + ["Goto running clock" org-clock-goto t] ["Display times" org-clock-display t] ["Create clock table" org-clock-report t] "--" @@ -24157,6 +24670,7 @@ ["Add/Move Current File to Front of List" org-agenda-file-to-front t] ["Remove Current File from List" org-remove-file t] ["Cycle through agenda files" org-cycle-agenda-files t] + ["Occur in all agenda files" org-occur-in-agenda-files t] "--") (mapcar 'org-file-menu-entry (org-agenda-files t)))))))) @@ -24288,7 +24802,7 @@ (setq clist (nreverse (delq nil clist))) clist)) -;; FIXME Compare with at-regexp-p +;; FIXME: Compare with at-regexp-p Do we need both? (defun org-in-regexp (re &optional nlines visually) "Check if point is inside a match of regexp. Normally only the current line is checked, but you can include NLINES extra @@ -24318,6 +24832,15 @@ (throw 'exit t))) nil)))) +(defun org-occur-in-agenda-files (regexp) + "Call `multi-occur' with buffers for all agenda files." + (interactive "sList all lines matching: ") + (multi-occur + (mapcar + (lambda (x) (or (get-file-buffer x) (find-file-noselect x))) + (org-agenda-files)) + regexp)) + (defun org-uniquify (list) "Remove duplicate elements from LIST." (let (res) @@ -24391,7 +24914,7 @@ (defun org-replace-escapes (string table) "Replace %-escapes in STRING with values in TABLE. -TABLE is an association list with keys line \"%a\" and string values. +TABLE is an association list with keys like \"%a\" and string values. The sequences in STRING may contain normal field width and padding information, for example \"%-5s\". Replacements happen in the sequence given by TABLE, so values can contain further %-escapes if they are define later in TABLE." @@ -24420,7 +24943,9 @@ "Like `find-buffer-visiting' but alway return the base buffer and not an indirect buffer" (let ((buf (find-buffer-visiting file))) - (or (buffer-base-buffer buf) buf))) + (if buf + (or (buffer-base-buffer buf) buf) + nil))) (defun org-image-file-name-regexp () "Return regexp matching the file names of images." @@ -24501,7 +25026,6 @@ ;; fill the headline as well. (org-set-local 'comment-start-skip "^#+[ \t]*") (org-set-local 'paragraph-separate "\f\\|\\*+ \\|[ ]*$\\|[ \t]*[:|]") -;; FIXME!!!!!!! (org-set-local 'paragraph-separate "\f\\|[ ]*$") ;; The paragraph starter includes hand-formatted lists. (org-set-local 'paragraph-start "\f\\|[ ]*$\\|\\*+ \\|\f\\|[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]") @@ -24750,13 +25274,17 @@ Show the heading too, if it is currently invisible." (interactive) (save-excursion - (org-back-to-heading t) - (outline-flag-region - (max (point-min) (1- (point))) - (save-excursion - (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move) - (or (match-beginning 1) (point-max))) - nil))) + (condition-case nil + (progn + (org-back-to-heading t) + (outline-flag-region + (max (point-min) (1- (point))) + (save-excursion + (re-search-forward + (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move) + (or (match-beginning 1) (point-max))) + nil)) + (error nil)))) (defun org-make-options-regexp (kwds) "Make a regular expression for keyword lines." @@ -24821,28 +25349,6 @@ ;;;; Experimental code -;; Make appt aware of appointments from the agenda -(defun org-agenda-to-appt () - "Activate appointments found in `org-agenda-files'." - (interactive) - (require 'org) - (let* ((today (org-date-to-gregorian - (time-to-days (current-time)))) - (files org-agenda-files) entries file) - (while (setq file (pop files)) - (setq entries (append entries (org-agenda-get-day-entries - file today :timestamp)))) - (setq entries (delq nil entries)) - (mapc (lambda(x) - (let* ((event (org-trim (get-text-property 1 'txt x))) - (time-of-day (get-text-property 1 'time-of-day x)) tod) - (when time-of-day - (setq tod (number-to-string time-of-day) - tod (when (string-match - "\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)" tod) - (concat (match-string 1 tod) ":" - (match-string 2 tod)))) - (if tod (appt-add tod event))))) entries))) (defun org-closed-in-range () "Sparse tree of items closed in a certain time range. @@ -24908,6 +25414,27 @@ (push (cons k c) new)))) (nreverse new))) +(defun org-parse-local-options (string var) + "Parse STRING for startup setting relevant for variable VAR." + (let ((rtn (symbol-value var)) + e opts) + (save-match-data + (if (or (not string) (not (string-match "\\S-" string))) + rtn + (setq opts (delq nil (mapcar (lambda (x) + (setq e (assoc x org-startup-options)) + (if (eq (nth 1 e) var) e nil)) + (org-split-string string "[ \t]+")))) + (if (not opts) + rtn + (setq rtn nil) + (while (setq e (pop opts)) + (if (not (nth 3 e)) + (setq rtn (nth 2 e)) + (if (not (listp rtn)) (setq rtn nil)) + (push (nth 2 e) rtn))) + rtn))))) + ;;;; Finish up (provide 'org)
--- a/lisp/textmodes/reftex-cite.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/textmodes/reftex-cite.el Sat Oct 13 05:53:03 2007 +0000 @@ -702,26 +702,26 @@ (delete-char 1)) ;; Tell AUCTeX - (when (and reftex-mode + (when (and reftex-mode (fboundp 'LaTeX-add-bibitems) reftex-plug-into-AUCTeX) (apply 'LaTeX-add-bibitems (mapcar 'car selected-entries))) - + ;; Produce the cite-view strings (when (and reftex-mode reftex-cache-cite-echo cite-view) - (mapcar (lambda (entry) - (reftex-make-cite-echo-string entry docstruct-symbol)) - selected-entries)) + (mapc (lambda (entry) + (reftex-make-cite-echo-string entry docstruct-symbol)) + selected-entries)) (message "")) (set-marker reftex-select-return-marker nil) (reftex-kill-buffer "*RefTeX Select*") - + ;; Check if the prefix arg was numeric, and call recursively (when (integerp arg) (if (> arg 1) - (progn + (progn (skip-chars-backward "}") (decf arg) (reftex-do-citation arg)) @@ -954,7 +954,7 @@ reftex-mouse-selected-face nil)) tmp len) - (mapcar + (mapc (lambda (x) (setq tmp (cdr (assoc "&formatted" x)) len (length tmp))
--- a/lisp/textmodes/reftex-ref.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/textmodes/reftex-ref.el Sat Oct 13 05:53:03 2007 +0000 @@ -665,10 +665,10 @@ (save-excursion (while reftex-buffers-with-changed-invisibility (set-buffer (car (car reftex-buffers-with-changed-invisibility))) - (setq buffer-invisibility-spec + (setq buffer-invisibility-spec (cdr (pop reftex-buffers-with-changed-invisibility))))) - (mapcar (lambda (buf) (and (buffer-live-p buf) (bury-buffer buf))) - selection-buffers) + (mapc (lambda (buf) (and (buffer-live-p buf) (bury-buffer buf))) + selection-buffers) (reftex-kill-temporary-buffers)) ;; Add the prefixes, put together the relevant information in the form ;; (LABEL TYPEKEY SEPARATOR) and return a list of those.
--- a/lisp/textmodes/reftex-sel.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/textmodes/reftex-sel.el Sat Oct 13 05:53:03 2007 +0000 @@ -643,12 +643,12 @@ (and ovl (reftex-delete-overlay ovl)) (setq reftex-select-marked (delq cell reftex-select-marked)) (setq cnt (1+ (length reftex-select-marked))) - (mapcar (lambda (c) - (setq sep (nth 2 c)) - (reftex-overlay-put (nth 1 c) 'before-string - (if sep - (format "*%c%d* " sep (decf cnt)) - (format "*%d* " (decf cnt))))) + (mapc (lambda (c) + (setq sep (nth 2 c)) + (reftex-overlay-put (nth 1 c) 'before-string + (if sep + (format "*%c%d* " sep (decf cnt)) + (format "*%d* " (decf cnt))))) reftex-select-marked) (message "Entry no longer marked")))
--- a/lisp/textmodes/reftex-toc.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/textmodes/reftex-toc.el Sat Oct 13 05:53:03 2007 +0000 @@ -618,7 +618,7 @@ nil ; we have permission, do nothing (error "Abort")) ; abort, we don't have permission ;; Do the changes - (mapcar 'reftex-toc-promote-action entries) + (mapc 'reftex-toc-promote-action entries) ;; Rescan the document and rebuilt the toc buffer (save-window-excursion (reftex-toc-Rescan))
--- a/lisp/textmodes/reftex.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/textmodes/reftex.el Sat Oct 13 05:53:03 2007 +0000 @@ -859,12 +859,12 @@ (defun reftex-erase-all-selection-and-index-buffers () ;; Remove all selection buffers associated with current document. - (mapcar + (mapc (lambda (type) (reftex-erase-buffer (reftex-make-selection-buffer-name type))) reftex-typekey-list) ;; Kill all index buffers - (mapcar + (mapc (lambda (tag) (reftex-kill-buffer (reftex-make-index-buffer-name tag))) (cdr (assoc 'index-tags (symbol-value reftex-docstruct-symbol))))) @@ -1339,7 +1339,7 @@ (user-login-name) (user-full-name))) (insert "(set reftex-docstruct-symbol '(\n\n") (let ((standard-output (current-buffer))) - (mapcar + (mapc (lambda (x) (cond ((eq (car x) 'toc) ;; A toc entry. Do not save the marker.
--- a/lisp/url/ChangeLog Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/url/ChangeLog Sat Oct 13 05:53:03 2007 +0000 @@ -1,3 +1,8 @@ +2007-10-12 Diane Murray <disumu@x3y2z1.net> + + * url-auth.el (url-basic-auth): Set path to "/" when URL has an + empty string filename. + 2007-09-26 Juanma Barranquero <lekktu@gmail.com> * url-dav.el (top):
--- a/lisp/url/url-auth.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/url/url-auth.el Sat Oct 13 05:53:03 2007 +0000 @@ -74,6 +74,7 @@ (setq server (format "%s:%d" server port) path (cond (realm realm) + ((string= "" path) "/") ((string-match "/$" path) path) (t (url-basepath path))) byserv (cdr-safe (assoc server
--- a/lisp/vc-arch.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/vc-arch.el Sat Oct 13 05:53:03 2007 +0000 @@ -265,7 +265,7 @@ ;; ID not found. (if (equal (file-name-nondirectory sigfile) (subst-char-in-string - ?/ ?% (vc-arch-workfile-version file))) + ?/ ?% (vc-arch-working-revision file))) 'added ;; Might be `added' or `up-to-date' as well. ;; FIXME: Check in the patch logs to find out. @@ -283,7 +283,7 @@ 'up-to-date 'edited))))))))) -(defun vc-arch-workfile-version (file) +(defun vc-arch-working-revision (file) (let* ((root (expand-file-name "{arch}" (vc-arch-root file))) (defbranch (vc-arch-default-version file))) (when (and defbranch (string-match "\\`\\(.+@[^/\n]+\\)/\\(\\(\\(.*?\\)\\(?:--.*\\)?\\)--.*\\)\\'" defbranch)) @@ -321,7 +321,7 @@ (defun vc-arch-mode-line-string (file) "Return string for placement in modeline by `vc-mode-line' for FILE." - (let ((rev (vc-workfile-version file))) + (let ((rev (vc-working-revision file))) (dolist (rule vc-arch-mode-line-rewrite) (if (string-match (car rule) rev) (setq rev (replace-match (cdr rule) t nil rev)))) @@ -389,7 +389,7 @@ (let ((file (car files))) (if (and newvers (vc-up-to-date-p file) - (equal newvers (vc-workfile-version file))) + (equal newvers (vc-working-revision file))) ;; Newvers is the base revision and the current file is unchanged, ;; so we can diff with the current file. (setq newvers nil)) @@ -406,7 +406,7 @@ ;; Arch does not support the typical flags. ;; (vc-switches 'Arch 'diff) (file-relative-name file) - (if (equal oldvers (vc-workfile-version file)) + (if (equal oldvers (vc-working-revision file)) nil oldvers)))) (if async 1 status))))) ; async diff, pessimistic assumption. @@ -423,7 +423,7 @@ "A wrapper around `vc-do-command' for use in vc-arch.el." (apply 'vc-do-command buffer okstatus vc-arch-command file flags)) -(defun vc-arch-init-version () nil) +(defun vc-arch-init-revision () nil) ;;; Completion of versions and revisions. @@ -559,7 +559,7 @@ ;;; Less obvious implementations. -(defun vc-arch-find-version (file rev buffer) +(defun vc-arch-find-revision (file rev buffer) (let ((out (make-temp-file "vc-out"))) (unwind-protect (progn
--- a/lisp/vc-bzr.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/vc-bzr.el Sat Oct 13 05:53:03 2007 +0000 @@ -238,7 +238,7 @@ (defun vc-bzr-workfile-unchanged-p (file) (eq 'unchanged (car (vc-bzr-status file)))) -(defun vc-bzr-workfile-version (file) +(defun vc-bzr-working-revision (file) (lexical-let* ((rootdir (vc-bzr-root file)) (branch-format-file (expand-file-name vc-bzr-admin-branch-format-file @@ -284,7 +284,7 @@ "Register FILE under bzr. Signal an error unless REV is nil. COMMENT is ignored." - (if rev (error "Can't register explicit version with bzr")) + (if rev (error "Can't register explicit revision with bzr")) (vc-bzr-command "add" nil 0 files)) ;; Could run `bzr status' in the directory and see if it succeeds, but @@ -313,7 +313,7 @@ (defun vc-bzr-checkin (files rev comment) "Check FILE in to bzr with log message COMMENT. REV non-nil gets an error." - (if rev (error "Can't check in a specific version with bzr")) + (if rev (error "Can't check in a specific revision with bzr")) (vc-bzr-command "commit" nil 0 files "-m" comment)) (defun vc-bzr-checkout (file &optional editable rev destfile) @@ -365,11 +365,11 @@ (unless (fboundp 'vc-default-log-view-mode) (add-hook 'log-view-mode-hook 'vc-bzr-log-view-mode))) -(defun vc-bzr-show-log-entry (version) - "Find entry for patch name VERSION in bzr change log buffer." +(defun vc-bzr-show-log-entry (revision) + "Find entry for patch name REVISION in bzr change log buffer." (goto-char (point-min)) (let (case-fold-search) - (if (re-search-forward (concat "^-+\nrevno: " version "$") nil t) + (if (re-search-forward (concat "^-+\nrevno: " revision "$") nil t) (beginning-of-line 0) (goto-char (point-min))))) @@ -377,7 +377,7 @@ (defun vc-bzr-diff (files &optional rev1 rev2 buffer) "VC bzr backend for diff." - (let ((working (vc-workfile-version (if (consp files) (car files) files)))) + (let ((working (vc-working-revision (if (consp files) (car files) files)))) (if (and (equal rev1 working) (not rev2)) (setq rev1 nil)) (if (and (not rev1) rev2) @@ -394,8 +394,8 @@ (defalias 'vc-bzr-diff-tree 'vc-bzr-diff) -;; FIXME: vc-{next,previous}-version need fixing in vc.el to deal with -;; straight integer versions. +;; FIXME: vc-{next,previous}-revision need fixing in vc.el to deal with +;; straight integer revisions. (defun vc-bzr-delete-file (file) "Delete FILE and delete it in the bzr repository." @@ -412,12 +412,12 @@ "Internal use.") (make-variable-buffer-local 'vc-bzr-annotation-table) -(defun vc-bzr-annotate-command (file buffer &optional version) +(defun vc-bzr-annotate-command (file buffer &optional revision) "Prepare BUFFER for `vc-annotate' on FILE. Each line is tagged with the revision number, which has a `help-echo' property containing author and date information." (apply #'vc-bzr-command "annotate" buffer 0 file "--long" "--all" - (if version (list "-r" version))) + (if revision (list "-r" revision))) (with-current-buffer buffer ;; Store the tags for the annotated source lines in a hash table ;; to allow saving space by sharing the text properties. @@ -546,7 +546,7 @@ (vc-file-setprop file 'vc-state current-vc-state) (vc-file-setprop file 'vc-bzr-state current-bzr-state) (when (eq 'added current-bzr-state) - (vc-file-setprop file 'vc-workfile-version "0")))) + (vc-file-setprop file 'vc-working-revision "0")))) (when (eq 'not-versioned current-bzr-state) (let ((file (expand-file-name (buffer-substring-no-properties
--- a/lisp/vc-cvs.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/vc-cvs.el Sat Oct 13 05:53:03 2007 +0000 @@ -229,13 +229,13 @@ (goto-char (point-max)) (widen))))))) -(defun vc-cvs-workfile-version (file) - "CVS-specific version of `vc-workfile-version'." +(defun vc-cvs-working-revision (file) + "CVS-specific version of `vc-working-revision'." ;; There is no need to consult RCS headers under CVS, because we ;; get the workfile version for free when we recognize that a file ;; is registered in CVS. (vc-cvs-registered file) - (vc-file-getprop file 'vc-workfile-version)) + (vc-file-getprop file 'vc-working-revision)) (defun vc-cvs-checkout-model (file) "CVS-specific version of `vc-checkout-model'." @@ -261,7 +261,7 @@ (let* ((sticky-tag (vc-file-getprop file 'vc-cvs-sticky-tag)) help-echo (string - (if (string= (vc-workfile-version file) "0") + (if (string= (vc-working-revision file) "0") ;; A file that is added but not yet committed. (progn (setq help-echo "Added file (needs commit) under CVS") @@ -282,7 +282,7 @@ "CVS-specific version of `vc-dired-state-info'." (let ((cvs-state (vc-state file))) (cond ((eq cvs-state 'edited) - (if (equal (vc-workfile-version file) "0") + (if (equal (vc-working-revision file) "0") "(added)" "(modified)")) ((eq cvs-state 'needs-patch) "(patch)") ((eq cvs-state 'needs-merge) "(merge)")))) @@ -330,7 +330,7 @@ (defun vc-cvs-checkin (files rev comment) "CVS-specific version of `vc-backend-checkin'." - (unless (or (not rev) (vc-cvs-valid-version-number-p rev)) + (unless (or (not rev) (vc-cvs-valid-revision-number-p rev)) (if (not (vc-cvs-valid-symbolic-tag-name-p rev)) (error "%s is not a valid symbolic tag name" rev) ;; If the input revison is a valid symbolic tag name, we create it @@ -359,12 +359,12 @@ (goto-char (point-min)) (shrink-window-if-larger-than-buffer) (error "Check-in failed")))) - ;; Single-file commit? Then update the version by parsing the buffer. + ;; Single-file commit? Then update the revision by parsing the buffer. ;; Otherwise we can't necessarily tell what goes with what; clear ;; its properties so they have to be refetched. (if (= (length files) 1) (vc-file-setprop - (car files) 'vc-workfile-version + (car files) 'vc-working-revision (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) (mapc (lambda (file) (vc-file-clearprops file)) files)) ;; Anyway, forget the checkout model of the file, because we might have @@ -379,7 +379,7 @@ (if (and rev (not (vc-cvs-valid-symbolic-tag-name-p rev))) (vc-cvs-command nil 0 files "update" "-A")))) -(defun vc-cvs-find-version (file rev buffer) +(defun vc-cvs-find-revision (file rev buffer) (apply 'vc-cvs-command buffer 0 file "-Q" ; suppress diagnostic output @@ -404,8 +404,8 @@ (vc-cvs-command nil 0 file "edit") (set-file-modes file (logior (file-modes file) 128)) (if (equal file buffer-file-name) (toggle-read-only -1)))) - ;; Check out a particular version (or recreate the file). - (vc-file-setprop file 'vc-workfile-version nil) + ;; Check out a particular revision (or recreate the file). + (vc-file-setprop file 'vc-working-revision nil) (apply 'vc-cvs-command nil 0 file (and editable "-w") "update" @@ -426,7 +426,7 @@ (vc-cvs-command nil 0 file "commit" "-mRemoved.")) (defun vc-cvs-revert (file &optional contents-done) - "Revert FILE to the version on which it was based." + "Revert FILE to the working revision on which it was based." (vc-default-revert 'CVS file contents-done) (unless (eq (vc-checkout-model file) 'implicit) (if vc-cvs-use-edit @@ -434,13 +434,13 @@ ;; Make the file read-only by switching off all w-bits (set-file-modes file (logand (file-modes file) 3950))))) -(defun vc-cvs-merge (file first-version &optional second-version) +(defun vc-cvs-merge (file first-revision &optional second-revision) "Merge changes into current working copy of FILE. -The changes are between FIRST-VERSION and SECOND-VERSION." +The changes are between FIRST-REVISION and SECOND-REVISION." (vc-cvs-command nil 0 file "update" "-kk" - (concat "-j" first-version) - (concat "-j" second-version)) + (concat "-j" first-revision) + (concat "-j" second-revision)) (vc-file-setprop file 'vc-state 'edited) (with-current-buffer (get-buffer "*vc*") (goto-char (point-min)) @@ -451,18 +451,18 @@ (defun vc-cvs-merge-news (file) "Merge in any new changes made to FILE." (message "Merging changes into %s..." file) - ;; (vc-file-setprop file 'vc-workfile-version nil) + ;; (vc-file-setprop file 'vc-working-revision nil) (vc-file-setprop file 'vc-checkout-time 0) (vc-cvs-command nil 0 file "update") ;; Analyze the merge result reported by CVS, and set ;; file properties accordingly. (with-current-buffer (get-buffer "*vc*") (goto-char (point-min)) - ;; get new workfile version + ;; get new working revision (if (re-search-forward "^Merging differences between [0-9.]* and \\([0-9.]*\\) into" nil t) - (vc-file-setprop file 'vc-workfile-version (match-string 1)) - (vc-file-setprop file 'vc-workfile-version nil)) + (vc-file-setprop file 'vc-working-revision (match-string 1)) + (vc-file-setprop file 'vc-working-revision nil)) ;; get file status (prog1 (if (eq (buffer-size) 0) @@ -512,7 +512,7 @@ nil) (defun vc-cvs-diff (files &optional oldvers newvers buffer) - "Get a difference report using CVS between two versions of FILE." + "Get a difference report using CVS between two revisions of FILE." (let* ((async (and (not vc-disable-async-diff) (vc-stay-local-p files) (fboundp 'start-process))) @@ -559,14 +559,14 @@ (set-process-filter process vc-filter) (funcall vc-filter process (substring string (match-beginning 0)))))) -(defun vc-cvs-annotate-command (file buffer &optional version) +(defun vc-cvs-annotate-command (file buffer &optional revision) "Execute \"cvs annotate\" on FILE, inserting the contents in BUFFER. -Optional arg VERSION is a version to annotate from." +Optional arg REVISION is a revision to annotate from." (vc-cvs-command buffer (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0) file "annotate" - (if version (concat "-r" version))) + (if revision (concat "-r" revision))) ;; Strip the leading few lines. (let ((proc (get-buffer-process buffer))) (if proc @@ -633,7 +633,7 @@ ;;; (defun vc-cvs-create-snapshot (dir name branchp) - "Assign to DIR's current version a given NAME. + "Assign to DIR's current revision a given NAME. If BRANCHP is non-nil, the name is created as a branch (and the current workspace is immediately moved to that new branch)." (vc-cvs-command nil 0 dir "tag" "-c" (if branchp "-b") name) @@ -663,13 +663,13 @@ ((or (string= state "U") (string= state "P")) (vc-file-setprop file 'vc-state 'up-to-date) - (vc-file-setprop file 'vc-workfile-version nil) + (vc-file-setprop file 'vc-working-revision nil) (vc-file-setprop file 'vc-checkout-time (nth 5 (file-attributes file)))) ((or (string= state "M") (string= state "C")) (vc-file-setprop file 'vc-state 'edited) - (vc-file-setprop file 'vc-workfile-version nil) + (vc-file-setprop file 'vc-working-revision nil) (vc-file-setprop file 'vc-checkout-time 0))) (vc-file-setprop file 'vc-cvs-sticky-tag sticky-tag) (vc-resynch-buffer file t t)))) @@ -800,7 +800,7 @@ "\\(RCS Version\\|RCS Revision\\|Repository revision\\):\ \[\t ]+\\([0-9.]+\\)" nil t)) - (vc-file-setprop file 'vc-latest-version (match-string 2))) + (vc-file-setprop file 'vc-latest-revision (match-string 2))) (vc-file-setprop file 'vc-state (cond @@ -843,8 +843,8 @@ (and (string-match "^[a-zA-Z]" tag) (not (string-match "[^a-z0-9A-Z-_]" tag)))) -(defun vc-cvs-valid-version-number-p (tag) - "Return non-nil if TAG is a valid version number." +(defun vc-cvs-valid-revision-number-p (tag) + "Return non-nil if TAG is a valid revision number." (and (string-match "^[0-9]" tag) (not (string-match "[^0-9.]" tag)))) @@ -908,7 +908,7 @@ ;; entry for a "locally added" file (not yet committed) ((looking-at "/[^/]+/0/") (vc-file-setprop file 'vc-checkout-time 0) - (vc-file-setprop file 'vc-workfile-version "0") + (vc-file-setprop file 'vc-working-revision "0") (if set-state (vc-file-setprop file 'vc-state 'edited))) ;; normal entry ((looking-at @@ -922,7 +922,7 @@ ;; sticky tag "\\(.\\|\\)" ;Sticky tag type (date or tag name, could be empty) "\\(.*\\)")) ;Sticky tag - (vc-file-setprop file 'vc-workfile-version (match-string 1)) + (vc-file-setprop file 'vc-working-revision (match-string 1)) (vc-file-setprop file 'vc-cvs-sticky-tag (vc-cvs-parse-sticky-tag (match-string 4) (match-string 5)))
--- a/lisp/vc-git.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/vc-git.el Sat Oct 13 05:53:03 2007 +0000 @@ -53,7 +53,7 @@ ;; * state (file) OK ;; - state-heuristic (file) NOT NEEDED ;; - dir-state (dir) OK -;; * workfile-version (file) OK +;; * working-revision (file) OK ;; - latest-on-branch-p (file) NOT NEEDED ;; * checkout-model (file) OK ;; - workfile-unchanged-p (file) OK @@ -62,13 +62,13 @@ ;; STATE-CHANGING FUNCTIONS ;; * create-repo () OK ;; * register (files &optional rev comment) OK -;; - init-version (file) NOT NEEDED +;; - init-revision (file) NOT NEEDED ;; - responsible-p (file) OK ;; - could-register (file) NOT NEEDED, DEFAULT IS GOOD ;; - receive-file (file rev) NOT NEEDED ;; - unregister (file) OK ;; * checkin (files rev comment) OK -;; * find-version (file rev buffer) OK +;; * find-revision (file rev buffer) OK ;; * checkout (file &optional editable rev) OK ;; * revert (file &optional contents-done) OK ;; - rollback (files) COULD BE SUPPORTED @@ -77,11 +77,11 @@ ;; wouldn't be identified as a merge by git, ;; so it's probably not a good idea. ;; - merge-news (file) see `merge' -;; - steal-lock (file &optional version) NOT NEEDED +;; - steal-lock (file &optional revision) NOT NEEDED ;; HISTORY FUNCTIONS ;; * print-log (files &optional buffer) OK ;; - log-view-mode () OK -;; - show-log-entry (version) NOT NEEDED, DEFAULT IS GOOD +;; - show-log-entry (revision) NOT NEEDED, DEFAULT IS GOOD ;; - wash-log (file) COULD BE SUPPORTED ;; - logentry-check () NOT NEEDED ;; - comment-history (file) ?? @@ -100,8 +100,8 @@ ;; MISCELLANEOUS ;; - make-version-backups-p (file) NOT NEEDED ;; - repository-hostname (dirname) NOT NEEDED -;; - previous-version (file rev) OK -;; - next-version (file rev) OK +;; - previous-revision (file rev) OK +;; - next-revision (file rev) OK ;; - check-headers () COULD BE SUPPORTED ;; - clear-headers () NOT NEEDED ;; - delete-file (file) OK @@ -177,8 +177,8 @@ (vc-file-setprop file 'vc-state 'nil))) (forward-line))))) -(defun vc-git-workfile-version (file) - "Git-specific version of `vc-workfile-version'." +(defun vc-git-working-revision (file) + "Git-specific version of `vc-working-revision'." (let ((str (with-output-to-string (with-current-buffer standard-output (call-process "git" nil '(t nil) nil "symbolic-ref" "HEAD"))))) @@ -194,7 +194,7 @@ (defun vc-git-mode-line-string (file) "Return string for placement into the modeline for FILE." - (let* ((branch (vc-git-workfile-version file)) + (let* ((branch (vc-git-working-revision file)) (def-ml (vc-default-mode-line-string 'Git file)) (help-echo (get-text-property 0 'help-echo def-ml))) (if (zerop (length branch)) @@ -232,7 +232,7 @@ (let ((coding-system-for-write git-commits-coding-system)) (vc-git-command nil 0 files "commit" "-m" comment "--only" "--"))) -(defun vc-git-find-version (file rev buffer) +(defun vc-git-find-revision (file rev buffer) (let ((coding-system-for-read 'binary) (coding-system-for-write 'binary) (fullname (substring @@ -372,8 +372,8 @@ ;;; MISCELLANEOUS -(defun vc-git-previous-version (file rev) - "Git-specific version of `vc-previous-version'." +(defun vc-git-previous-revision (file rev) + "Git-specific version of `vc-previous-revision'." (let ((default-directory (file-name-directory (expand-file-name file))) (file (file-name-nondirectory file))) (vc-git-symbolic-commit @@ -390,8 +390,8 @@ (point) (1- (point-max)))))))) -(defun vc-git-next-version (file rev) - "Git-specific version of `vc-next-version'." +(defun vc-git-next-revision (file rev) + "Git-specific version of `vc-next-revision'." (let* ((default-directory (file-name-directory (expand-file-name file))) (file (file-name-nondirectory file))
--- a/lisp/vc-hg.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/vc-hg.el Sat Oct 13 05:53:03 2007 +0000 @@ -45,7 +45,7 @@ ;; * state (file) OK ;; - state-heuristic (file) ?? PROBABLY NOT NEEDED ;; - dir-state (dir) OK -;; * workfile-version (file) OK +;; * working-revision (file) OK ;; - latest-on-branch-p (file) ?? ;; * checkout-model (file) OK ;; - workfile-unchanged-p (file) OK @@ -54,23 +54,23 @@ ;; STATE-CHANGING FUNCTIONS ;; * register (files &optional rev comment) OK ;; * create-repo () OK -;; - init-version () NOT NEEDED +;; - init-revision () NOT NEEDED ;; - responsible-p (file) OK ;; - could-register (file) OK ;; - receive-file (file rev) ?? PROBABLY NOT NEEDED ;; - unregister (file) COMMENTED OUT, MAY BE INCORRECT ;; * checkin (files rev comment) OK -;; * find-version (file rev buffer) OK +;; * find-revision (file rev buffer) OK ;; * checkout (file &optional editable rev) OK ;; * revert (file &optional contents-done) OK ;; - rollback (files) ?? PROBABLY NOT NEEDED ;; - merge (file rev1 rev2) NEEDED ;; - merge-news (file) NEEDED -;; - steal-lock (file &optional version) NOT NEEDED +;; - steal-lock (file &optional revision) NOT NEEDED ;; HISTORY FUNCTIONS ;; * print-log (files &optional buffer) OK ;; - log-view-mode () OK -;; - show-log-entry (version) NOT NEEDED, DEFAULT IS GOOD +;; - show-log-entry (revision) NOT NEEDED, DEFAULT IS GOOD ;; - wash-log (file) ?? ;; - logentry-check () NOT NEEDED ;; - comment-history (file) NOT NEEDED @@ -89,8 +89,8 @@ ;; MISCELLANEOUS ;; - make-version-backups-p (file) ?? ;; - repository-hostname (dirname) ?? -;; - previous-version (file rev) OK -;; - next-version (file rev) OK +;; - previous-revision (file rev) OK +;; - next-revision (file rev) OK ;; - check-headers () ?? ;; - clear-headers () ?? ;; - delete-file (file) TEST IT @@ -198,7 +198,7 @@ ;; should not show up in vc-dired, so don't deal with them ;; here. ((eq status-char ?A) - (vc-file-setprop file 'vc-workfile-version "0") + (vc-file-setprop file 'vc-working-revision "0") (vc-file-setprop file 'vc-state 'edited)) ((eq status-char ?M) (vc-file-setprop file 'vc-state 'edited)) @@ -207,8 +207,8 @@ (vc-file-setprop file 'vc-state 'nil))) (forward-line))))) -(defun vc-hg-workfile-version (file) - "Hg-specific version of `vc-workfile-version'." +(defun vc-hg-working-revision (file) + "Hg-specific version of `vc-working-revision'." (let* ((status nil) (out @@ -277,8 +277,8 @@ ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))) (defun vc-hg-diff (files &optional oldvers newvers buffer) - "Get a difference report using hg between two versions of FILES." - (let ((working (vc-workfile-version (car files)))) + "Get a difference report using hg between two revisions of FILES." + (let ((working (vc-working-revision (car files)))) (if (and (equal oldvers working) (not newvers)) (setq oldvers nil)) (if (and (not oldvers) newvers) @@ -312,10 +312,10 @@ (defun vc-hg-diff-tree (file &optional oldvers newvers buffer) (vc-hg-diff (list file) oldvers newvers buffer)) -(defun vc-hg-annotate-command (file buffer &optional version) +(defun vc-hg-annotate-command (file buffer &optional revision) "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER. -Optional arg VERSION is a version to annotate from." - (vc-hg-command buffer 0 file "annotate" "-d" "-n" (if version (concat "-r" version))) +Optional arg REVISION is a revision to annotate from." + (vc-hg-command buffer 0 file "annotate" "-d" "-n" (if revision (concat "-r" revision))) (with-current-buffer buffer (goto-char (point-min)) (re-search-forward "^[0-9]") @@ -338,22 +338,22 @@ (beginning-of-line) (if (looking-at vc-hg-annotate-re) (match-string-no-properties 1)))) -(defun vc-hg-previous-version (file rev) +(defun vc-hg-previous-revision (file rev) (let ((newrev (1- (string-to-number rev)))) (when (>= newrev 0) (number-to-string newrev)))) -(defun vc-hg-next-version (file rev) +(defun vc-hg-next-revision (file rev) (let ((newrev (1+ (string-to-number rev))) - (tip-version + (tip-revision (with-temp-buffer (vc-hg-command t 0 nil "tip") (goto-char (point-min)) (re-search-forward "^changeset:[ \t]*\\([0-9]+\\):") (string-to-number (match-string-no-properties 1))))) - ;; We don't want to exceed the maximum possible version number, ie - ;; the tip version. - (when (<= newrev tip-version) + ;; We don't want to exceed the maximum possible revision number, ie + ;; the tip revision. + (when (<= newrev tip-revision) (number-to-string newrev)))) ;; Modelled after the similar function in vc-bzr.el @@ -402,7 +402,7 @@ REV is ignored." (vc-hg-command nil 0 files "commit" "-m" comment)) -(defun vc-hg-find-version (file rev buffer) +(defun vc-hg-find-revision (file rev buffer) (let ((coding-system-for-read 'binary) (coding-system-for-write 'binary)) (if rev @@ -432,7 +432,7 @@ "Hg-specific version of `vc-dired-state-info'." (let ((hg-state (vc-state file))) (if (eq hg-state 'edited) - (if (equal (vc-workfile-version file) "0") + (if (equal (vc-working-revision file) "0") "(added)" "(modified)") ;; fall back to the default VC representation (vc-default-dired-state-info 'Hg file))))
--- a/lisp/vc-hooks.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/vc-hooks.el Sat Oct 13 05:53:03 2007 +0000 @@ -362,7 +362,8 @@ backend is tried first." (let (handler) (cond - ((string-match vc-ignore-dir-regexp (file-name-directory file)) nil) + ((and (file-name-directory file) (string-match vc-ignore-dir-regexp (file-name-directory file))) + nil) ((and (boundp 'file-name-handler-alist) (setq handler (find-file-name-handler file 'vc-registered))) ;; handler should set vc-backend and return t if registered @@ -492,7 +493,7 @@ prompt the user to do it)." ;; FIXME: New (sub)states needed (?): ;; - `added' (i.e. `edited' but with no base version yet, - ;; typically represented by vc-workfile-version = "0") + ;; typically represented by vc-working-revision = "0") ;; - `conflict' (i.e. `edited' with conflict markers) ;; - `removed' ;; - `copied' and `moved' (might be handled by `removed' and `added') @@ -548,13 +549,13 @@ (signal (car err) (cdr err)) (vc-call diff (list file))))))) -(defun vc-workfile-version (file) +(defun vc-working-revision (file) "Return the repository version from which FILE was checked out. If FILE is not registered, this function always returns nil." - (or (vc-file-getprop file 'vc-workfile-version) + (or (vc-file-getprop file 'vc-working-revision) (if (vc-backend file) - (vc-file-setprop file 'vc-workfile-version - (vc-call workfile-version file))))) + (vc-file-setprop file 'vc-working-revision + (vc-call working-revision file))))) (defun vc-default-registered (backend file) "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates." @@ -655,7 +656,7 @@ "\\.~.+" (unless manual "\\.") "~") (expand-file-name (concat (file-name-nondirectory file) ".~" (subst-char-in-string - ?/ ?_ (or rev (vc-workfile-version file))) + ?/ ?_ (or rev (vc-working-revision file))) (unless manual ".") "~") (file-name-directory file)))) @@ -789,7 +790,7 @@ (setq backend (symbol-name backend)) (let ((state (vc-state file)) (state-echo nil) - (rev (vc-workfile-version file))) + (rev (vc-working-revision file))) (propertize (cond ((or (eq state 'up-to-date) (eq state 'needs-patch)) @@ -924,7 +925,7 @@ (define-key map "v" 'vc-next-action) (define-key map "+" 'vc-update) (define-key map "=" 'vc-diff) - (define-key map "~" 'vc-version-other-window) + (define-key map "~" 'vc-revision-other-window) map)) (fset 'vc-prefix-map vc-prefix-map) (define-key global-map "\C-xv" 'vc-prefix-map) @@ -941,8 +942,8 @@ (define-key map [separator1] '("----")) (define-key map [vc-annotate] '("Annotate" . vc-annotate)) (define-key map [vc-rename-file] '("Rename File" . vc-rename-file)) - (define-key map [vc-version-other-window] - '("Show Other Version" . vc-version-other-window)) + (define-key map [vc-revision-other-window] + '("Show Other Version" . vc-revision-other-window)) (define-key map [vc-diff] '("Compare with Base Version" . vc-diff)) (define-key map [vc-update-change-log] '("Update ChangeLog" . vc-update-change-log)) @@ -984,7 +985,7 @@ ;;(put 'vc-rename-file 'menu-enable 'vc-mode) ;;(put 'vc-annotate 'menu-enable '(eq (vc-buffer-backend) 'CVS)) -;;(put 'vc-version-other-window 'menu-enable 'vc-mode) +;;(put 'vc-revision-other-window 'menu-enable 'vc-mode) ;;(put 'vc-diff 'menu-enable 'vc-mode) ;;(put 'vc-update-change-log 'menu-enable ;; '(member (vc-buffer-backend) '(RCS CVS)))
--- a/lisp/vc-mcvs.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/vc-mcvs.el Sat Oct 13 05:53:03 2007 +0000 @@ -196,8 +196,8 @@ (goto-char (point-max)) (widen))))))) -(defun vc-mcvs-workfile-version (file) - (vc-cvs-workfile-version +(defun vc-mcvs-working-revision (file) + (vc-cvs-working-revision (expand-file-name (vc-file-getprop file 'mcvs-inode) (vc-file-getprop file 'mcvs-root)))) @@ -253,7 +253,7 @@ (vc-switches 'MCVS 'register)) ;; I'm not sure exactly why, but if we don't setup the inode and root ;; prop of the file, things break later on in vc-mode-line that - ;; ends up calling vc-mcvs-workfile-version. + ;; ends up calling vc-mcvs-working-revision. ;; We also need to set vc-checkout-time so that vc-workfile-unchanged-p ;; doesn't try to call `mcvs diff' on the file. (vc-mcvs-registered file))) @@ -267,7 +267,7 @@ (defun vc-mcvs-checkin (files rev comment) "Meta-CVS-specific version of `vc-backend-checkin'." - (unless (or (not rev) (vc-mcvs-valid-version-number-p rev)) + (unless (or (not rev) (vc-mcvs-valid-revision-number-p rev)) (if (not (vc-mcvs-valid-symbolic-tag-name-p rev)) (error "%s is not a valid symbolic tag name" rev) ;; If the input revision is a valid symbolic tag name, we create it @@ -277,8 +277,8 @@ ;; be applied just to this one file. (apply 'vc-mcvs-command nil 0 files "tag" "-b" (list rev)) (apply 'vc-mcvs-command nil 0 files "update" "-r" (list rev)) - (mapcar (lambda (file) (vc-file-setprop file 'vc-mcvs-sticky-tag rev)) - files) + (mapc (lambda (file) (vc-file-setprop file 'vc-mcvs-sticky-tag rev)) + files) (setq rev nil))) ;; This commit might cvs-commit several files (e.g. MAP and TYPES) ;; so using numbered revs here is dangerous and somewhat meaningless. @@ -292,7 +292,7 @@ ;; Check checkin problem. (cond ((re-search-forward "Up-to-date check failed" nil t) - (mapcar (lambda (file) (vc-file-setprop file 'vc-state 'needs-merge)) + (mapc (lambda (file) (vc-file-setprop file 'vc-state 'needs-merge)) files) (error (substitute-command-keys (concat "Up-to-date check failed: " @@ -302,12 +302,12 @@ (goto-char (point-min)) (shrink-window-if-larger-than-buffer) (error "Check-in failed")))) - ;; Single-file commit? Then update the version by parsing the buffer. + ;; Single-file commit? Then update the revision by parsing the buffer. ;; Otherwise we can't necessarily tell what goes with what; clear ;; its properties so they have to be refetched. (if (= (length files) 1) (vc-file-setprop - (car files) 'vc-workfile-version + (car files) 'vc-working-revision (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) (mapc (lambda (file) (vc-file-clearprops file)) files)) ;; Anyway, forget the checkout model of the file, because we might have @@ -322,7 +322,7 @@ (if (and rev (not (vc-mcvs-valid-symbolic-tag-name-p rev))) (vc-mcvs-command nil 0 files "update" "-A")))) -(defun vc-mcvs-find-version (file rev buffer) +(defun vc-mcvs-find-revision (file rev buffer) (apply 'vc-mcvs-command buffer 0 file "-Q" ; suppress diagnostic output @@ -348,8 +348,8 @@ (vc-mcvs-command nil 0 file "edit") (set-file-modes file (logior (file-modes file) 128)) (if (equal file buffer-file-name) (toggle-read-only -1)))) - ;; Check out a particular version (or recreate the file). - (vc-file-setprop file 'vc-workfile-version nil) + ;; Check out a particular revision (or recreate the file). + (vc-file-setprop file 'vc-working-revision nil) (apply 'vc-mcvs-command nil 0 file (if editable "-w") "update" @@ -364,7 +364,7 @@ (vc-mcvs-command nil 0 new "move" (file-relative-name old))) (defun vc-mcvs-revert (file &optional contents-done) - "Revert FILE to the version it was based on." + "Revert FILE to the working revision it was based on." (vc-default-revert 'MCVS file contents-done) (unless (eq (vc-checkout-model file) 'implicit) (if vc-mcvs-use-edit @@ -372,13 +372,13 @@ ;; Make the file read-only by switching off all w-bits (set-file-modes file (logand (file-modes file) 3950))))) -(defun vc-mcvs-merge (file first-version &optional second-version) +(defun vc-mcvs-merge (file first-revision &optional second-revision) "Merge changes into current working copy of FILE. -The changes are between FIRST-VERSION and SECOND-VERSION." +The changes are between FIRST-REVISION and SECOND-REVISION." (vc-mcvs-command nil 0 file "update" "-kk" - (concat "-j" first-version) - (concat "-j" second-version)) + (concat "-j" first-revision) + (concat "-j" second-revision)) (vc-file-setprop file 'vc-state 'edited) (with-current-buffer (get-buffer "*vc*") (goto-char (point-min)) @@ -389,18 +389,18 @@ (defun vc-mcvs-merge-news (file) "Merge in any new changes made to FILE." (message "Merging changes into %s..." file) - ;; (vc-file-setprop file 'vc-workfile-version nil) + ;; (vc-file-setprop file 'vc-working-revision nil) (vc-file-setprop file 'vc-checkout-time 0) (vc-mcvs-command nil 0 file "update") ;; Analyze the merge result reported by Meta-CVS, and set ;; file properties accordingly. (with-current-buffer (get-buffer "*vc*") (goto-char (point-min)) - ;; get new workfile version + ;; get new working revision (if (re-search-forward "^Merging differences between [0-9.]* and \\([0-9.]*\\) into" nil t) - (vc-file-setprop file 'vc-workfile-version (match-string 1)) - (vc-file-setprop file 'vc-workfile-version nil)) + (vc-file-setprop file 'vc-working-revision (match-string 1)) + (vc-file-setprop file 'vc-working-revision nil)) ;; get file status (prog1 (if (eq (buffer-size) 0) @@ -447,7 +447,7 @@ files "log"))) (defun vc-mcvs-diff (files &optional oldvers newvers buffer) - "Get a difference report using Meta-CVS between two versions of FILES." + "Get a difference report using Meta-CVS between two revisions of FILES." (let* ((async (and (not vc-disable-async-diff) (vc-stay-local-p files) (fboundp 'start-process))) @@ -476,13 +476,13 @@ (and rev2 (concat "-r" rev2)) (vc-switches 'MCVS 'diff))))) -(defun vc-mcvs-annotate-command (file buffer &optional version) +(defun vc-mcvs-annotate-command (file buffer &optional revision) "Execute \"mcvs annotate\" on FILE, inserting the contents in BUFFER. -Optional arg VERSION is a version to annotate from." +Optional arg REVISION is a revision to annotate from." (vc-mcvs-command buffer (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0) - file "annotate" (if version (concat "-r" version))) + file "annotate" (if revision (concat "-r" revision))) (with-current-buffer buffer (goto-char (point-min)) (re-search-forward "^[0-9]") @@ -496,7 +496,7 @@ ;;; (defun vc-mcvs-create-snapshot (dir name branchp) - "Assign to DIR's current version a given NAME. + "Assign to DIR's current revision a given NAME. If BRANCHP is non-nil, the name is created as a branch (and the current workspace is immediately moved to that new branch)." (if (not branchp) @@ -528,13 +528,13 @@ ((or (string= state "U") (string= state "P")) (vc-file-setprop file 'vc-state 'up-to-date) - (vc-file-setprop file 'vc-workfile-version nil) + (vc-file-setprop file 'vc-working-revision nil) (vc-file-setprop file 'vc-checkout-time (nth 5 (file-attributes file)))) ((or (string= state "M") (string= state "C")) (vc-file-setprop file 'vc-state 'edited) - (vc-file-setprop file 'vc-workfile-version nil) + (vc-file-setprop file 'vc-working-revision nil) (vc-file-setprop file 'vc-checkout-time 0))) (vc-file-setprop file 'vc-mcvs-sticky-tag sticky-tag) (vc-resynch-buffer file t t)))) @@ -596,7 +596,7 @@ (forward-line 1)))) (defalias 'vc-mcvs-valid-symbolic-tag-name-p 'vc-cvs-valid-symbolic-tag-name-p) -(defalias 'vc-mcvs-valid-version-number-p 'vc-cvs-valid-version-number-p) +(defalias 'vc-mcvs-valid-revision-number-p 'vc-cvs-valid-revision-number-p) (provide 'vc-mcvs)
--- a/lisp/vc-mtn.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/vc-mtn.el Sat Oct 13 05:53:03 2007 +0000 @@ -81,7 +81,7 @@ 'edited 'up-to-date)))) -(defun vc-mtn-workfile-version (file) +(defun vc-mtn-working-revision (file) ;; If `mtn' fails or returns status>0, or if the search fails, just ;; return nil. (ignore-errors @@ -134,7 +134,7 @@ (defun vc-mtn-checkin (files rev comment) (vc-mtn-command nil 0 files "commit" "-m" comment)) -(defun vc-mtn-find-version (file rev buffer) +(defun vc-mtn-find-revision (file rev buffer) (vc-mtn-command buffer 0 file "cat" "-r" rev)) ;; (defun vc-mtn-checkout (file &optional editable rev) @@ -163,7 +163,7 @@ '(("^[ |]+Author: \\(.*\\)" (1 'change-log-email)) ("^[ |]+Date: \\(.*\\)" (1 'change-log-date-face)))))) -;; (defun vc-mtn-show-log-entry (version) +;; (defun vc-mtn-show-log-entry (revision) ;; ) (defun vc-mtn-wash-log (file))
--- a/lisp/vc-rcs.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/vc-rcs.el Sat Oct 13 05:53:03 2007 +0000 @@ -123,12 +123,12 @@ (and vc-consult-headers (vc-rcs-consult-headers file))) (let ((state - ;; vc-workfile-version might not be known; in that case the + ;; vc-working-revision might not be known; in that case the ;; property is nil. vc-rcs-fetch-master-state knows how to ;; handle that. (vc-rcs-fetch-master-state file (vc-file-getprop file - 'vc-workfile-version)))) + 'vc-working-revision)))) (if (not (eq state 'up-to-date)) state (if (vc-workfile-unchanged-p file) @@ -181,19 +181,19 @@ (vc-rcs-state file)))) (vc-rcs-state file))))) -(defun vc-rcs-workfile-version (file) - "RCS-specific version of `vc-workfile-version'." +(defun vc-rcs-working-revision (file) + "RCS-specific version of `vc-working-revision'." (or (and vc-consult-headers (vc-rcs-consult-headers file) - (vc-file-getprop file 'vc-workfile-version)) + (vc-file-getprop file 'vc-working-revision)) (progn (vc-rcs-fetch-master-state file) - (vc-file-getprop file 'vc-workfile-version)))) + (vc-file-getprop file 'vc-working-revision)))) (defun vc-rcs-latest-on-branch-p (file &optional version) "Return non-nil if workfile version of FILE is the latest on its branch. When VERSION is given, perform check for that version." - (unless version (setq version (vc-workfile-version file))) + (unless version (setq version (vc-working-revision file))) (with-temp-buffer (string= version (if (vc-trunk-p version) @@ -221,7 +221,7 @@ "RCS-specific implementation of `vc-workfile-unchanged-p'." ;; Try to use rcsdiff --brief. If rcsdiff does not understand that, ;; do a double take and remember the fact for the future - (let* ((version (concat "-r" (vc-workfile-version file))) + (let* ((version (concat "-r" (vc-working-revision file))) (status (if (eq vc-rcsdiff-knows-brief 'no) (vc-do-command nil 1 "rcsdiff" file version) (vc-do-command nil 2 "rcsdiff" file "--brief" version)))) @@ -292,7 +292,7 @@ (expand-file-name name (file-name-directory file)))))) - (vc-file-setprop file 'vc-workfile-version + (vc-file-setprop file 'vc-working-revision (if (re-search-forward "^initial revision: \\([0-9.]+\\).*\n" nil t) @@ -335,7 +335,7 @@ (let ((switches (vc-switches 'RCS 'checkin))) ;; Now operate on the files (dolist (file files) - (let ((old-version (vc-workfile-version file)) new-version + (let ((old-version (vc-working-revision file)) new-version (default-branch (vc-file-getprop file 'vc-rcs-default-branch))) ;; Force branch creation if an appropriate ;; default branch has been set. @@ -353,7 +353,7 @@ (concat (if vc-keep-workfiles "-u" "-r") rev) (concat "-m" comment) switches) - (vc-file-setprop file 'vc-workfile-version nil) + (vc-file-setprop file 'vc-working-revision nil) ;; determine the new workfile version (set-buffer "*vc*") @@ -363,7 +363,7 @@ (re-search-forward "reverting to previous revision \\([0-9.]+\\)" nil t)) (setq new-version (match-string 1)) - (vc-file-setprop file 'vc-workfile-version new-version)) + (vc-file-setprop file 'vc-working-revision new-version)) ;; if we got to a different branch, adjust the default ;; branch accordingly @@ -382,7 +382,7 @@ (vc-do-command nil 1 "rcs" (vc-name file) (concat "-u" old-version))))))))) -(defun vc-rcs-find-version (file rev buffer) +(defun vc-rcs-find-revision (file rev buffer) (apply 'vc-do-command buffer 0 "co" (vc-name file) "-q" ;; suppress diagnostic output @@ -421,7 +421,7 @@ (if (stringp rev) ;; a literal revision was specified (concat "-r" rev) - (let ((workrev (vc-workfile-version file))) + (let ((workrev (vc-working-revision file))) (if workrev (concat "-r" (if (not rev) @@ -441,7 +441,7 @@ (with-current-buffer "*vc*" (setq new-version (vc-parse-buffer "^revision \\([0-9.]+\\).*\n" 1))) - (vc-file-setprop file 'vc-workfile-version new-version) + (vc-file-setprop file 'vc-working-revision new-version) ;; if necessary, adjust the default branch (and rev (not (string= rev "")) (vc-rcs-set-default-branch @@ -457,7 +457,7 @@ (if (not files) (error "RCS backend doesn't support directory-level rollback.")) (dolist (file files) - (let* ((discard (vc-workfile-version file)) + (let* ((discard (vc-working-revision file)) (previous (if (vc-trunk-p discard) "" (vc-branch-part discard))) (config (current-window-configuration)) (done nil)) @@ -492,7 +492,7 @@ "Revert FILE to the version it was based on." (vc-do-command nil 0 "co" (vc-name file) "-f" (concat (if (eq (vc-state file) 'edited) "-u" "-r") - (vc-workfile-version file)))) + (vc-working-revision file)))) (defun vc-rcs-merge (file first-version &optional second-version) "Merge changes into current working copy of FILE. @@ -811,11 +811,11 @@ (or value (vc-branch-part branch)))) -(defun vc-rcs-fetch-master-state (file &optional workfile-version) +(defun vc-rcs-fetch-master-state (file &optional working-revision) "Compute the master file's idea of the state of FILE. If a WORKFILE-VERSION is given, compute the state of that version, otherwise determine the workfile version based on the master file. -This function sets the properties `vc-workfile-version' and +This function sets the properties `vc-working-revision' and `vc-checkout-model' to their correct values, based on the master file." (with-temp-buffer @@ -826,7 +826,7 @@ (let ((workfile-is-latest nil) (default-branch (vc-parse-buffer "^branch[ \t\n]+\\([^;]*\\);" 1))) (vc-file-setprop file 'vc-rcs-default-branch default-branch) - (unless workfile-version + (unless working-revision ;; Workfile version not known yet. Determine that first. It ;; is either the head of the trunk, the head of the default ;; branch, or the "default branch" itself, if that is a full @@ -834,19 +834,19 @@ (cond ;; no default branch ((or (not default-branch) (string= "" default-branch)) - (setq workfile-version + (setq working-revision (vc-parse-buffer "^head[ \t\n]+\\([^;]+\\);" 1)) (setq workfile-is-latest t)) ;; default branch is actually a revision ((string-match "^[0-9]+\\.[0-9]+\\(\\.[0-9]+\\.[0-9]+\\)*$" default-branch) - (setq workfile-version default-branch)) + (setq working-revision default-branch)) ;; else, search for the head of the default branch (t (vc-insert-file (vc-name file) "^desc") - (setq workfile-version + (setq working-revision (vc-rcs-find-most-recent-rev default-branch)) (setq workfile-is-latest t))) - (vc-file-setprop file 'vc-workfile-version workfile-version)) + (vc-file-setprop file 'vc-working-revision working-revision)) ;; Check strict locking (goto-char (point-min)) (vc-file-setprop file 'vc-checkout-model @@ -856,14 +856,14 @@ (goto-char (point-min)) (let ((locking-user (vc-parse-buffer (concat "^locks[ \t\n]+[^;]*[ \t\n]+\\([^:]+\\):" - (regexp-quote workfile-version) + (regexp-quote working-revision) "[^0-9.]") 1))) (cond ;; not locked ((not locking-user) (if (or workfile-is-latest - (vc-rcs-latest-on-branch-p file workfile-version)) + (vc-rcs-latest-on-branch-p file working-revision)) ;; workfile version is latest on branch 'up-to-date ;; workfile version is not latest on branch @@ -873,7 +873,7 @@ (string= locking-user (vc-user-login-name file))) (if (or (eq (vc-checkout-model file) 'locking) workfile-is-latest - (vc-rcs-latest-on-branch-p file workfile-version)) + (vc-rcs-latest-on-branch-p file working-revision)) 'edited ;; Locking is not used for the file, but the owner does ;; have a lock, and there is a higher version on the current @@ -954,7 +954,7 @@ ;; else: nothing found ;; ------------------- (t nil))) - (if status (vc-file-setprop file 'vc-workfile-version version)) + (if status (vc-file-setprop file 'vc-working-revision version)) (and (eq status 'rev-and-lock) (vc-file-setprop file 'vc-state (cond
--- a/lisp/vc-sccs.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/vc-sccs.el Sat Oct 13 05:53:03 2007 +0000 @@ -111,8 +111,8 @@ (with-temp-buffer (if (vc-insert-file (vc-sccs-lock-file file)) (let* ((locks (vc-sccs-parse-locks)) - (workfile-version (vc-workfile-version file)) - (locking-user (cdr (assoc workfile-version locks)))) + (working-revision (vc-working-revision file)) + (locking-user (cdr (assoc working-revision locks)))) (if (not locking-user) (if (vc-workfile-unchanged-p file) 'up-to-date @@ -145,13 +145,13 @@ (vc-sccs-state file)))) (vc-sccs-state file))) -(defun vc-sccs-workfile-version (file) - "SCCS-specific version of `vc-workfile-version'." +(defun vc-sccs-working-revision (file) + "SCCS-specific version of `vc-working-revision'." (with-temp-buffer - ;; The workfile version is always the latest version number. + ;; The working revision is always the latest revision number. ;; To find this number, search the entire delta table, ;; rather than just the first entry, because the - ;; first entry might be a deleted ("R") version. + ;; first entry might be a deleted ("R") revision. (vc-insert-file (vc-name file) "^\001e\n\001[^s]") (vc-parse-buffer "^\001d D \\([^ ]+\\)" 1))) @@ -163,7 +163,7 @@ "SCCS-specific implementation of `vc-workfile-unchanged-p'." (zerop (apply 'vc-do-command nil 1 "vcdiff" (vc-name file) (list "--brief" "-q" - (concat "-r" (vc-workfile-version file)))))) + (concat "-r" (vc-working-revision file)))))) ;;; @@ -219,7 +219,7 @@ (if vc-keep-workfiles (vc-do-command nil 0 "get" (vc-name file))))) -(defun vc-sccs-find-version (file rev buffer) +(defun vc-sccs-find-revision (file rev buffer) (apply 'vc-do-command buffer 0 "get" (vc-name file) "-s" ;; suppress diagnostic output @@ -230,7 +230,7 @@ (vc-switches 'SCCS 'checkout))) (defun vc-sccs-checkout (file &optional editable rev) - "Retrieve a copy of a saved version of SCCS controlled FILE. + "Retrieve a copy of a saved revision of SCCS controlled FILE. EDITABLE non-nil means that the file should be writable and locked. REV is the revision to check out." (let ((file-buffer (get-file-buffer file)) @@ -258,12 +258,12 @@ switches)))) (message "Checking out %s...done" file))) -(defun vc-sccs-cancel-version (files) +(defun vc-sccs-rollback (files) "Roll back, undoing the most recent checkins of FILES." (if (not files) (error "SCCS backend doesn't support directory-level rollback.")) (dolist (file files) - (let ((discard (vc-workfile-version file))) + (let ((discard (vc-working-revision file))) (if (null (yes-or-no-p (format "Remove version %s from %s history? " discard file))) (error "Aborted")) @@ -275,10 +275,10 @@ "Revert FILE to the version it was based on." (vc-do-command nil 0 "unget" (vc-name file)) (vc-do-command nil 0 "get" (vc-name file)) - ;; Checking out explicit versions is not supported under SCCS, yet. - ;; We always "revert" to the latest version; therefore - ;; vc-workfile-version is cleared here so that it gets recomputed. - (vc-file-setprop file 'vc-workfile-version nil)) + ;; Checking out explicit revisions is not supported under SCCS, yet. + ;; We always "revert" to the latest revision; therefore + ;; vc-working-revision is cleared here so that it gets recomputed. + (vc-file-setprop file 'vc-working-revision nil)) (defun vc-sccs-steal-lock (file &optional rev) "Steal the lock on the current workfile for FILE and revision REV." @@ -322,8 +322,8 @@ ;;; (defun vc-sccs-assign-name (file name) - "Assign to FILE's latest version a given NAME." - (vc-sccs-add-triple name file (vc-workfile-version file))) + "Assign to FILE's latest revision a given NAME." + (vc-sccs-add-triple name file (vc-working-revision file))) ;;; @@ -388,7 +388,7 @@ (defun vc-sccs-parse-locks () "Parse SCCS locks in current buffer. -The result is a list of the form ((VERSION . USER) (VERSION . USER) ...)." +The result is a list of the form ((REVISION . USER) (REVISION . USER) ...)." (let (master-locks) (goto-char (point-min)) (while (re-search-forward "^\\([0-9.]+\\) [0-9.]+ \\([^ ]+\\) .*\n?" @@ -409,8 +409,8 @@ (kill-buffer (current-buffer)))) (defun vc-sccs-lookup-triple (file name) - "Return the numeric version corresponding to a named snapshot of FILE. -If NAME is nil or a version number string it's just passed through." + "Return the numeric revision corresponding to a named snapshot of FILE. +If NAME is nil or a revision number string it's just passed through." (if (or (null name) (let ((firstchar (aref name 0))) (and (>= firstchar ?0) (<= firstchar ?9))))
--- a/lisp/vc-svn.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/vc-svn.el Sat Oct 13 05:53:03 2007 +0000 @@ -160,13 +160,13 @@ (vc-svn-command t 0 nil "status" (if localp "-v" "-u")) (vc-svn-parse-status)))) -(defun vc-svn-workfile-version (file) - "SVN-specific version of `vc-workfile-version'." +(defun vc-svn-working-revision (file) + "SVN-specific version of `vc-working-revision'." ;; There is no need to consult RCS headers under SVN, because we ;; get the workfile version for free when we recognize that a file ;; is registered in SVN. (vc-svn-registered file) - (vc-file-getprop file 'vc-workfile-version)) + (vc-file-getprop file 'vc-working-revision)) (defun vc-svn-checkout-model (file) "SVN-specific version of `vc-checkout-model'." @@ -180,25 +180,25 @@ "SVN-specific version of `vc-dired-state-info'." (let ((svn-state (vc-state file))) (cond ((eq svn-state 'edited) - (if (equal (vc-workfile-version file) "0") + (if (equal (vc-working-revision file) "0") "(added)" "(modified)")) ((eq svn-state 'needs-patch) "(patch)") ((eq svn-state 'needs-merge) "(merge)")))) -(defun vc-svn-previous-version (file rev) +(defun vc-svn-previous-revision (file rev) (let ((newrev (1- (string-to-number rev)))) (when (< 0 newrev) (number-to-string newrev)))) -(defun vc-svn-next-version (file rev) +(defun vc-svn-next-revision (file rev) (let ((newrev (1+ (string-to-number rev)))) - ;; The "workfile version" is an uneasy conceptual fit under Subversion; + ;; The "working revision" is an uneasy conceptual fit under Subversion; ;; we use it as the upper bound until a better idea comes along. If the ;; workfile version W coincides with the tree's latest revision R, then ;; this check prevents a "no such revision: R+1" error. Otherwise, it ;; inhibits showing of W+1 through R, which could be considered anywhere ;; from gracious to impolite. - (unless (< (string-to-number (vc-file-getprop file 'vc-workfile-version)) + (unless (< (string-to-number (vc-file-getprop file 'vc-working-revision)) newrev) (number-to-string newrev)))) @@ -256,11 +256,11 @@ (error "Check-in failed")))) ;; Update file properties ;; (vc-file-setprop - ;; file 'vc-workfile-version + ;; file 'vc-working-revision ;; (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) )) -(defun vc-svn-find-version (file rev buffer) +(defun vc-svn-find-revision (file rev buffer) "SVN-specific retrieval of a specified version into a buffer." (apply 'vc-svn-command buffer 0 file @@ -281,7 +281,7 @@ ;; If no revision was specified, there's nothing to do. nil ;; Check out a particular version (or recreate the file). - (vc-file-setprop file 'vc-workfile-version nil) + (vc-file-setprop file 'vc-working-revision nil) (apply 'vc-svn-command nil 0 file "update" ;; default for verbose checkout: clear the sticky tag so @@ -321,18 +321,18 @@ (defun vc-svn-merge-news (file) "Merge in any new changes made to FILE." (message "Merging changes into %s..." file) - ;; (vc-file-setprop file 'vc-workfile-version nil) + ;; (vc-file-setprop file 'vc-working-revision nil) (vc-file-setprop file 'vc-checkout-time 0) (vc-svn-command nil 0 file "update") ;; Analyze the merge result reported by SVN, and set ;; file properties accordingly. (with-current-buffer (get-buffer "*vc*") (goto-char (point-min)) - ;; get new workfile version + ;; get new working revision (if (re-search-forward "^\\(Updated to\\|At\\) revision \\([0-9]+\\)" nil t) - (vc-file-setprop file 'vc-workfile-version (match-string 2)) - (vc-file-setprop file 'vc-workfile-version nil)) + (vc-file-setprop file 'vc-working-revision (match-string 2)) + (vc-file-setprop file 'vc-working-revision nil)) ;; get file status (goto-char (point-min)) (prog1 @@ -393,7 +393,7 @@ buffer (if (and (= (length files) 1) (vc-stay-local-p (car files)) (fboundp 'start-process)) 'async 0) files "log" - ;; By default Subversion only shows the log upto the working version, + ;; By default Subversion only shows the log upto the working revision, ;; whereas we also want the log of the subsequent commits. At least ;; that's what the vc-cvs.el code does. "-rHEAD:0"))) @@ -404,11 +404,11 @@ nil) (defun vc-svn-diff (files &optional oldvers newvers buffer) - "Get a difference report using SVN between two versions of fileset FILES." + "Get a difference report using SVN between two revisions of fileset FILES." (and oldvers (catch 'no (dolist (f files) - (or (equal oldvers (vc-workfile-version f)) + (or (equal oldvers (vc-working-revision f)) (throw 'no nil))) t) ;; Use nil rather than the current revision because svn handles @@ -446,7 +446,7 @@ ;;; (defun vc-svn-create-snapshot (dir name branchp) - "Assign to DIR's current version a given NAME. + "Assign to DIR's current revision a given NAME. If BRANCHP is non-nil, the name is created as a branch (and the current workspace is immediately moved to that new branch). NAME is assumed to be a URL." @@ -566,7 +566,7 @@ (unless filename (vc-file-setprop file 'vc-backend 'SVN)) ;; Use the last-modified revision, so that searching in vc-print-log ;; output works. - (vc-file-setprop file 'vc-workfile-version (match-string 3)) + (vc-file-setprop file 'vc-working-revision (match-string 3)) ;; Remember Svn's own status. (vc-file-setprop file 'vc-svn-status status) (vc-file-setprop @@ -580,7 +580,7 @@ 'up-to-date)) ((eq status ?A) ;; If the file was actually copied, (match-string 2) is "-". - (vc-file-setprop file 'vc-workfile-version "0") + (vc-file-setprop file 'vc-working-revision "0") (vc-file-setprop file 'vc-checkout-time 0) 'edited) ((memq status '(?M ?C)) @@ -602,8 +602,8 @@ (and (string-match "^[a-zA-Z]" tag) (not (string-match "[^a-z0-9A-Z-_]" tag)))) -(defun vc-svn-valid-version-number-p (tag) - "Return non-nil if TAG is a valid version number." +(defun vc-svn-valid-revision-number-p (tag) + "Return non-nil if TAG is a valid revision number." (and (string-match "^[0-9]" tag) (not (string-match "[^0-9]" tag))))
--- a/lisp/vc.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/vc.el Sat Oct 13 05:53:03 2007 +0000 @@ -7,6 +7,8 @@ ;; Maintainer: Andre Spiegel <spiegel@gnu.org> ;; Keywords: tools +;; $Id$ + ;; This file is part of GNU Emacs. ;; GNU Emacs is free software; you can redistribute it and/or modify @@ -108,7 +110,7 @@ ;; VC keeps some per-file information in the form of properties (see ;; vc-file-set/getprop in vc-hooks.el). The backend-specific functions ;; do not generally need to be aware of these properties. For example, -;; `vc-sys-workfile-version' should compute the focus version and +;; `vc-sys-working-revision' should compute the working revision and ;; return it; it should not look it up in the property, and it needn't ;; store it there either. However, if a backend-specific function does ;; store a value in a property, that value takes precedence over any @@ -162,19 +164,19 @@ ;; anything, but rather store the files' states into the corresponding ;; `vc-state' properties. ;; -;; * workfile-version (file) +;; * working-revision (file) ;; -;; Return the current focus version of FILE. This is the version fetched +;; Return the working revision of FILE. This is the revision fetched ;; by the last checkout or upate, not necessarily the same thing as the -;; head or tip version. Should return "0" for a file added but not yet +;; head or tip revision. Should return "0" for a file added but not yet ;; committed. ;; ;; - latest-on-branch-p (file) ;; -;; Return non-nil if the focus version of FILE is the latest version -;; on its branch (many VCSes call this the 'tip' or 'head' version). +;; Return non-nil if the working revision of FILE is the latest revision +;; on its branch (many VCSes call this the 'tip' or 'head' revision). ;; The default implementation always returns t, which means that -;; working with non-current versions is not supported by default. +;; working with non-current revisions is not supported by default. ;; ;; * checkout-model (file) ;; @@ -183,13 +185,13 @@ ;; ;; - workfile-unchanged-p (file) ;; -;; Return non-nil if FILE is unchanged from the focus version. This -;; function should do a brief comparison of FILE's contents with -;; those of the repository version. If the backend does not have -;; such a brief-comparison feature, the default implementation of -;; this function can be used, which delegates to a full -;; vc-BACKEND-diff. (Note that vc-BACKEND-diff must not run -;; asynchronously in this case, see variable +;; Return non-nil if FILE is unchanged from the working revision. +;; This function should do a brief comparison of FILE's contents +;; with those of the repository master of the working revision. If +;; the backend does not have such a brief-comparison feature, the +;; default implementation of this function can be used, which +;; delegates to a full vc-BACKEND-diff. (Note that vc-BACKEND-diff +;; must not run asynchronously in this case, see variable ;; `vc-disable-async-diff'.) ;; ;; - mode-line-string (file) @@ -224,11 +226,11 @@ ;; to the backend command. (Note: in older versions of VC, this ;; command took a single file argument and not a list.) ;; -;; - init-version (file) +;; - init-revision (file) ;; -;; The initial version to use when registering FILE if one is not +;; The initial revision to use when registering FILE if one is not ;; specified by the user. If not provided, the variable -;; vc-default-init-version is used instead. +;; vc-default-init-revision is used instead. ;; ;; - responsible-p (file) ;; @@ -265,7 +267,7 @@ ;; the backend command. (Note: in older versions of VC, this ;; command took a single file argument and not a list.) ;; -;; * find-version (file rev buffer) +;; * find-revision (file rev buffer) ;; ;; Fetch revision REV of file FILE and put it into BUFFER. ;; If REV is the empty string, fetch the head of the trunk. @@ -277,7 +279,7 @@ ;; Check out revision REV of FILE into the working area. If EDITABLE ;; is non-nil, FILE should be writable by the user and if locking is ;; used for FILE, a lock should also be set. If REV is non-nil, that -;; is the revision to check out (default is the focus version). +;; is the revision to check out (default is the working revision). ;; If REV is t, that means to check out the head of the current branch; ;; if it is the empty string, check out the head of the trunk. ;; The implementation should pass the value of vc-checkout-switches @@ -285,15 +287,15 @@ ;; ;; * revert (file &optional contents-done) ;; -;; Revert FILE back to the current focus version. If optional +;; Revert FILE back to the working revision. If optional ;; arg CONTENTS-DONE is non-nil, then the contents of FILE have ;; already been reverted from a version backup, and this function ;; only needs to update the status of FILE within the backend. ;; ;; - rollback (files) ;; -;; Remove the tip version of each of FILES from the repository. If -;; this function is not provided, trying to cancel a version is +;; Remove the tip revision of each of FILES from the repository. If +;; this function is not provided, trying to cancel a revision is ;; caught as an error. (Most backends don't provide it.) (Also ;; note that older versions of this backend command were called ;; 'cancel-version' and took a single file arg, not a list of @@ -307,9 +309,9 @@ ;; ;; Merge recent changes from the current branch into FILE. ;; -;; - steal-lock (file &optional version) +;; - steal-lock (file &optional revision) ;; -;; Steal any lock on the focus version of FILE, or on VERSION if +;; Steal any lock on the working revision of FILE, or on REVISION if ;; that is provided. This function is only needed if locking is ;; used for files under this backend, and if files can indeed be ;; locked by other users. @@ -328,9 +330,9 @@ ;; `log-view-mode' and is expected to be changed (if at all) to a derived ;; mode of `log-view-mode'. ;; -;; - show-log-entry (version) +;; - show-log-entry (revision) ;; -;; If provided, search the log entry for VERSION in the current buffer, +;; If provided, search the log entry for REVISION in the current buffer, ;; and make sure it is displayed in the buffer's window. The default ;; implementation of this function works for RCS-style logs. ;; @@ -360,13 +362,13 @@ ;; default implementation runs rcs2log, which handles RCS- and ;; CVS-style logs. ;; -;; * diff (file &optional rev1 rev2 buffer) +;; * diff (files &optional rev1 rev2 buffer) ;; ;; Insert the diff for FILE into BUFFER, or the *vc-diff* buffer if ;; BUFFER is nil. If REV1 and REV2 are non-nil, report differences -;; from REV1 to REV2. If REV1 is nil, use the focus version (as -;; found in the repository) as the older version; if REV2 is nil, -;; use the current working-copy contents as the newer version. This +;; from REV1 to REV2. If REV1 is nil, use the working revision (as +;; found in the repository) as the older revision; if REV2 is nil, +;; use the current working-copy contents as the newer revision. This ;; function should pass the value of (vc-switches BACKEND 'diff) to ;; the backend command. It should return a status of either 0 (no ;; differences found), or 1 (either non-empty diff or the diff is @@ -387,7 +389,7 @@ ;; - annotate-command (file buf &optional rev) ;; ;; If this function is provided, it should produce an annotated display -;; of FILE in BUF, relative to version REV. Annotation means each line +;; of FILE in BUF, relative to revision REV. Annotation means each line ;; of FILE displayed is prefixed with version information associated with ;; its addition (deleted lines leave no history) and that the text of the ;; file is fontified according to age. @@ -435,7 +437,7 @@ ;; ;; - assign-name (file name) ;; -;; Give name NAME to the current version of FILE, assuming it is +;; Give name NAME to the working revision of FILE, assuming it is ;; up-to-date. Only used by the default version of `create-snapshot'. ;; ;; - retrieve-snapshot (dir name update) @@ -445,13 +447,13 @@ ;; snapshot that are currently visited. The default implementation ;; does a sanity check whether there aren't any uncommitted changes at ;; or below DIR, and then performs a tree walk, using the `checkout' -;; function to retrieve the corresponding versions. +;; function to retrieve the corresponding revisions. ;; ;; MISCELLANEOUS ;; ;; - make-version-backups-p (file) ;; -;; Return non-nil if unmodified repository versions of FILE should be +;; Return non-nil if unmodified repository revisions of FILE should be ;; backed up locally. If this is done, VC can perform `diff' and ;; `revert' operations itself, without calling the backend system. The ;; default implementation always returns nil. @@ -464,15 +466,15 @@ ;; This function is used in `vc-stay-local-p' which backends can use ;; for their convenience. ;; -;; - previous-version (file rev) +;; - previous-revision (file rev) ;; -;; Return the version number that precedes REV for FILE, or nil if no such -;; version exists. +;; Return the revision number that precedes REV for FILE, or nil if no such +;; revision exists. ;; -;; - next-version (file rev) +;; - next-revision (file rev) ;; -;; Return the version number that follows REV for FILE, or nil if no such -;; version exists. +;; Return the revision number that follows REV for FILE, or nil if no such +;; revision exists. ;; ;; - check-headers () ;; @@ -557,8 +559,8 @@ :type 'boolean :group 'vc) -(defcustom vc-default-init-version "1.1" - "A string used as the default version number when a new file is registered. +(defcustom vc-default-init-revision "1.1" + "A string used as the default revision number when a new file is registered. This can be overridden by giving a prefix argument to \\[vc-register]. This can also be overridden by a particular VC backend." :type 'string @@ -776,9 +778,9 @@ (define-key m "D" 'vc-annotate-show-diff-revision-at-line) (define-key m "J" 'vc-annotate-revision-at-line) (define-key m "L" 'vc-annotate-show-log-revision-at-line) - (define-key m "N" 'vc-annotate-next-version) - (define-key m "P" 'vc-annotate-prev-version) - (define-key m "W" 'vc-annotate-focus-version) + (define-key m "N" 'vc-annotate-next-revision) + (define-key m "P" 'vc-annotate-prev-revision) + (define-key m "W" 'vc-annotate-working-revision) m) "Local keymap used for VC-Annotate mode.") @@ -835,8 +837,8 @@ Backends that offer asynchronous diffs should respect this variable in their implementation of vc-BACKEND-diff.") -(defvar vc-log-file) -(defvar vc-log-version) +(defvar vc-log-fileset) +(defvar vc-log-revision) (defvar vc-dired-mode nil) (make-variable-buffer-local 'vc-dired-mode) @@ -848,20 +850,21 @@ (interactive) (fillarray vc-file-prop-obarray 0)) -(defmacro with-vc-properties (file form settings) - "Execute FORM, then maybe set per-file properties for FILE. +(defmacro with-vc-properties (files form settings) + "Execute FORM, then maybe set per-file properties for FILES. SETTINGS is an association list of property/value pairs. After executing FORM, set those properties from SETTINGS that have not yet been updated to their corresponding values." (declare (debug t)) `(let ((vc-touched-properties (list t))) ,form - (mapcar (lambda (setting) + (dolist (file ,files) + (mapc (lambda (setting) (let ((property (car setting))) (unless (memq property vc-touched-properties) - (put (intern ,file vc-file-prop-obarray) + (put (intern file vc-file-prop-obarray) property (cdr setting))))) - ,settings))) + ,settings)))) ;; Two macros for elisp programming @@ -885,7 +888,7 @@ (vc-checkout ,filevar t)))) (save-excursion ,@body) - (vc-checkin ,filevar nil ,comment)))) + (vc-checkin (list ,filevar) nil ,comment)))) ;;;###autoload (defmacro edit-vc-file (file comment &rest body) @@ -988,7 +991,7 @@ (defvar vc-post-command-functions nil "Hook run at the end of `vc-do-command'. Each function is called inside the buffer in which the command was run -and is passed 3 arguments: the COMMAND, the FILE and the FLAGS.") +and is passed 3 arguments: the COMMAND, the FILES and the FLAGS.") (defvar w32-quote-process-args) @@ -1016,10 +1019,17 @@ (let* ((files (mapcar (lambda (f) (file-relative-name (expand-file-name f))) (if (listp file-or-list) file-or-list (list file-or-list)))) - (full-command - (concat command " " (vc-delistify flags) " " (vc-delistify files)))) - (if vc-command-messages - (message "Running %s..." full-command)) + (full-command + ;; What we're doing here is preparing a version of the command + ;; for display in a debug-progess message. If it's fewer than + ;; 20 characters display the entire command (without trailing + ;; newline). Otherwise display the first 20 followed by an ellipsis. + (concat (if (string= (substring command -1) "\n") + (substring command 0 -1) + command) + " " + (vc-delistify (mapcar (lambda (s) (if (> (length s) 20) (concat (substring s 0 2) "...") s)) flags)) + " " (vc-delistify files)))) (save-current-buffer (unless (or (eq buffer t) (and (stringp buffer) @@ -1048,13 +1058,16 @@ (let ((process-connection-type nil)) (apply 'start-process command (current-buffer) command squeezed)))) - (unless (active-minibuffer-window) - (message "Running %s in the background..." full-command)) + (if vc-command-messages + (message "Running %s in background..." full-command)) ;;(set-process-sentinel proc (lambda (p msg) (delete-process p))) (set-process-filter proc 'vc-process-filter) (vc-exec-after - `(unless (active-minibuffer-window) - (message "Running %s in the background... done" ',full-command)))) + `(if vc-command-messages + (message "Running %s in background... done" ',full-command)))) + ;; Run synchrously + (if vc-command-messages + (message "Running %s in foreground..." full-command)) (let ((buffer-undo-list t)) (setq status (apply 'process-file command nil t nil squeezed))) (when (and (not (eq t okstatus)) @@ -1065,11 +1078,12 @@ (shrink-window-if-larger-than-buffer) (error "Running %s...FAILED (%s)" full-command (if (integerp status) (format "status %d" status) status)))) + ;; We're done (if vc-command-messages - (message "Running %s...OK" full-command))) + (message "Running %s...OK = %d" full-command status))) (vc-exec-after - `(run-hook-with-args 'vc-post-command-functions - ',command ',file-or-list ',flags)) + `(run-hook-with-args 'vc-post-command-functions + ',command ',file-or-list ',flags)) status)))) (defun vc-position-context (posn) @@ -1186,6 +1200,8 @@ (let ((new-mark (vc-find-position-by-context mark-context))) (if new-mark (set-mark new-mark)))))) +;;; Code for deducing what fileset and backend to assume + (defun vc-responsible-backend (file &optional register) "Return the name of a backend system that is responsible for FILE. The optional argument REGISTER means that a backend suitable for @@ -1234,6 +1250,49 @@ node (lambda (f) (if (vc-backend f) (push f flattened))))) (nreverse flattened))) +(defun vc-deduce-fileset (&optional allow-directory-wildcard) + "Deduce a set of files and a backend to apply an operation to. + +If we're in VC-dired-mode, the fileset is the list of marked +files. Otherwise, if we're looking at a buffer visiting a +version-controlled file. the fileset is a singleton containing +the relative filename, throw an error. + +If neither of these things is true, but allow-directory-wildcard is on, +select all files under version control at and below the current +directory. + +Otherwise, throw an error. +" + (cond (vc-dired-mode + (let ((regexp (dired-marker-regexp)) + (marked (dired-map-over-marks (dired-get-filename) nil))) + (unless marked + (error "No files have been selected.")) + ;; All members of the fileset must have the same backend + (let ((firstbackend (vc-backend (car marked)))) + (mapc (lambda (f) (unless (eq (vc-backend f) firstbackend) + (error "All members of a fileset must be under the same version-control system."))) + (cdr marked))) + marked)) + ((vc-backend buffer-file-name) + (list buffer-file-name)) + ((and vc-parent-buffer (buffer-file-name vc-parent-buffer)) + (progn + (set-buffer vc-parent-buffer) + (vc-deduce-fileset))) + ;; This is guarded by an enabling arg so users won't potentially + ;; shoot themselves in the foot by modifying a fileset they can't + ;; verify by eyeball. Allow it for nondestructive commands like + ;; making diffs, or possibly for destructive ones that have + ;; confirmation prompts. + (allow-directory-wildcard + (progn + (message "All version-controlled files below %s selected." + default-directory) + (list default-directory))) + (t (error "No fileset is available here.")))) + (defun vc-ensure-vc-buffer () "Make sure that the current buffer visits a version-controlled file." (if vc-dired-mode @@ -1255,7 +1314,7 @@ (defun vc-revert-buffer-internal (&optional arg no-confirm) "Revert buffer, keeping point and mark where user expects them. -Try to be clever in the face of changes due to expanded version control +Try to be clever in the face of changes due to expanded version-control key words. This is important for typeahead to work as expected. ARG and NO-CONFIRM are passed on to `revert-buffer'." (interactive "P") @@ -1287,192 +1346,170 @@ ;;;###autoload (defun vc-next-action (verbose) - "Do the next logical version control operation on the current file. - -If you call this from within a VC dired buffer with no files marked, -it will operate on the file in the current line. - -If you call this from within a VC dired buffer, and one or more -files are marked, it will accept a log message and then operate on -each one. The log message will be used as a comment for any register -or checkin operations, but ignored when doing checkouts. Attempted -lock steals will raise an error. + "Do the next logical version control operation on the current fileset. +This requires that all files in the fileset be in the same state. -A prefix argument lets you specify the version number to use. - -For RCS and SCCS files: - If the file is not already registered, this registers it for version +For locking systems: + If every file is not already registered, this registers each for version control. - If the file is registered and not locked by anyone, this checks out -a writable and locked file ready for editing. - If the file is checked out and locked by the calling user, this -first checks to see if the file has changed since checkout. If not, -it performs a revert. - If the file has been changed, this pops up a buffer for entry + If every file is registered and not locked by anyone, this checks out +a writable and locked file of each ready for editing. + If every file is checked out and locked by the calling user, this +first checks to see if each file has changed since checkout. If not, +it performs a revert on that file. + If every file has been changed, this pops up a buffer for entry of a log message; when the message has been entered, it checks in the resulting changes along with the log message as change commentary. If the variable `vc-keep-workfiles' is non-nil (which is its default), a -read-only copy of the changed file is left in place afterwards. - If the file is registered and locked by someone else, you are given -the option to steal the lock. +read-only copy of each changed file is left in place afterwards. + If the affected file is registered and locked by someone else, you are +given the option to steal the lock(s). -For CVS files: - If the file is not already registered, this registers it for version -control. This does a \"cvs add\", but no \"cvs commit\". - If the file is added but not committed, it is committed. - If your working file is changed, but the repository file is +For merging systems: + If every file is not already registered, this registers each one for version +control. This does an add, but not a commit. + If every file is added but not committed, each one is committed. + If every working file is changed, but the corresponding repository file is unchanged, this pops up a buffer for entry of a log message; when the message has been entered, it checks in the resulting changes along with the logmessage as change commentary. A writable file is retained. If the repository file is changed, you are asked if you want to merge in the changes into your working copy." (interactive "P") - (catch 'nogo - (if vc-dired-mode - (let ((files (dired-get-marked-files))) - (set (make-local-variable 'vc-dired-window-configuration) - (current-window-configuration)) - (if (string= "" - (mapconcat - (lambda (f) - (if (not (vc-up-to-date-p f)) "@" "")) - files "")) - (vc-next-action-dired nil nil "dummy") - (vc-start-entry nil nil nil nil - "Enter a change comment for the marked files." - 'vc-next-action-dired)) - (throw 'nogo nil))) - (while vc-parent-buffer - (pop-to-buffer vc-parent-buffer)) - (if buffer-file-name - (vc-next-action-on-file buffer-file-name verbose) - (error "Buffer %s is not associated with a file" (buffer-name))))) - -;; These functions help the vc-next-action entry point - -(defun vc-next-action-on-file (file verbose &optional comment) - "Do The Right Thing for a given FILE under version control. -If COMMENT is specified, it will be used as an admin or checkin comment. -If VERBOSE is non-nil, query the user rather than using default parameters." - (let ((visited (get-file-buffer file)) - state version) - (when visited - (if vc-dired-mode - (switch-to-buffer-other-window visited) - (set-buffer visited)) - ;; Check relation of buffer and file, and make sure - ;; user knows what he's doing. First, finding the file - ;; will check whether the file on disk is newer. - ;; Ignore buffer-read-only during this test, and - ;; preserve find-file-literally. - (let ((buffer-read-only (not (file-writable-p file)))) - (find-file-noselect file nil find-file-literally)) - (if (not (verify-visited-file-modtime (current-buffer))) - (if (yes-or-no-p "Replace file on disk with buffer contents? ") - (write-file buffer-file-name) - (error "Aborted")) - ;; Now, check if we have unsaved changes. - (vc-buffer-sync t) - (if (buffer-modified-p) - (or (y-or-n-p "Operate on disk file, keeping modified buffer? ") - (error "Aborted"))))) - + (let* ((files (vc-deduce-fileset)) + (backend (vc-backend (car files))) + (state (vc-state (car files))) + (model (vc-checkout-model (car files))) + revision) + ;; Verify that the fileset is homogenous + (dolist (file (cdr files)) + (if (not (eq (vc-state file) state)) + (error "Fileset is in a mixed-up state")) + (if (not (eq (vc-checkout-model file) model)) + (error "Fileset has mixed checkout models"))) + ;; Check for buffers in the fileset not matching the on-disk contents. + (dolist (file files) + (let ((visited (get-file-buffer file))) + (when visited + (if vc-dired-mode + (switch-to-buffer-other-window visited) + (set-buffer visited)) + ;; Check relation of buffer and file, and make sure + ;; user knows what he's doing. First, finding the file + ;; will check whether the file on disk is newer. + ;; Ignore buffer-read-only during this test, and + ;; preserve find-file-literally. + (let ((buffer-read-only (not (file-writable-p file)))) + (find-file-noselect file nil find-file-literally)) + (if (not (verify-visited-file-modtime (current-buffer))) + (if (yes-or-no-p (format "Replace %s on disk with buffer contents? " file)) + (write-file buffer-file-name) + (error "Aborted")) + ;; Now, check if we have unsaved changes. + (vc-buffer-sync t) + (if (buffer-modified-p) + (or (y-or-n-p (message "Use %s on disk, keeping modified buffer? " file)) + (error "Aborted"))))))) ;; Do the right thing - (if (not (vc-registered file)) - (vc-register verbose comment) - (vc-recompute-state file) - (if visited (vc-mode-line file)) - (setq state (vc-state file)) + (cond + ;; Files aren't registered + ((not state) + (mapc 'vc-register files)) + ;; Files are up-to-date, or need a merge and user specified a revision + ((or (eq state 'up-to-date) (and verbose (eq state 'needs-patch))) (cond - ;; up-to-date - ((or (eq state 'up-to-date) - (and verbose (eq state 'needs-patch))) - (cond - (verbose - ;; go to a different version - (setq version - (read-string "Branch, version, or backend to move to: ")) - (let ((vsym (intern-soft (upcase version)))) - (if (member vsym vc-handled-backends) - (vc-transfer-file file vsym) - (vc-checkout file (eq (vc-checkout-model file) 'implicit) - version)))) - ((not (eq (vc-checkout-model file) 'implicit)) - ;; check the file out - (vc-checkout file t)) - (t - ;; do nothing - (message "%s is up-to-date" file)))) - - ;; Abnormal: edited but read-only - ((and visited (eq state 'edited) - buffer-read-only (not (file-writable-p file))) - ;; Make the file+buffer read-write. If the user really wanted to - ;; commit, he'll get a chance to do that next time around, anyway. - (message "File is edited but read-only; making it writable") - (set-file-modes buffer-file-name - (logior (file-modes buffer-file-name) 128)) - (toggle-read-only -1)) - - ;; edited - ((eq state 'edited) - (cond - ;; For files with locking, if the file does not contain - ;; any changes, just let go of the lock, i.e. revert. - ((and (not (eq (vc-checkout-model file) 'implicit)) - (vc-workfile-unchanged-p file) - ;; If buffer is modified, that means the user just - ;; said no to saving it; in that case, don't revert, - ;; because the user might intend to save after - ;; finishing the log entry. - (not (and visited (buffer-modified-p)))) - ;; DO NOT revert the file without asking the user! - (if (not visited) (find-file-other-window file)) - (if (yes-or-no-p "Revert to master version? ") - (vc-revert))) - (t ;; normal action + (verbose + ;; go to a different revision + (setq revision (read-string "Branch, revision, or backend to move to: ")) + (let ((vsym (intern-soft (upcase revision)))) + (if (member vsym vc-handled-backends) + (mapc (lambda (file) (vc-transfer-file file vsym)) files) + (mapc (lambda (file) + (vc-checkout file (eq model 'implicit) revision)))))) + ((not (eq model 'implicit)) + ;; check the files out + (mapc (lambda (file) (vc-checkout file t)) files)) + (t + ;; do nothing + (message "Fileset is up-to-date")))) + ;; Files have local changes + ((eq state 'edited) + (let ((ready-for-commit files)) + ;; If files are edited but read-only, give user a chance to correct + (dolist (file files) + (if (not (file-writable-p file)) + (progn + ;; Make the file+buffer read-write. + (unless (y-or-n-p (format "%s is edited but read-only; make it writable and continue?" file)) + (error "Aborted")) + (set-file-modes file (logior (file-modes file) 128)) + (let ((visited (get-file-buffer file))) + (if visited + (save-excursion + (set-buffer visited) + (toggle-read-only -1))))))) + ;; Allow user to revert files with no changes + (save-excursion + (let ((revertlist '())) + (dolist (file files) + (let ((visited (get-file-buffer file))) + ;; For files with locking, if the file does not contain + ;; any changes, just let go of the lock, i.e. revert. + (if (and (not (eq model 'implicit)) + (vc-workfile-unchanged-p file) + ;; If buffer is modified, that means the user just + ;; said no to saving it; in that case, don't revert, + ;; because the user might intend to save after + ;; finishing the log entry and committing. + (not (and visited (buffer-modified-p)))) + (progn + (vc-revert-file file) + (delete file ready-for-commit))))))) + ;; Remaining files need to be committed + (if (not ready-for-commit) + (message "No files remain to be committed") (if (not verbose) - (vc-checkin file nil comment) - (setq version (read-string "New version or backend: ")) - (let ((vsym (intern (upcase version)))) - (if (member vsym vc-handled-backends) - (vc-transfer-file file vsym) - (vc-checkin file version comment))))))) - - ;; locked by somebody else - ((stringp state) - (if comment - (error "Sorry, you can't steal the lock on %s this way" - (file-name-nondirectory file))) - (vc-steal-lock file - (if verbose (read-string "Version to steal: ") - (vc-workfile-version file)) - state)) - - ;; needs-patch - ((eq state 'needs-patch) + (vc-checkin ready-for-commit) + (progn + (setq revision (read-string "New revision or backend: ")) + (let ((vsym (intern (upcase revision)))) + (if (member vsym vc-handled-backends) + (vc-transfer-file file vsym) + (vc-checkin ready-for-commit revision)))))))) + ;; locked by somebody else (locking VCSes only) + ((stringp state) + (let ((revision + (if verbose + (read-string "Revision to steal: ") + (vc-working-revision file)))) + (mapc (lambda (file) (vc-steal-lock file revision state) files)))) + ;; needs-patch + ((eq state 'needs-patch) + (dolist (file files) (if (yes-or-no-p (format - "%s is not up-to-date. Get latest version? " + "%s is not up-to-date. Get latest revision? " (file-name-nondirectory file))) - (vc-checkout file (eq (vc-checkout-model file) 'implicit) t) - (if (and (not (eq (vc-checkout-model file) 'implicit)) - (yes-or-no-p "Lock this version? ")) - (vc-checkout file t) - (error "Aborted")))) - - ;; needs-merge - ((eq state 'needs-merge) + (vc-checkout file (eq model 'implicit) t) + (if (and (not (eq model 'implicit)) + (yes-or-no-p "Lock this revision? ")) + (vc-checkout file t))))) + ;; needs-merge + ((eq state 'needs-merge) + (dolist (file files) (if (yes-or-no-p (format "%s is not up-to-date. Merge in changes now? " (file-name-nondirectory file))) - (vc-maybe-resolve-conflicts file (vc-call merge-news file)) - (error "Aborted"))) + (vc-maybe-resolve-conflicts file (vc-call merge-news file))))) - ;; unlocked-changes - ((eq state 'unlocked-changes) - (if (not visited) (find-file-other-window file)) + ;; unlocked-changes + ((eq state 'unlocked-changes) + (dolist (file files) + (if (not (equal buffer-file-name file)) + (find-file-other-window file)) (if (save-window-excursion - (vc-version-diff file (vc-workfile-version file) nil) + (vc-diff-internal + (vc-backend file) nil (list file) + (vc-working-revision file) nil) (goto-char (point-min)) (let ((inhibit-read-only t)) (insert @@ -1488,25 +1525,11 @@ (write-file buffer-file-name) (vc-mode-line file)) (if (not (yes-or-no-p - "Revert to checked-in version, instead? ")) + "Revert to checked-in revision, instead? ")) (error "Checkout aborted") (vc-revert-buffer-internal t t) (vc-checkout file t)))))))) -(defun vc-next-action-dired (file rev comment) - "Call `vc-next-action-on-file' on all the marked files. -Ignores FILE and REV, but passes on COMMENT." - (let ((dired-buffer (current-buffer))) - (dired-map-over-marks - (let ((file (dired-get-filename))) - (message "Processing %s..." file) - (vc-next-action-on-file file nil comment) - (set-buffer dired-buffer) - (set-window-configuration vc-dired-window-configuration) - (message "Processing %s...done" file)) - nil t)) - (dired-move-to-filename)) - (defun vc-create-repo (backend) "Create an empty repository in the current directory." (interactive @@ -1520,9 +1543,9 @@ (vc-call-backend backend 'create-repo)) ;;;###autoload -(defun vc-register (&optional set-version comment) +(defun vc-register (&optional set-revision comment) "Register the current file into a version control system. -With prefix argument SET-VERSION, allow user to specify initial version +With prefix argument SET-REVISION, allow user to specify initial revision level. If COMMENT is present, use that as an initial comment. The version control system to use is found by cycling through the list @@ -1546,26 +1569,34 @@ (set-buffer-modified-p t)) (vc-buffer-sync) - (vc-start-entry buffer-file-name - (if set-version - (read-string (format "Initial version level for %s: " + (vc-start-entry (list buffer-file-name) + (if set-revision + (read-string (format "Initial revision level for %s: " (buffer-name))) (vc-call-backend (vc-responsible-backend buffer-file-name) - 'init-version)) + 'init-revision)) (or comment (not vc-initial-comment)) nil "Enter initial comment." - (lambda (file rev comment) - (message "Registering %s... " file) - (let ((backend (vc-responsible-backend file t))) - (vc-file-clearprops file) - (vc-call-backend backend 'register (list file) rev comment) - (vc-file-setprop file 'vc-backend backend) - (unless vc-make-backup-files - (make-local-variable 'backup-inhibited) - (setq backup-inhibited t))) - (message "Registering %s... done" file)))) + (lambda (files rev comment) + (dolist (file files) + (message "Registering %s... " file) + (let ((backend (vc-responsible-backend file t))) + (vc-file-clearprops file) + (vc-call-backend backend 'register (list file) rev comment) + (vc-file-setprop file 'vc-backend backend) + (unless vc-make-backup-files + (make-local-variable 'backup-inhibited) + (setq backup-inhibited t))) + (message "Registering %s... done" file))))) +(defun vc-register-with (backend) + "Register the current file with a specified back end." + (interactive "SBackend: ") + (if (not (member backend vc-handled-backends)) + (error "Unknown back end.")) + (let ((vc-handled-backends (list backend))) + (call-interactively 'vc-register))) (defun vc-resynch-window (file &optional keep noquery) "If FILE is in the current buffer, either revert or unvisit it. @@ -1602,8 +1633,8 @@ (vc-resynch-window file keep noquery))))) (vc-dired-resynch-file file)) -(defun vc-start-entry (file rev comment initial-contents msg action &optional after-hook) - "Accept a comment for an operation on FILE revision REV. +(defun vc-start-entry (files rev comment initial-contents msg action &optional after-hook) + "Accept a comment for an operation on FILES revision REV. If COMMENT is nil, pop up a VC-log buffer, emit MSG, and set the action on close to ACTION. If COMMENT is a string and INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial @@ -1613,9 +1644,12 @@ empty comment. Remember the file's buffer in `vc-parent-buffer' \(current one if no file). AFTER-HOOK specifies the local value for vc-log-operation-hook." - (let ((parent (or (and file (get-file-buffer file)) (current-buffer)))) + (let ((parent + (if (and files (equal (length files) 1)) + (get-file-buffer (car files)) + (current-buffer)))) (if vc-before-checkin-hook - (if file + (if files (with-current-buffer parent (run-hooks 'vc-before-checkin-hook)) (run-hooks 'vc-before-checkin-hook))) @@ -1625,13 +1659,13 @@ (set (make-local-variable 'vc-parent-buffer) parent) (set (make-local-variable 'vc-parent-buffer-name) (concat " from " (buffer-name vc-parent-buffer))) - (if file (vc-mode-line file)) - (vc-log-edit file) + ;;(if file (vc-mode-line file)) + (vc-log-edit files) (make-local-variable 'vc-log-after-operation-hook) (if after-hook (setq vc-log-after-operation-hook after-hook)) (setq vc-log-operation action) - (setq vc-log-version rev) + (setq vc-log-revision rev) (when comment (erase-buffer) (when (stringp comment) (insert comment))) @@ -1651,7 +1685,7 @@ (vc-up-to-date-p file) (vc-make-version-backup file)) (with-vc-properties - file + (list file) (condition-case err (vc-call checkout file writable rev) (file-error @@ -1681,7 +1715,7 @@ (error "Steal canceled")) (message "Stealing lock on %s..." file) (with-vc-properties - file + (list file) (vc-call steal-lock file rev) `((vc-state . edited))) (vc-resynch-buffer file t t) @@ -1697,9 +1731,9 @@ ".\n") (message "Please explain why you stole the lock. Type C-c C-c when done."))) -(defun vc-checkin (file &optional rev comment initial-contents) - "Check in FILE. -The optional argument REV may be a string specifying the new version +(defun vc-checkin (files &optional rev comment initial-contents) + "Check in FILES. +The optional argument REV may be a string specifying the new revision level (if nil increment the current level). COMMENT is a comment string; if omitted, a buffer is popped up to accept a comment. If INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial contents @@ -1710,29 +1744,27 @@ Runs the normal hook `vc-checkin-hook'." (vc-start-entry - file rev comment initial-contents + files rev comment initial-contents "Enter a change comment." - (lambda (file rev comment) - (message "Checking in %s..." file) + (lambda (files rev comment) + (message "Checking in %s..." (vc-delistify files)) ;; "This log message intentionally left almost blank". ;; RCS 5.7 gripes about white-space-only comments too. (or (and comment (string-match "[^\t\n ]" comment)) (setq comment "*** empty log message ***")) (with-vc-properties - file - ;; Change buffers to get local value of vc-checkin-switches. - (with-current-buffer (or (get-file-buffer file) (current-buffer)) - (progn - (vc-call checkin (list file) rev comment) - (vc-delete-automatic-version-backups file))) + files + ;; We used to change buffers to get local value of vc-checkin-switches, + ;; but 'the' local buffer is not a well-defined concept for filesets. + (progn + (vc-call checkin files rev comment) + (mapc 'vc-delete-automatic-version-backups files)) `((vc-state . up-to-date) (vc-checkout-time . ,(nth 5 (file-attributes file))) - (vc-workfile-version . nil))) - (message "Checking in %s...done" file)) + (vc-working-revision . nil))) + (message "Checking in %s...done" (vc-delistify files))) 'vc-checkin-hook)) -;; Code for access to the comment ring - (defun vc-finish-logentry (&optional nocomment) "Complete the operation implied by the current log entry. Use the contents of the current buffer as a check-in or registration @@ -1742,7 +1774,7 @@ ;; Check and record the comment, if any. (unless nocomment ;; Comment too long? - (vc-call-backend (or (and vc-log-file (vc-backend vc-log-file)) + (vc-call-backend (or (and vc-log-fileset (vc-backend (car vc-log-fileset))) (vc-responsible-backend default-directory)) 'logentry-check) (run-hooks 'vc-logentry-check-hook)) @@ -1754,8 +1786,8 @@ (error "No log operation is pending")) ;; save the parameters held in buffer-local variables (let ((log-operation vc-log-operation) - (log-file vc-log-file) - (log-version vc-log-version) + (log-fileset vc-log-fileset) + (log-revision vc-log-revision) (log-entry (buffer-string)) (after-hook vc-log-after-operation-hook) (tmp-vc-parent-buffer vc-parent-buffer)) @@ -1763,8 +1795,8 @@ ;; OK, do it to it (save-excursion (funcall log-operation - log-file - log-version + log-fileset + log-revision log-entry)) ;; Remove checkin window (after the checkin so that if that fails ;; we don't zap the *VC-log* buffer and the typing therein). @@ -1777,8 +1809,10 @@ (bury-buffer) (pop-to-buffer tmp-vc-parent-buffer)))) ;; Now make sure we see the expanded headers - (if log-file - (vc-resynch-buffer log-file vc-keep-workfiles t)) + (if log-fileset + (mapc + (lambda (file) (vc-resynch-buffer file vc-keep-workfiles t)) + log-fileset)) (if vc-dired-mode (dired-move-to-filename)) (run-hooks after-hook 'vc-finish-logentry-hook))) @@ -1787,7 +1821,7 @@ (defun vc-default-diff-tree (backend dir rev1 rev2) "List differences for all registered files at and below DIR. -The meaning of REV1 and REV2 is the same as for `vc-version-diff'." +The meaning of REV1 and REV2 is the same as for `vc-revision-diff'." ;; This implementation does an explicit tree walk, and calls ;; vc-BACKEND-diff directly for each file. An optimization ;; would be to use `vc-diff-internal', so that diffs can be local, @@ -1838,192 +1872,182 @@ (defmacro vc-diff-switches-list (backend) `(vc-switches ',backend 'diff)) (make-obsolete 'vc-diff-switches-list 'vc-switches "22.1") -(defun vc-diff-internal (file rev1 rev2) - "Run diff to compare FILE's revisions REV1 and REV2. -Diff output goes to the *vc-diff* buffer. The exit status of the diff -command is returned. +(defun vc-diff-sentinel (verbose rev1-name rev2-name) + ;; Did changes get generated into the buffer? + (if (not (zerop (buffer-size (get-buffer "*vc-diff*")))) + (progn + (pop-to-buffer "*vc-diff*") + ;; Gnus-5.8.5 sets up an autoload for diff-mode, even if it's + ;; not available. Work around that. + (if (require 'diff-mode nil t) (diff-mode)) + (when verbose + (let (buffer-read-only) + (goto-char (point-max)) + (insert (format "\n\nDiffs between %s and %s end here." rev1-name rev2-name)) + (goto-char (point-min)) + (insert (format "Diffs between %s and %s:\n\n" rev1-name rev2-name)))) + (shrink-window-if-larger-than-buffer) + t) + (progn + (message "No changes between %s and %s" rev1-name rev2-name) + nil))) -This function takes care to set up a proper coding system for diff output. -If both revisions are available as local files, then it also does not -actually call the backend, but performs a local diff." - (if (or (not rev1) (string-equal rev1 "")) - (setq rev1 (vc-workfile-version file))) - (if (string-equal rev2 "") - (setq rev2 nil)) - (let ((file-rev1 (vc-version-backup-file file rev1)) - (file-rev2 (if (not rev2) - file - (vc-version-backup-file file rev2))) - (coding-system-for-read (vc-coding-system-for-diff file))) - (if (and file-rev1 file-rev2) - (let ((status - (if (eq vc-diff-knows-L 'no) - (apply 'vc-do-command "*vc-diff*" 1 "diff" nil - (append (vc-switches nil 'diff) - (list (file-relative-name file-rev1) - (file-relative-name file-rev2)))) - (apply 'vc-do-command "*vc-diff*" 2 "diff" nil - (append (vc-switches nil 'diff) - ;; Provide explicit labels like RCS or - ;; CVS would do so diff-mode refers to - ;; `file' rather than to `file-rev1' - ;; when trying to find/apply/undo - ;; hunks. - (list "-L" (vc-diff-label file file-rev1 rev1) - "-L" (vc-diff-label file file-rev2 rev2) - (file-relative-name file-rev1) - (file-relative-name file-rev2))))))) - (if (eq status 2) - (if (not vc-diff-knows-L) - (setq vc-diff-knows-L 'no - status (apply 'vc-do-command "*vc-diff*" 1 "diff" nil - (append - (vc-switches nil 'diff) - (list (file-relative-name file-rev1) - (file-relative-name file-rev2))))) - (error "diff failed")) - (if (not vc-diff-knows-L) (setq vc-diff-knows-L 'yes))) - status) - (vc-call diff (list file) rev1 rev2 "*vc-diff*")))) +(defun vc-diff-internal (backend async files rev1 rev2 &optional verbose) + "Report diffs between two revisions of a fileset. +Diff output goes to the *vc-diff* buffer. The function +returns t if the buffer had changes, nil otherwise." + (let* ((filenames (vc-delistify files)) + (rev1-name (or rev1 "working revision")) + (rev2-name (or rev2 "workfile")) + ;; Set coding system based on the first file. It's a kluge, + ;; but the only way to set it for each file included would + ;; be to call the back end separately for each file. + (coding-system-for-read + (if files (vc-coding-system-for-diff (car files)) 'undecided))) + (vc-setup-buffer "*vc-diff*") + (message "Finding changes in %s..." filenames) + ;; Many backends don't handle well the case of a file that has been + ;; added but not yet committed to the repo (notably CVS and Subversion). + ;; Do that work here so the backends don't have to futz with it. + (let ((filtered '())) + (dolist (file files) + (cond ((and (not (file-directory-p file)) (string= (vc-working-revision file) "0")) + (progn + ;; This file is added but not yet committed; + ;; there is no master file to diff against. + (if (or rev1 rev2) + (error "No revisions of %s exist" file) + ;; We regard this as "changed". + ;; Diff it against /dev/null. + (apply 'vc-do-command "*vc-diff*" + 1 "diff" file + (append (vc-switches nil 'diff) '("/dev/null")))))) + (t + (add-to-list 'filtered file t)))) + (let ((vc-disable-async-diff (not async))) + (vc-call-backend backend 'diff filtered rev1 rev2 "*vc-diff*"))) + (set-buffer "*vc-diff*") + ;; This odd-looking code is because in the non-async case we + ;; actually want to pass the return value from vc-diff-sentinel + ;; back to the caller. + (if async + (vc-exec-after `(vc-diff-sentinel ,verbose ,rev1-name ,rev2-name)) + (vc-diff-sentinel verbose rev1-name rev2-name)))) ;;;###autoload -(defun vc-diff (historic &optional not-urgent) - "Display diffs between file versions. -Normally this compares the current file and buffer with the most -recent checked in version of that file. This uses no arguments. With -a prefix argument HISTORIC, it reads the file name to use and two -version designators specifying which versions to compare. The -optional argument NOT-URGENT non-nil means it is ok to say no to -saving the buffer." - (interactive (list current-prefix-arg t)) - (if historic - (call-interactively 'vc-version-diff) - (vc-ensure-vc-buffer) - (let ((file buffer-file-name)) - (vc-buffer-sync not-urgent) - (if (vc-workfile-unchanged-p buffer-file-name) - (message "No changes to %s since latest version" file) - (vc-version-diff file nil nil))))) - -(defun vc-version-diff (file rev1 rev2) - "List the differences between FILE's versions REV1 and REV2. -If REV1 is empty or nil it means to use the focus version; -REV2 empty or nil means the working-copy contents. FILE may also be -a directory, in that case, generate diffs between the correponding -versions of all registered files in or below it." +(defun vc-history-diff (backend files rev1 rev2) + "Report diffs between revisions of the fileset in the repository history." (interactive - (let* ((file (expand-file-name - (read-file-name (if buffer-file-name - "File or dir to diff (default visited file): " - "File or dir to diff: ") - default-directory buffer-file-name t))) - (rev1-default nil) (rev2-default nil) - (completion-table (vc-call revision-completion-table file))) - ;; compute default versions based on the file state + (let* ((files (vc-deduce-fileset t)) + (first (car files)) + (backend (vc-backend first)) + (completion-table + (vc-call-backend backend 'revision-completion-table first)) + (rev1-default nil) + (rev2-default nil)) (cond - ;; if it's a directory, don't supply any version default - ((file-directory-p file) + ;; someday we may be able to do revision completion on non-singleton + ;; filesets, but not yet. + ((/= (length files) 1) + nil) + ;; if it's a directory, don't supply any revision default + ((file-directory-p first) nil) - ;; if the file is not up-to-date, use current version as older version - ((not (vc-up-to-date-p file)) - (setq rev1-default (vc-workfile-version file))) - ;; if the file is not locked, use last and previous version as default + ;; if the file is not up-to-date, use working revision as older revision + ((not (vc-up-to-date-p first)) + (setq rev1-default (vc-working-revision first))) + ;; if the file is not locked, use last and previous revisions as defaults (t - (setq rev1-default (vc-call previous-version file - (vc-workfile-version file))) + (setq rev1-default (vc-call previous-revision first + (vc-working-revision first))) (if (string= rev1-default "") (setq rev1-default nil)) - (setq rev2-default (vc-workfile-version file)))) + (setq rev2-default (vc-working-revision first)))) ;; construct argument list (let* ((rev1-prompt (if rev1-default - (concat "Older version (default " + (concat "Older revision (default " rev1-default "): ") - "Older version: ")) - (rev2-prompt (concat "Newer version (default " + "Older revision: ")) + (rev2-prompt (concat "Newer revision (default " (or rev2-default "current source") "): ")) (rev1 (if completion-table (completing-read rev1-prompt completion-table - nil nil nil nil rev1-default) + nil nil nil nil rev1-default) (read-string rev1-prompt nil nil rev1-default))) (rev2 (if completion-table (completing-read rev2-prompt completion-table - nil nil nil nil rev2-default) + nil nil nil nil rev2-default) (read-string rev2-prompt nil nil rev2-default)))) - (list file rev1 rev2)))) - (if (file-directory-p file) - ;; recursive directory diff - (progn - (vc-setup-buffer "*vc-diff*") - (if (string-equal rev1 "") (setq rev1 nil)) - (if (string-equal rev2 "") (setq rev2 nil)) - (let ((inhibit-read-only t)) - (insert "Diffs between " - (or rev1 "last version checked in") - " and " - (or rev2 "working copy") - ":\n\n")) - (let ((dir (file-name-as-directory file))) - (vc-call-backend (vc-responsible-backend dir) - 'diff-tree dir rev1 rev2)) - (vc-exec-after `(let ((inhibit-read-only t)) - (insert "\nEnd of diffs.\n")))) - ;; Single file diff. It is important that the vc-controlled buffer - ;; is still current at this time, because any local settings in that - ;; buffer should affect the diff command. - (vc-diff-internal file rev1 rev2)) - (set-buffer "*vc-diff*") - (if (and (zerop (buffer-size)) - (not (get-buffer-process (current-buffer)))) - (progn - (if rev1 - (if rev2 - (message "No changes to %s between %s and %s" file rev1 rev2) - (message "No changes to %s since %s" file rev1)) - (message "No changes to %s since latest version" file)) - nil) - (pop-to-buffer (current-buffer)) - ;; Gnus-5.8.5 sets up an autoload for diff-mode, even if it's - ;; not available. Work around that. - (if (require 'diff-mode nil t) (diff-mode)) - (vc-exec-after '(let ((inhibit-read-only t)) - (if (eq (buffer-size) 0) - (insert "No differences found.\n")) - (goto-char (point-min)) - (shrink-window-if-larger-than-buffer))) - t)) + (if (string= rev1 "") (setq rev1 nil)) + (if (string= rev2 "") (setq rev2 nil)) + (list backend files rev1 rev2)))) + (if (and (not rev1) rev2) + (error "Not a valid revision range.")) + (vc-diff-internal backend t files rev1 rev2 (interactive-p))) -(defun vc-diff-label (file file-rev rev) - (concat (file-relative-name file) - (format-time-string "\t%d %b %Y %T %z\t" - (nth 5 (file-attributes file-rev))) - rev)) +(defun vc-contains-version-controlled-file (dir) + "Return t if DIR contains a version-controlled file, nil otherwise." + (catch 'found + (mapc (lambda (f) (and (not (file-directory-p f)) (vc-backend f) (throw 'found 't))) (directory-files dir)) + nil)) ;;;###autoload -(defun vc-version-other-window (rev) - "Visit version REV of the current file in another window. -If the current file is named `F', the version is named `F.~REV~'. +(defun vc-diff (historic) + "Display diffs between file revisions. +Normally this compares the currently selected fileset with their +working revisions. With a prefix argument HISTORIC, it reads two revision +designators specifying which revisions to compare. + +If no current fileset is available (that is, we are not in +VC-Dired mode and the visited file of the current buffer is not +under version control) behave specially; if there are +version-controlled files in the current directory, treat all +version-controlled files recursively beneath the current +directory as the selected fileset. +" + + (interactive "P") + (cond + ;;((not (vc-contains-version-controlled-file default-directory)) + ;;(error "No version-controlled files directly beneath default directory")) + (historic + (call-interactively 'vc-history-diff)) + (t + (let* ((files (vc-deduce-fileset t)) + (first (car files)) + (backend + (cond ((file-directory-p first) + (vc-responsible-backend first)) + (t + (vc-backend first))))) + (vc-diff-internal backend t files nil nil (interactive-p)))))) + +;;;###autoload +(defun vc-revision-other-window (rev) + "Visit revision REV of the current file in another window. +If the current file is named `F', the revision is named `F.~REV~'. If `F.~REV~' already exists, use it instead of checking it out again." (interactive (save-current-buffer (vc-ensure-vc-buffer) (let ((completion-table (vc-call revision-completion-table buffer-file-name)) - (prompt "Version to visit (default is focus version): ")) + (prompt "Revision to visit (default is working revision): ")) (list (if completion-table (completing-read prompt completion-table) (read-string prompt)))))) (vc-ensure-vc-buffer) (let* ((file buffer-file-name) - (version (if (string-equal rev "") - (vc-workfile-version file) + (revision (if (string-equal rev "") + (vc-working-revision file) rev))) - (switch-to-buffer-other-window (vc-find-version file version)))) + (switch-to-buffer-other-window (vc-find-revision file revision)))) -(defun vc-find-version (file version) - "Read VERSION of FILE into a buffer and return the buffer." - (let ((automatic-backup (vc-version-backup-file-name file version)) +(defun vc-find-revision (file revision) + "Read REVISION of FILE into a buffer and return the buffer." + (let ((automatic-backup (vc-version-backup-file-name file revision)) (filebuf (or (get-file-buffer file) (current-buffer))) - (filename (vc-version-backup-file-name file version 'manual))) + (filename (vc-version-backup-file-name file revision 'manual))) (unless (file-exists-p filename) (if (file-exists-p automatic-backup) (rename-file automatic-backup filename nil) @@ -2038,7 +2062,7 @@ ;; Change buffer to get local value of ;; vc-checkout-switches. (with-current-buffer filebuf - (vc-call find-version file version outbuf)))) + (vc-call find-revision file revision outbuf)))) (setq failed nil)) (if (and failed (file-exists-p filename)) (delete-file filename)))) @@ -2095,10 +2119,10 @@ ;;;###autoload (defun vc-merge () - "Merge changes between two versions into the current buffer's file. -This asks for two versions to merge from in the minibuffer. If the -first version is a branch number, then merge all changes from that -branch. If the first version is empty, merge news, i.e. recent changes + "Merge changes between two revisions into the current buffer's file. +This asks for two revisions to merge from in the minibuffer. If the +first revision is a branch number, then merge all changes from that +branch. If the first revision is empty, merge news, i.e. recent changes from the current branch. See Info node `Merging'." @@ -2108,7 +2132,7 @@ (let* ((file buffer-file-name) (backend (vc-backend file)) (state (vc-state file)) - first-version second-version status) + first-revision second-revision status) (cond ((stringp state) ;; Locking VCses only (error "File is locked by %s" state)) @@ -2117,25 +2141,25 @@ "File must be checked out for merging. Check out now? ") (vc-checkout file t) (error "Merge aborted")))) - (setq first-version - (read-string (concat "Branch or version to merge from " + (setq first-revision + (read-string (concat "Branch or revision to merge from " "(default news on current branch): "))) - (if (string= first-version "") + (if (string= first-revision "") (if (not (vc-find-backend-function backend 'merge-news)) (error "Sorry, merging news is not implemented for %s" backend) (setq status (vc-call merge-news file))) (if (not (vc-find-backend-function backend 'merge)) (error "Sorry, merging is not implemented for %s" backend) - (if (not (vc-branch-p first-version)) - (setq second-version - (read-string "Second version: " - (concat (vc-branch-part first-version) "."))) - ;; We want to merge an entire branch. Set versions + (if (not (vc-branch-p first-revision)) + (setq second-revision + (read-string "Second revision: " + (concat (vc-branch-part first-revision) "."))) + ;; We want to merge an entire branch. Set revisions ;; accordingly, so that vc-BACKEND-merge understands us. - (setq second-version first-version) - ;; first-version must be the starting point of the branch - (setq first-version (vc-branch-part first-version))) - (setq status (vc-call merge file first-version second-version)))) + (setq second-revision first-revision) + ;; first-revision must be the starting point of the branch + (setq first-revision (vc-branch-part first-revision))) + (setq status (vc-call merge file first-revision second-revision)))) (vc-maybe-resolve-conflicts file status "WORKFILE" "MERGE SOURCE"))) (defun vc-maybe-resolve-conflicts (file status &optional name-A name-B) @@ -2417,10 +2441,10 @@ ;;;###autoload (defun vc-create-snapshot (dir name branchp) "Descending recursively from DIR, make a snapshot called NAME. -For each registered file, the version level of its latest version -becomes part of the named configuration. If the prefix argument -BRANCHP is given, the snapshot is made as a new branch and the files -are checked out in that new branch." +For each registered file, the working revision becomes part of +the named configuration. If the prefix argument BRANCHP is +given, the snapshot is made as a new branch and the files are +checked out in that new branch." (interactive (list (read-file-name "Directory: " default-directory default-directory t) (read-string "New snapshot name: ") @@ -2434,13 +2458,13 @@ ;;;###autoload (defun vc-retrieve-snapshot (dir name) "Descending recursively from DIR, retrieve the snapshot called NAME. -If NAME is empty, it refers to the latest versions. +If NAME is empty, it refers to the latest revisions. If locking is used for the files in DIR, then there must not be any locked files at or below DIR (but if NAME is empty, locked files are allowed and simply skipped)." (interactive (list (read-file-name "Directory: " default-directory default-directory t) - (read-string "Snapshot name to retrieve (default latest versions): "))) + (read-string "Snapshot name to retrieve (default latest revisions): "))) (let ((update (yes-or-no-p "Update any affected buffers? ")) (msg (if (or (not name) (string= name "")) (format "Updating %s... " (abbreviate-file-name dir)) @@ -2454,37 +2478,21 @@ ;; Miscellaneous other entry points ;;;###autoload -(defun vc-print-log (&optional focus-rev) - "List the change log of the current buffer in a window. -If FOCUS-REV is non-nil, leave the point at that revision." +(defun vc-print-log (&optional working-revision) + "List the change log of the current fileset in a window. +If WORKING-REVISION is non-nil, leave the point at that revision." (interactive) - (vc-ensure-vc-buffer) - (let ((file buffer-file-name)) - (or focus-rev (setq focus-rev (vc-workfile-version file))) + (let* ((files (vc-deduce-fileset)) + (backend (vc-backend (car files))) + (working-revision (or working-revision (vc-working-revision (car files))))) ;; Don't switch to the output buffer before running the command, ;; so that any buffer-local settings in the vc-controlled ;; buffer can be accessed by the command. - (condition-case err - (progn - (vc-call print-log (list file) "*vc-change-log*") - (set-buffer "*vc-change-log*")) - (wrong-number-of-arguments - ;; If this error came from the above call to print-log, try again - ;; without the optional buffer argument (for backward compatibility). - ;; Otherwise, resignal. - (if (or (not (eq (cadr err) - (indirect-function - (vc-find-backend-function (vc-backend file) - 'print-log)))) - (not (eq (caddr err) 2))) - (signal (car err) (cdr err)) - ;; for backward compatibility - (vc-call print-log (list file)) - (set-buffer "*vc*")))) - (pop-to-buffer (current-buffer)) + (vc-call-backend backend 'print-log files "*vc-change-log*") + (pop-to-buffer "*vc-change-log*") (vc-exec-after `(let ((inhibit-read-only t)) - (vc-call-backend ',(vc-backend file) 'log-view-mode) + (vc-call-backend ',backend 'log-view-mode) (goto-char (point-max)) (forward-line -1) (while (looking-at "=*\n") (delete-char (- (match-end 0) (match-beginning 0))) @@ -2492,139 +2500,129 @@ (goto-char (point-min)) (if (looking-at "[\b\t\n\v\f\r ]+") (delete-char (- (match-end 0) (match-beginning 0)))) - ;; (shrink-window-if-larger-than-buffer) - ;; move point to the log entry for the current version - (vc-call-backend ',(vc-backend file) - 'show-log-entry - ',focus-rev) + (shrink-window-if-larger-than-buffer) + ;; move point to the log entry for the working revision + (vc-call-backend ',backend 'show-log-entry ',working-revision) (setq vc-sentinel-movepoint (point)) (set-buffer-modified-p nil))))) ;;;###autoload (defun vc-revert () - "Revert the current buffer's file to the version it was based on. + "Revert working copies of the selected fileset to their repository contents. This asks for confirmation if the buffer contents are not identical -to that version. This function does not automatically pick up newer -changes found in the master file; use \\[universal-argument] \\[vc-next-action] to do so." +to the working revision (except for keyword expansion)." (interactive) - (vc-ensure-vc-buffer) - ;; Make sure buffer is saved. If the user says `no', abort since - ;; we cannot show the changes and ask for confirmation to discard them. - (vc-buffer-sync nil) - (let ((file buffer-file-name) - ;; This operation should always ask for confirmation. - (vc-suppress-confirm nil) - (obuf (current-buffer)) - status) - (if (vc-up-to-date-p file) - (unless (yes-or-no-p "File seems up-to-date. Revert anyway? ") - (error "Revert canceled"))) - (unless (vc-workfile-unchanged-p file) - (message "Finding changes...") - ;; vc-diff selects the new window, which is not what we want: - ;; if the new window is on another frame, that'd require the user - ;; moving her mouse to answer the yes-or-no-p question. - (let* ((vc-disable-async-diff (not vc-allow-async-revert)) - (win (save-selected-window - (setq status (vc-diff nil t)) (selected-window)))) - (vc-exec-after `(message nil)) - (when status - (unwind-protect - (unless (yes-or-no-p "Discard changes? ") - (error "Revert canceled")) - (select-window win) - (if (one-window-p t) - (if (window-dedicated-p (selected-window)) - (make-frame-invisible)) - (delete-window)))))) - (set-buffer obuf) - ;; Do the reverting - (message "Reverting %s..." file) - (vc-revert-file file) - (message "Reverting %s...done" file))) + (let* ((files (vc-deduce-fileset)) + (backend (vc-backend (car files)))) + ;; If any of the files is visited by the current buffer, make + ;; sure buffer is saved. If the user says `no', abort since + ;; we cannot show the changes and ask for confirmation to + ;; discard them. + (if (or (not files) (memq (buffer-file-name) files)) + (vc-buffer-sync nil)) + (dolist (file files) + (let (buf (get-file-buffer file)) + (if (and buf (buffer-modified-p buf)) + (error "Please kill or save all modified buffers before reverting."))) + (if (vc-up-to-date-p file) + (unless (yes-or-no-p (format "%s seems up-to-date. Revert anyway? " file)) + (error "Revert canceled")))) + (if (vc-diff-internal backend vc-allow-async-revert files nil nil) + (progn + (unless (yes-or-no-p (format "Discard changes in %s? " (vc-delistify files))) + (error "Revert canceled")) + (delete-windows-on "*vc-diff*") + (kill-buffer "*vc-diff*"))) + (dolist (file files) + (progn + (message "Reverting %s..." (vc-delistify files)) + (vc-revert-file file) + (message "Reverting %s...done" (vc-delistify files)))))) ;;;###autoload -(defun vc-rollback (&optional norevert) - "Get rid of most recently checked in version of this file. -A prefix argument NOREVERT means do not revert the buffer afterwards." - (interactive "P") - (vc-ensure-vc-buffer) - (let* ((file buffer-file-name) - (backend (vc-backend file)) - (target (vc-workfile-version file))) - (cond - ((not (vc-find-backend-function backend 'rollback)) - (error "Sorry, canceling versions is not supported under %s" backend)) - ((not (vc-call latest-on-branch-p file)) - (error "This is not the latest version; VC cannot cancel it")) - ((not (vc-up-to-date-p file)) - (error "%s" (substitute-command-keys "File is not up to date; use \\[vc-revert] to discard changes")))) - (if (null (yes-or-no-p (format "Remove version %s from master? " target))) - (error "Aborted") - (setq norevert (or norevert (not - (yes-or-no-p "Revert buffer to most recent remaining version? ")))) - - (message "Removing last change from %s..." file) - (with-vc-properties - file - (vc-call rollback (list file)) - `((vc-state . ,(if norevert 'edited 'up-to-date)) - (vc-checkout-time . ,(if norevert - 0 - (nth 5 (file-attributes file)))) - (vc-workfile-version . nil))) - (message "Removing last change from %s...done" file) - - (cond - (norevert ;; clear version headers and mark the buffer modified - (set-visited-file-name file) - (when (not vc-make-backup-files) - ;; inhibit backup for this buffer - (make-local-variable 'backup-inhibited) - (setq backup-inhibited t)) - (setq buffer-read-only nil) - (vc-clear-headers) - (vc-mode-line file) - (vc-dired-resynch-file file)) - (t ;; revert buffer to file on disk - (vc-resynch-buffer file t t))) - (message "Version %s has been removed from the master" target)))) +(defun vc-rollback () + "Roll back (remove) the most recent changeset committed to the repository. +This may be either a file-level or a repository-level operation, +depending on the underlying version-control system." + (interactive) + (let* ((files (vc-deduce-fileset)) + (backend (vc-backend (car files))) + (granularity (vc-call-backend backend 'revision-granularity))) + (unless (vc-find-backend-function backend 'rollback) + (error "Rollback is not supported in %s" backend)) + (if (and (not (eq granularity 'repository)) (/= (length files) 1)) + (error "Rollback requires a singleton fileset or repository versioning")) + (if (not (vc-call latest-on-branch-p (car files))) + (error "Rollback is only possible at the tip revision.")) + ;; If any of the files is visited by the current buffer, make + ;; sure buffer is saved. If the user says `no', abort since + ;; we cannot show the changes and ask for confirmation to + ;; discard them. + (if (or (not files) (memq (buffer-file-name) files)) + (vc-buffer-sync nil)) + (dolist (file files) + (if (buffer-modified-p (get-file-buffer file)) + (error "Please kill or save all modified buffers before rollback.")) + (if (not (vc-up-to-date-p file)) + (error "Please revert all modified workfiles before rollback."))) + ;; Accumulate changes associated with the fileset + (vc-setup-buffer "*vc-diff*") + (not-modified) + (message "Finding changes...") + (let* ((tip (vc-working-revision (car files))) + (previous (vc-call previous-revision (car files) tip))) + (vc-diff-internal backend nil files previous tip)) + ;; Display changes + (unless (yes-or-no-p "Discard these revisions? ") + (error "Rollback canceled")) + (delete-windows-on "*vc-diff*") + (kill-buffer"*vc-diff*") + ;; Do the actual reversions + (message "Rolling back %s..." (vc-delistify files)) + (with-vc-properties + files + (vc-call-backend backend 'rollback files) + `((vc-state . ,'up-to-date) + (vc-checkout-time . , (nth 5 (file-attributes file))) + (vc-working-revision . nil))) + (mapc (lambda (f) (vc-resynch-buffer f t t)) files) + (message "Rolling back %s...done" (vc-delistify files)))) ;;;###autoload (define-obsolete-function-alias 'vc-revert-buffer 'vc-revert "23.1") ;;;###autoload (defun vc-update () - "Update the current buffer's file to the latest version on its branch. -If the file contains no changes, and is not locked, then this simply replaces -the working file with the latest version on its branch. If the file contains -changes, and the backend supports merging news, then any recent changes from -the current branch are merged into the working file." + "Update the current fileset's files to their tip revisions. +For each one that contains no changes, and is not locked, then this simply +replaces the work file with the latest revision on its branch. If the file +contains changes, and the backend supports merging news, then any recent +changes from the current branch are merged into the working file." (interactive) - (vc-ensure-vc-buffer) - (vc-buffer-sync nil) - (let ((file buffer-file-name)) + (dolist (file (vc-deduce-fileset)) + (if (buffer-modified-p (get-file-buffer file)) + (error "Please kill or save all modified buffers before updating.")) (if (vc-up-to-date-p file) - (vc-checkout file nil "") + (vc-checkout file nil "") (if (eq (vc-checkout-model file) 'locking) - (if (eq (vc-state file) 'edited) - (error - (substitute-command-keys - "File is locked--type \\[vc-revert] to discard changes")) - (error - (substitute-command-keys - "Unexpected file state (%s)--type \\[vc-next-action] to correct") - (vc-state file))) - (if (not (vc-find-backend-function (vc-backend file) 'merge-news)) - (error "Sorry, merging news is not implemented for %s" - (vc-backend file)) - (vc-call merge-news file) - (vc-resynch-window file t t)))))) + (if (eq (vc-state file) 'edited) + (error + (substitute-command-keys + "File is locked--type \\[vc-revert] to discard changes")) + (error + (substitute-command-keys + "Unexpected file state (%s)--type \\[vc-next-action] to correct") + (vc-state file))) + (if (not (vc-find-backend-function (vc-backend file) 'merge-news)) + (error "Sorry, merging news is not implemented for %s" + (vc-backend file)) + (vc-call merge-news file) + (vc-resynch-buffer file t t)))))) (defun vc-version-backup-file (file &optional rev) "Return name of backup file for revision REV of FILE. If version backups should be used for FILE, and there exists -such a backup for REV or the focus version of file, return +such a backup for REV or the working revision of file, return its name; otherwise return nil." (when (vc-call make-version-backups-p file) (let ((backup-file (vc-version-backup-file-name file rev))) @@ -2636,9 +2634,9 @@ backup-file))))) (defun vc-revert-file (file) - "Revert FILE back to the repository version it was based on." + "Revert FILE back to the repository working revision it was based on." (with-vc-properties - file + (list file) (let ((backup-file (vc-version-backup-file file))) (when backup-file (copy-file backup-file file 'ok-if-already-exists 'keep-date) @@ -2662,32 +2660,25 @@ (error "There is no version-controlled file in this buffer")) (let ((backend (vc-backend buffer-file-name)) (backends nil)) - (unwind-protect - (progn - (unless backend - (error "File %s is not under version control" buffer-file-name)) - ;; Find the registered backends. - (dolist (backend vc-handled-backends) - (when (vc-call-backend backend 'registered buffer-file-name) - (push backend backends))) - ;; Find the next backend. - (let ((def (car (delq backend - (append (memq backend backends) backends)))) - (others (delete backend backends))) - (cond - ((null others) (error "No other backend to switch to")) - (current-prefix-arg - (intern - (upcase - (completing-read - (format "Switch to backend [%s]: " def) - (mapcar (lambda (b) (list (downcase (symbol-name b)))) backends) - nil t nil nil (downcase (symbol-name def)))))) - (t def)))) - ;; Calling the `registered' method can mess up the file - ;; properties, so we want to revert them to what they were. - (if (and backend (delete backend backends)) - (vc-call-backend backend 'registered buffer-file-name)))))) + (unless backend + (error "File %s is not under version control" buffer-file-name)) + ;; Find the registered backends. + (dolist (backend vc-handled-backends) + (when (vc-call-backend backend 'registered buffer-file-name) + (push backend backends))) + ;; Find the next backend. + (let ((def (car (delq backend (append (memq backend backends) backends)))) + (others (delete backend backends))) + (cond + ((null others) (error "No other backend to switch to")) + (current-prefix-arg + (intern + (upcase + (completing-read + (format "Switch to backend [%s]: " def) + (mapcar (lambda (b) (list (downcase (symbol-name b)))) backends) + nil t nil nil (downcase (symbol-name def)))))) + (t def)))))) (unless (eq backend (vc-backend file)) (vc-file-clearprops file) (vc-file-setprop file 'vc-backend backend) @@ -2702,7 +2693,7 @@ "Transfer FILE to another version control system NEW-BACKEND. If NEW-BACKEND has a higher precedence than FILE's current backend \(i.e. it comes earlier in `vc-handled-backends'), then register FILE in -NEW-BACKEND, using the version number from the current backend as the +NEW-BACKEND, using the revision number from the current backend as the base level. If NEW-BACKEND has a lower precedence than the current backend, then commit all changes that were made under the current backend to NEW-BACKEND, and unregister FILE from the current backend. @@ -2722,7 +2713,7 @@ (set-file-modes file (logior (file-modes file) 128)) ;; `registered' might have switched under us. (vc-switch-backend file old-backend) - (let* ((rev (vc-workfile-version file)) + (let* ((rev (vc-working-revision file)) (modified-file (and edited (make-temp-file file))) (unmodified-file (and modified-file (vc-version-backup-file file)))) ;; Go back to the base unmodified file. @@ -2736,7 +2727,7 @@ (if unmodified-file (copy-file unmodified-file file 'ok-if-already-exists 'keep-date) - (if (y-or-n-p "Get base version from master? ") + (if (y-or-n-p "Get base revision from master? ") (vc-revert-file file)))) (vc-call-backend new-backend 'receive-file file rev)) (when modified-file @@ -2826,7 +2817,7 @@ (if (file-exists-p old) (rename-file old new)) ;; ?? Renaming a file might change its contents due to keyword expansion. ;; We should really check out a new copy if the old copy was precisely equal - ;; to some checked in version. However, testing for this is tricky.... + ;; to some checked-in revision. However, testing for this is tricky.... (if oldbuf (with-current-buffer oldbuf (let ((buffer-read-only buffer-read-only)) @@ -2873,7 +2864,7 @@ (vc-call-backend (vc-responsible-backend default-directory) 'update-changelog args)) -;;; The default back end. Assumes RCS-like version numbering. +;;; The default back end. Assumes RCS-like revision numbering. (defun vc-default-revision-granularity () (error "Your backend will not work with this version of VC mode.")) @@ -2898,35 +2889,35 @@ (substring rev 0 index)))) (defun vc-minor-part (rev) - "Return the minor version number of a revision number REV." + "Return the minor revision number of a revision number REV." (string-match "[0-9]+\\'" rev) (substring rev (match-beginning 0) (match-end 0))) -(defun vc-default-previous-version (backend file rev) - "Return the version number immediately preceding REV for FILE, -or nil if there is no previous version. This default -implementation works for MAJOR.MINOR-style version numbers as +(defun vc-default-previous-revision (backend file rev) + "Return the revision number immediately preceding REV for FILE, +or nil if there is no previous revision. This default +implementation works for MAJOR.MINOR-style revision numbers as used by RCS and CVS." (let ((branch (vc-branch-part rev)) (minor-num (string-to-number (vc-minor-part rev)))) (when branch (if (> minor-num 1) - ;; version does probably not start a branch or release + ;; revision does probably not start a branch or release (concat branch "." (number-to-string (1- minor-num))) (if (vc-trunk-p rev) ;; we are at the beginning of the trunk -- ;; don't know anything to return here nil ;; we are at the beginning of a branch -- - ;; return version of starting point + ;; return revision of starting point (vc-branch-part branch)))))) -(defun vc-default-next-version (backend file rev) - "Return the version number immediately following REV for FILE, -or nil if there is no next version. This default implementation -works for MAJOR.MINOR-style version numbers as used by RCS +(defun vc-default-next-revision (backend file rev) + "Return the revision number immediately following REV for FILE, +or nil if there is no next revision. This default implementation +works for MAJOR.MINOR-style revision numbers as used by RCS and CVS." - (when (not (string= rev (vc-workfile-version file))) + (when (not (string= rev (vc-working-revision file))) (let ((branch (vc-branch-part rev)) (minor-num (string-to-number (vc-minor-part rev)))) (concat branch "." (number-to-string (1+ minor-num)))))) @@ -2944,16 +2935,16 @@ (defun vc-default-latest-on-branch-p (backend file) "Return non-nil if FILE is the latest on its branch. This default implementation always returns non-nil, which means that -editing non-current versions is not supported by default." +editing non-current revisions is not supported by default." t) -(defun vc-default-init-version (backend) vc-default-init-version) +(defun vc-default-init-revision (backend) vc-default-init-revision) (defalias 'vc-cvs-update-changelog 'vc-update-changelog-rcs2log) (defalias 'vc-rcs-update-changelog 'vc-update-changelog-rcs2log) ;; FIXME: This should probably be moved to vc-rcs.el and replaced in ;; vc-cvs.el by code using cvs2cl. -(defun vc-update-changelog-rcs2log (files) +(defun vc-update-changelog-rcs2log (backend files) "Default implementation of update-changelog. Uses `rcs2log' which only works for RCS and CVS." ;; FIXME: We (c|sh)ould add support for cvs2cl @@ -2994,7 +2985,7 @@ (mapcar (lambda (f) (file-relative-name - (expand-file-name f odefault))) + (expand-file-name f odefault))) files))) "done" (pop-to-buffer (get-buffer-create "*vc*")) @@ -3004,10 +2995,10 @@ (setq default-directory (file-name-directory changelog)) (delete-file tempfile))))) -(defun vc-default-find-version (backend file rev buffer) - "Provide the new `find-version' op based on the old `checkout' op. +(defun vc-default-find-revision (backend file rev buffer) + "Provide the new `find-revision' op based on the old `checkout' op. This is only for compatibility with old backends. They should be updated -to provide the `find-version' operation instead." +to provide the `find-revision' operation instead." (let ((tmpfile (make-temp-file (expand-file-name file)))) (unwind-protect (progn @@ -3017,13 +3008,19 @@ (delete-file tmpfile)))) (defun vc-default-dired-state-info (backend file) - (let ((state (vc-state file))) - (cond - ((stringp state) (concat "(" state ")")) - ((eq state 'edited) (concat "(" (vc-user-login-name file) ")")) - ((eq state 'needs-merge) "(merge)") - ((eq state 'needs-patch) "(patch)") - ((eq state 'unlocked-changes) "(stale)")))) + (let* ((state (vc-state file)) + (statestring + (cond + ((stringp state) (concat "(" state ")")) + ((eq state 'edited) (concat "(" (vc-user-login-name file) ")")) + ((eq state 'needs-merge) "(merge)") + ((eq state 'needs-patch) "(patch)") + ((eq state 'unlocked-changes) "(stale)"))) + (buffer + (get-file-buffer file)) + (modflag + (if (and buffer (buffer-modified-p buffer)) "+" ""))) + (concat statestring modflag))) (defun vc-default-rename-file (backend old new) (condition-case nil @@ -3094,7 +3091,7 @@ (defun vc-default-revert (backend file contents-done) (unless contents-done - (let ((rev (vc-workfile-version file)) + (let ((rev (vc-working-revision file)) (file-buffer (or (get-file-buffer file) (current-buffer)))) (message "Checking out %s..." file) (let ((failed t) @@ -3111,7 +3108,7 @@ ;; Change buffer to get local value of vc-checkout-switches. (with-current-buffer file-buffer (let ((default-directory (file-name-directory file))) - (vc-call find-version file rev outbuf))))) + (vc-call find-revision file rev outbuf))))) (setq failed nil)) (when backup-name (if failed @@ -3233,11 +3230,11 @@ :style toggle :selected (eq vc-annotate-display-mode 'fullscale)] "--" - ["Annotate previous revision" vc-annotate-prev-version] - ["Annotate next revision" vc-annotate-next-version] + ["Annotate previous revision" vc-annotate-prev-revision] + ["Annotate next revision" vc-annotate-next-revision] ["Annotate revision at line" vc-annotate-revision-at-line] ["Annotate revision previous to line" vc-annotate-revision-previous-to-line] - ["Annotate latest revision" vc-annotate-focus-version] + ["Annotate latest revision" vc-annotate-working-revision] ["Show log of revision at line" vc-annotate-show-log-revision-at-line] ["Show diff of revision at line" vc-annotate-show-diff-revision-at-line])) @@ -3277,8 +3274,8 @@ 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 version number; then the buffer -displays and annotates that version instead of the current version +minibuffer. First, you may enter a revision number; 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 should cover. For example, a time span of 20 days means that changes @@ -3295,10 +3292,10 @@ (save-current-buffer (vc-ensure-vc-buffer) (list buffer-file-name - (let ((def (vc-workfile-version buffer-file-name))) + (let ((def (vc-working-revision buffer-file-name))) (if (null current-prefix-arg) def (read-string - (format "Annotate from version (default %s): " def) + (format "Annotate from revision (default %s): " def) nil nil def))) (if (null current-prefix-arg) vc-annotate-display-mode @@ -3347,31 +3344,31 @@ (unless (active-minibuffer-window) (message "Annotating... done"))))))) -(defun vc-annotate-prev-version (prefix) - "Visit the annotation of the version previous to this one. +(defun vc-annotate-prev-revision (prefix) + "Visit the annotation of the revision previous to this one. -With a numeric prefix argument, annotate the version that many -versions previous." +With a numeric prefix argument, annotate the revision that many +revisions previous." (interactive "p") - (vc-annotate-warp-version (- 0 prefix))) + (vc-annotate-warp-revision (- 0 prefix))) -(defun vc-annotate-next-version (prefix) - "Visit the annotation of the version after this one. +(defun vc-annotate-next-revision (prefix) + "Visit the annotation of the revision after this one. -With a numeric prefix argument, annotate the version that many -versions after." +With a numeric prefix argument, annotate the revision that many +revisions after." (interactive "p") - (vc-annotate-warp-version prefix)) + (vc-annotate-warp-revision prefix)) -(defun vc-annotate-focus-version () - "Visit the annotation of the focus version of this file." +(defun vc-annotate-working-revision () + "Visit the annotation of the working revision of this file." (interactive) (if (not (equal major-mode 'vc-annotate-mode)) (message "Cannot be invoked outside of a vc annotate buffer") - (let ((warp-rev (vc-workfile-version vc-annotate-parent-file))) + (let ((warp-rev (vc-working-revision vc-annotate-parent-file))) (if (equal warp-rev vc-annotate-parent-rev) - (message "Already at version %s" warp-rev) - (vc-annotate-warp-version warp-rev))))) + (message "Already at revision %s" warp-rev) + (vc-annotate-warp-revision warp-rev))))) (defun vc-annotate-extract-revision-at-line () "Extract the revision number of the current line." @@ -3379,7 +3376,7 @@ (vc-call-backend vc-annotate-backend 'annotate-extract-revision-at-line)) (defun vc-annotate-revision-at-line () - "Visit the annotation of the version identified in the current line." + "Visit the annotation of the revision identified in the current line." (interactive) (if (not (equal major-mode 'vc-annotate-mode)) (message "Cannot be invoked outside of a vc annotate buffer") @@ -3387,11 +3384,11 @@ (if (not rev-at-line) (message "Cannot extract revision number from the current line") (if (equal rev-at-line vc-annotate-parent-rev) - (message "Already at version %s" rev-at-line) - (vc-annotate-warp-version rev-at-line)))))) + (message "Already at revision %s" rev-at-line) + (vc-annotate-warp-revision rev-at-line)))))) (defun vc-annotate-revision-previous-to-line () - "Visit the annotation of the version before the version at line." + "Visit the annotation of the revision before the revision at line." (interactive) (if (not (equal major-mode 'vc-annotate-mode)) (message "Cannot be invoked outside of a vc annotate buffer") @@ -3400,11 +3397,11 @@ (if (not rev-at-line) (message "Cannot extract revision number from the current line") (setq prev-rev - (vc-call previous-version vc-annotate-parent-file rev-at-line)) - (vc-annotate-warp-version prev-rev))))) + (vc-call previous-revision vc-annotate-parent-file rev-at-line)) + (vc-annotate-warp-revision prev-rev))))) (defun vc-annotate-show-log-revision-at-line () - "Visit the log of the version at line." + "Visit the log of the revision at line." (interactive) (if (not (equal major-mode 'vc-annotate-mode)) (message "Cannot be invoked outside of a vc annotate buffer") @@ -3414,7 +3411,7 @@ (vc-print-log rev-at-line))))) (defun vc-annotate-show-diff-revision-at-line () - "Visit the diff of the version at line from its previous version." + "Visit the diff of the revision at line from its previous revision." (interactive) (if (not (equal major-mode 'vc-annotate-mode)) (message "Cannot be invoked outside of a vc annotate buffer") @@ -3423,19 +3420,23 @@ (if (not rev-at-line) (message "Cannot extract revision number from the current line") (setq prev-rev - (vc-call previous-version vc-annotate-parent-file rev-at-line)) + (vc-call previous-revision vc-annotate-parent-file rev-at-line)) (if (not prev-rev) - (message "Cannot diff from any version prior to %s" rev-at-line) + (message "Cannot diff from any revision prior to %s" rev-at-line) (save-window-excursion - (vc-version-diff vc-annotate-parent-file prev-rev rev-at-line)) + (vc-diff-internal + (vc-backend vc-annotate-parent-file) + nil + (list vc-annotate-parent-file) + prev-rev rev-at-line)) (switch-to-buffer "*vc-diff*")))))) -(defun vc-annotate-warp-version (revspec) - "Annotate the version described by REVSPEC. +(defun vc-annotate-warp-revision (revspec) + "Annotate the revision described by REVSPEC. -If REVSPEC is a positive integer, warp that many versions +If REVSPEC is a positive integer, warp that many revisions forward, if possible, otherwise echo a warning message. If -REVSPEC is a negative integer, warp that many versions backward, +REVSPEC is a negative integer, warp that many revisions backward, if possible, otherwise echo a warning message. If REVSPEC is a string, then it describes a revision number, so warp to that revision." @@ -3449,23 +3450,23 @@ ((and (integerp revspec) (> revspec 0)) (setq newrev vc-annotate-parent-rev) (while (and (> revspec 0) newrev) - (setq newrev (vc-call next-version + (setq newrev (vc-call next-revision vc-annotate-parent-file newrev)) (setq revspec (1- revspec))) (if (not newrev) - (message "Cannot increment %d versions from version %s" + (message "Cannot increment %d revisions from revision %s" revspeccopy vc-annotate-parent-rev))) ((and (integerp revspec) (< revspec 0)) (setq newrev vc-annotate-parent-rev) (while (and (< revspec 0) newrev) - (setq newrev (vc-call previous-version + (setq newrev (vc-call previous-revision vc-annotate-parent-file newrev)) (setq revspec (1+ revspec))) (if (not newrev) - (message "Cannot decrement %d versions from version %s" + (message "Cannot decrement %d revisions from revision %s" (- 0 revspeccopy) vc-annotate-parent-rev))) ((stringp revspec) (setq newrev revspec)) - (t (error "Invalid argument to vc-annotate-warp-version"))) + (t (error "Invalid argument to vc-annotate-warp-revision"))) (when newrev (vc-annotate vc-annotate-parent-file newrev vc-annotate-parent-display-mode @@ -3548,19 +3549,13 @@ ;; Set up key bindings for use while editing log messages -(defun vc-log-edit (file) +(defun vc-log-edit (fileset) "Set up `log-edit' for use with VC on FILE." (setq default-directory - (if file (file-name-directory file) - (with-current-buffer vc-parent-buffer default-directory))) - (log-edit 'vc-finish-logentry nil - (if file `(lambda () ',(list (file-name-nondirectory file))) - ;; If FILE is nil, we were called from vc-dired. - (lambda () - (with-current-buffer vc-parent-buffer - (dired-get-marked-files t))))) - (set (make-local-variable 'vc-log-file) file) - (make-local-variable 'vc-log-version) + (with-current-buffer vc-parent-buffer default-directory)) + (log-edit 'vc-finish-logentry nil `(lambda () ',fileset)) + (set (make-local-variable 'vc-log-fileset) fileset) + (make-local-variable 'vc-log-revision) (set-buffer-modified-p nil) (setq buffer-file-name nil))
--- a/lisp/window.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/window.el Sat Oct 13 05:53:03 2007 +0000 @@ -1019,10 +1019,6 @@ (when mouse-autoselect-window ;; Reset state of delayed autoselection. (setq mouse-autoselect-window-state nil) - ;; Set input focus to handle cross-frame movement. Bind - ;; `focus-follows-mouse' to avoid moving the mouse cursor. - (let (focus-follows-mouse) - (select-frame-set-input-focus (window-frame window))) ;; Run `mouse-leave-buffer-hook' when autoselecting window. (run-hooks 'mouse-leave-buffer-hook)) (select-window window))))
--- a/lisp/woman.el Fri Oct 12 21:57:45 2007 +0000 +++ b/lisp/woman.el Sat Oct 13 05:53:03 2007 +0000 @@ -2716,7 +2716,7 @@ (defun woman0-rename () "Effect renaming required by .rn requests." ;; For now, do this backwards AFTER all macro expansion. - (dolist ((new woman0-rename-alist)) + (dolist (new woman0-rename-alist) (let ((old (cdr new)) (new (car new))) (goto-char (point-min))
--- a/lispintro/.cvsignore Fri Oct 12 21:57:45 2007 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -Makefile
--- a/lispref/.cvsignore Fri Oct 12 21:57:45 2007 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -Makefile
--- a/man/.cvsignore Fri Oct 12 21:57:45 2007 +0000 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,1 +0,0 @@ -Makefile
--- a/src/ChangeLog Fri Oct 12 21:57:45 2007 +0000 +++ b/src/ChangeLog Sat Oct 13 05:53:03 2007 +0000 @@ -1,15 +1,41 @@ +2007-10-10 Patrick Mahan <mahan@mahan.org> (tiny change) + + * macfns.c (x_create_tip_frame): Set terminal for frame. + +2007-10-10 Stefan Monnier <monnier@iro.umontreal.ca> + + * frame.c (Qenvironment): Remove. + (syms_of_frame) <Qenvironment>: Don't initialize. + (Fdelete_frame): Don't treat the `environment' param specially. + * frame.h (Qenvironment): Don't declare. + * callproc.c (set_initial_environment): Don't set unused frame param. + + * frame.c (Fframe_with_environment): Remove. + (syms_of_frame) <Sframe_with_environment>: Don't declare. + + * lisp.h (Fframe_with_environment): Don't declare. + +2007-10-10 Juanma Barranquero <lekktu@gmail.com> + + * indent.c (indent_tabs_mode, last_known_column) + (last_known_column_modified): Make static. + (syms_of_indent) <indent-tabs-mode>: Remove redundant info in docstring. + +2007-10-10 Katsumi Yamaoka <yamaoka@jpl.org> + + * puresize.h (BASE_PURESIZE): Increase to 1170000. + 2007-10-08 Martin Rudalics <rudalics@gmx.at> * keyboard.c (kbd_buffer_get_event): Break loop waiting for input when there's an unread command event. - * frame.c (focus_follows_mouse): Moved here from frame.el to allow + * frame.c (focus_follows_mouse): Move here from frame.el to allow window autoselection act appropriately when leaving selected frame. (syms_of_frame): Initialize focus_follows_mouse. * frame.h (focus_follows_mouse): Extern it. * macterm.c (XTread_socket): When focus_follows_mouse is nil - make SELECT_WINDOW_EVENT only if we don't leave the selected - frame. + make SELECT_WINDOW_EVENT only if we don't leave the selected frame. * msdos.c (dos_rawgetc): Likewise. * w32term.c (w32_read_socket): Likewise. * xterm.c (handle_one_xevent): Likewise. @@ -39,7 +65,7 @@ 2007-10-08 Richard Stallman <rms@gnu.org> - * image.c (our_memory_buffer): Renamed from omfib_buffer. + * image.c (our_memory_buffer): Rename from omfib_buffer. 2007-10-08 Richard Stallman <rms@gnu.org> @@ -82,7 +108,7 @@ 2007-10-09 Stefan Monnier <monnier@iro.umontreal.ca> - Add new `input-decode-map' keymap and use it for temrinal + Add new `input-decode-map' keymap and use it for terminal escape sequences. * keyboard.h (struct kboard): Add Vinput_decode_map. Remove Vlocal_key_translation_map. @@ -295,8 +321,7 @@ 2007-09-22 Eli Zaretskii <eliz@gnu.org> - * term.c (DEV_TTY): New macro. Provide a definition for - MS-Windows. + * term.c (DEV_TTY): New macro. Provide a definition for MS-Windows. (FRAME_TERMCAP_P) [WINDOWSNT]: Don't define to zero. (Fcontrolling_tty_p, Fresume_tty, dissociate_if_controlling_tty) (init_tty): Use DEV_TTY instead of "/dev/tty".
--- a/src/callproc.c Fri Oct 12 21:57:45 2007 +0000 +++ b/src/callproc.c Sat Oct 13 05:53:03 2007 +0000 @@ -1663,7 +1663,6 @@ for (envp = environ; *envp; envp++) Vprocess_environment = Fcons (build_string (*envp), Vprocess_environment); - store_frame_param (SELECTED_FRAME(), Qenvironment, Vprocess_environment); /* Ideally, the `copy' shouldn't be necessary, but it seems it's frequent to use `delete' and friends on process-environment. */ Vinitial_environment = Fcopy_sequence (Vprocess_environment);
--- a/src/frame.c Fri Oct 12 21:57:45 2007 +0000 +++ b/src/frame.c Sat Oct 13 05:53:03 2007 +0000 @@ -114,7 +114,6 @@ Lisp_Object Qtty_color_mode; Lisp_Object Qtty, Qtty_type; Lisp_Object Qwindow_system; -Lisp_Object Qenvironment; Lisp_Object Qfullscreen, Qfullwidth, Qfullheight, Qfullboth; #ifdef USE_FONT_BACKEND @@ -1479,24 +1478,6 @@ if (EQ (f->minibuffer_window, echo_area_window)) echo_area_window = sf->minibuffer_window; - /* Don't allow other frames to refer to a deleted frame in their - 'environment parameter. */ - { - Lisp_Object tail, frame1; - Lisp_Object env = get_frame_param (XFRAME (frame), Qenvironment); - FOR_EACH_FRAME (tail, frame1) - { - if (EQ (frame, frame1) || !FRAME_LIVE_P (XFRAME (frame1))) - continue; - if (EQ (frame, get_frame_param (XFRAME (frame1), Qenvironment))) - { - store_frame_param (XFRAME (frame1), Qenvironment, env); - if (!FRAMEP (env)) - env = frame1; - } - } - } - /* Clear any X selections for this frame. */ #ifdef HAVE_X_WINDOWS if (FRAME_X_P (f)) @@ -2618,43 +2599,6 @@ } return Qnil; } - -DEFUN ("frame-with-environment", Fframe_with_environment, Sframe_with_environment, 0, 1, 0, - doc: /* Return the frame that has the environment variable list for FRAME. - -The frame-local environment variable list is normally shared between -frames that were created in the same Emacsclient session. The -environment list is stored in a single frame's 'environment parameter; -the other frames' 'environment parameter is set to this frame. This -function follows the chain of 'environment references to reach the -frame that stores the actual local environment list, and returns that -frame. */) - (frame) - Lisp_Object frame; -{ - Lisp_Object hare, tortoise; - - if (NILP (frame)) - frame = selected_frame; - CHECK_FRAME (frame); - - hare = tortoise = get_frame_param (XFRAME (frame), Qenvironment); - while (!NILP (hare) && FRAMEP (hare)) - { - frame = hare; - hare = get_frame_param (XFRAME (hare), Qenvironment); - if (NILP (hare) || !FRAMEP (hare)) - break; - frame = hare; - hare = get_frame_param (XFRAME (hare), Qenvironment); - tortoise = get_frame_param (XFRAME (tortoise), Qenvironment); - if (EQ (hare, tortoise)) - error ("Cyclic frame-local environment indirection"); - } - - return frame; -} - DEFUN ("frame-char-height", Fframe_char_height, Sframe_char_height, 0, 1, 0, @@ -4455,8 +4399,6 @@ staticpro (&Qtty_type); Qwindow_system = intern ("window-system"); staticpro (&Qwindow_system); - Qenvironment = intern ("environment"); - staticpro (&Qenvironment); Qface_set_after_frame_default = intern ("face-set-after-frame-default"); staticpro (&Qface_set_after_frame_default); @@ -4656,7 +4598,6 @@ defsubr (&Sframe_parameters); defsubr (&Sframe_parameter); defsubr (&Smodify_frame_parameters); - defsubr (&Sframe_with_environment); defsubr (&Sframe_char_height); defsubr (&Sframe_char_width); defsubr (&Sframe_pixel_height);
--- a/src/frame.h Fri Oct 12 21:57:45 2007 +0000 +++ b/src/frame.h Sat Oct 13 05:53:03 2007 +0000 @@ -796,7 +796,6 @@ extern Lisp_Object Qframep, Qframe_live_p; extern Lisp_Object Qtty, Qtty_type; extern Lisp_Object Qterminal, Qterminal_live_p; -extern Lisp_Object Qenvironment; extern struct frame *last_nonminibuf_frame;
--- a/src/indent.c Fri Oct 12 21:57:45 2007 +0000 +++ b/src/indent.c Sat Oct 13 05:53:03 2007 +0000 @@ -39,7 +39,7 @@ /* Indentation can insert tabs if this is non-zero; otherwise always uses spaces. */ -int indent_tabs_mode; +static int indent_tabs_mode; #define CR 015 @@ -49,7 +49,7 @@ Some things in set last_known_column_point to -1 to mark the memorized value as invalid. */ -double last_known_column; +static double last_known_column; /* Value of point when current_column was called. */ @@ -57,7 +57,7 @@ /* Value of MODIFF when current_column was called. */ -int last_known_column_modified; +static int last_known_column_modified; static double current_column_1 P_ ((void)); static double position_indentation P_ ((int)); @@ -2159,8 +2159,7 @@ syms_of_indent () { DEFVAR_BOOL ("indent-tabs-mode", &indent_tabs_mode, - doc: /* *Indentation can insert tabs if this is non-nil. -Setting this variable automatically makes it local to the current buffer. */); + doc: /* *Indentation can insert tabs if this is non-nil. */); indent_tabs_mode = 1; defsubr (&Scurrent_indentation);
--- a/src/lisp.h Fri Oct 12 21:57:45 2007 +0000 +++ b/src/lisp.h Sat Oct 13 05:53:03 2007 +0000 @@ -3029,7 +3029,6 @@ EXFUN (Fframe_parameter, 2); EXFUN (Fframe_parameters, 1); EXFUN (Fmodify_frame_parameters, 2); -EXFUN (Fframe_with_environment, 1); EXFUN (Fset_frame_height, 3); EXFUN (Fset_frame_width, 3); EXFUN (Fset_frame_size, 3);
--- a/src/lread.c Fri Oct 12 21:57:45 2007 +0000 +++ b/src/lread.c Sat Oct 13 05:53:03 2007 +0000 @@ -3821,8 +3821,8 @@ #endif /* NOTDEF */ /* Define an "integer variable"; a symbol whose value is forwarded - to a C variable of type int. Sample call: */ - /* DEFVAR_INT ("indent-tabs-mode", &indent_tabs_mode, "Documentation"); */ + to a C variable of type int. Sample call: + DEFVAR_INT ("emacs-priority", &emacs_priority, "Documentation"); */ void defvar_int (namestring, address) char *namestring; @@ -3837,7 +3837,7 @@ } /* Similar but define a variable whose value is t if address contains 1, - nil if address contains 0 */ + nil if address contains 0. */ void defvar_bool (namestring, address) char *namestring;
--- a/src/macfns.c Fri Oct 12 21:57:45 2007 +0000 +++ b/src/macfns.c Sat Oct 13 05:53:03 2007 +0000 @@ -3855,6 +3855,8 @@ the frame is live, as per FRAME_LIVE_P. If we get a signal from this point on, x_destroy_window might screw up reference counts etc. */ + f->terminal = dpyinfo->terminal; + f->terminal->reference_count++; f->output_method = output_mac; f->output_data.mac = (struct mac_output *) xmalloc (sizeof (struct mac_output));
--- a/src/puresize.h Fri Oct 12 21:57:45 2007 +0000 +++ b/src/puresize.h Sat Oct 13 05:53:03 2007 +0000 @@ -43,7 +43,7 @@ #endif #ifndef BASE_PURESIZE -#define BASE_PURESIZE (1164000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) +#define BASE_PURESIZE (1170000 + SYSTEM_PURESIZE_EXTRA + SITELOAD_PURESIZE_EXTRA) #endif /* Increase BASE_PURESIZE by a ratio depending on the machine's word size. */