aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMiles Bader2007-10-13 05:53:03 +0000
committerMiles Bader2007-10-13 05:53:03 +0000
commit2b42d458a45eaf9767da327f76a40a1cf9c77c23 (patch)
treef896828e65199d043ea7ab366fffea8bd315a986 /lisp
parent3e88ae627ef8d827b3f79e4e6f14aaad7adfe322 (diff)
parente2cfa9afa691fb8b7a554cb685c16ff3d4e1ff2b (diff)
downloademacs-2b42d458a45eaf9767da327f76a40a1cf9c77c23.tar.gz
emacs-2b42d458a45eaf9767da327f76a40a1cf9c77c23.zip
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
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog317
-rw-r--r--lisp/add-log.el4
-rw-r--r--lisp/bs.el33
-rw-r--r--lisp/cus-edit.el17
-rw-r--r--lisp/cus-start.el2
-rw-r--r--lisp/diff-mode.el7
-rw-r--r--lisp/ediff-vers.el12
-rw-r--r--lisp/emacs-lisp/byte-opt.el22
-rw-r--r--lisp/env.el79
-rw-r--r--lisp/erc/ChangeLog5
-rw-r--r--lisp/erc/erc-track.el22
-rw-r--r--lisp/follow.el85
-rw-r--r--lisp/font-lock.el2
-rw-r--r--lisp/frame.el18
-rw-r--r--lisp/help-fns.el5
-rw-r--r--lisp/ldefs-boot.el8
-rw-r--r--lisp/log-view.el10
-rw-r--r--lisp/mail/feedmail.el4
-rw-r--r--lisp/mail/reporter.el2
-rw-r--r--lisp/mail/rmail.el5
-rw-r--r--lisp/net/eudc-hotlist.el10
-rw-r--r--lisp/net/eudc.el68
-rw-r--r--lisp/net/eudcb-bbdb.el34
-rw-r--r--lisp/net/eudcb-ldap.el2
-rw-r--r--lisp/net/socks.el2
-rw-r--r--lisp/net/tramp.el5
-rw-r--r--lisp/net/trampver.el4
-rw-r--r--lisp/obsolete/hilit19.el36
-rw-r--r--lisp/pcvs.el2
-rw-r--r--lisp/progmodes/cc-cmds.el2
-rw-r--r--lisp/progmodes/cc-mode.el20
-rw-r--r--lisp/progmodes/cc-styles.el12
-rw-r--r--lisp/progmodes/cperl-mode.el106
-rw-r--r--lisp/progmodes/ebnf-yac.el4
-rw-r--r--lisp/progmodes/ebnf2ps.el12
-rw-r--r--lisp/progmodes/idlw-shell.el28
-rw-r--r--lisp/progmodes/idlw-toolbar.el48
-rw-r--r--lisp/progmodes/idlwave.el64
-rw-r--r--lisp/server.el18
-rw-r--r--lisp/startup.el95
-rw-r--r--lisp/term/xterm.el68
-rw-r--r--lisp/textmodes/org-export-latex.el430
-rw-r--r--lisp/textmodes/org-publish.el2
-rw-r--r--lisp/textmodes/org.el1659
-rw-r--r--lisp/textmodes/reftex-cite.el16
-rw-r--r--lisp/textmodes/reftex-ref.el6
-rw-r--r--lisp/textmodes/reftex-sel.el12
-rw-r--r--lisp/textmodes/reftex-toc.el2
-rw-r--r--lisp/textmodes/reftex.el6
-rw-r--r--lisp/url/ChangeLog5
-rw-r--r--lisp/url/url-auth.el1
-rw-r--r--lisp/vc-arch.el14
-rw-r--r--lisp/vc-bzr.el24
-rw-r--r--lisp/vc-cvs.el64
-rw-r--r--lisp/vc-git.el30
-rw-r--r--lisp/vc-hg.el46
-rw-r--r--lisp/vc-hooks.el25
-rw-r--r--lisp/vc-mcvs.el58
-rw-r--r--lisp/vc-mtn.el6
-rw-r--r--lisp/vc-rcs.el56
-rw-r--r--lisp/vc-sccs.el40
-rw-r--r--lisp/vc-svn.el46
-rw-r--r--lisp/vc.el1439
-rw-r--r--lisp/window.el4
-rw-r--r--lisp/woman.el2
65 files changed, 3097 insertions, 2195 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9524be4cdee..3fe5e2994cf 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,310 @@
12007-10-13 Glenn Morris <rgm@gnu.org>
2
3 * woman.el (woman0-rename): Fix paren typo.
4
5 * mail/feedmail.el (feedmail-run-the-queue)
6 (feedmail-look-at-queue-directory):
7 * mail/reporter.el (reporter-dump-state):
8 * net/eudc-hotlist.el (eudc-edit-hotlist):
9 * net/eudc.el (eudc-display-records)
10 (eudc-filter-duplicate-attributes)
11 (eudc-distribute-field-on-records, eudc-query-form)
12 (eudc-process-form):
13 * net/eudcb-bbdb.el (eudc-bbdb-filter-non-matching-record)
14 (eudc-bbdb-query-internal):
15 * net/eudcb-ldap.el (eudc-ldap-simple-query-internal):
16 * net/socks.el (socks-build-auth-list):
17 * progmodes/cc-cmds.el (top level):
18 * progmodes/cc-styles.el (c-make-styles-buffer-local)
19 (c-set-style):
20 * progmodes/cperl-mode.el (top level, cperl-imenu-addback)
21 (cperl-write-tags, cperl-tags-treeify):
22 * progmodes/ebnf-yac.el (ebnf-yac-token-table):
23 * progmodes/ebnf2ps.el (ebnf-map-name, ebnf-dimensions):
24 * progmodes/idlw-shell.el (idlwave-shell-filter-bp, top level):
25 * progmodes/idlw-toolbar.el (idlwave-toolbar-add-everywhere)
26 (idlwave-toolbar-remove-everywhere):
27 * progmodes/idlwave.el (idlwave-indent-line)
28 (idlwave-sintern-keyword-list, idlwave-scan-user-lib-files)
29 (idlwave-write-paths, idlwave-all-method-classes)
30 (idlwave-all-method-keyword-classes, idlwave-entry-keywords)
31 (idlwave-fix-keywords, idlwave-display-calling-sequence):
32 * textmodes/org.el (org-export-as-html, org-export-as-ascii)
33 (org-fast-tag-selection): Use mapc rather than mapcar.
34
352007-10-13 Dan Nicolaescu <dann@ics.uci.edu>
36
37 * diff-mode.el (diff-fine-change): Add :group.
38
392007-10-12 Dan Nicolaescu <dann@ics.uci.edu>
40
41 * cus-start.el (all): Use the same test as the 22.2 branch.
42
432007-10-12 Stefan Monnier <monnier@iro.umontreal.ca>
44
45 * diff-mode.el (diff-current-defun): Force recomputation of
46 change-log-default-name.
47
482007-10-12 Chong Yidong <cyd@stupidchicken.com>
49
50 * startup.el (fancy-startup-screen): Remove an unnecessary newline
51 and some leftover logic regarding dedicated frames. If showing
52 concise startup screen, fit window to buffer.
53 (command-line-1): If we will be using the splash screen, use
54 find-file instead of find-file-other-window to find additional
55 files. Comment out unused code for coping with the old sit-for
56 behavior.
57
582007-10-12 Stefan Monnier <monnier@iro.umontreal.ca>
59
60 * term/xterm.el (xterm-function-map, xterm-alternatives-map): Use the
61 `meta' modifier consistently, rather than using sometimes meta
62 sometimes alt.
63
642007-10-12 Martin Rudalics <rudalics@gmx.at>
65
66 * window.el (handle-select-window): Revert part of 2007-10-08
67 change setting the input focus.
68
692007-10-12 Glenn Morris <rgm@gnu.org>
70
71 * startup.el (command-line): Do not read abbrev file in batch mode.
72
73 * emacs-lisp/byte-opt.el (top level):
74 * mail/rmail.el (rmail-list-to-menu):
75 * obsolete/hilit19.el (hilit-mode):
76 * progmodes/cc-mode.el (c-postprocess-file-styles)
77 (c-submit-bug-report):
78 * textmodes/org-publish.el (org-publish-get-plist-from-filename):
79 * textmodes/reftex.el (reftex-erase-all-selection-and-index-buffers)
80 (reftex-access-parse-file):
81 * textmodes/reftex-cite.el (reftex-do-citation)
82 (reftex-insert-bib-matches):
83 * textmodes/reftex-ref.el (reftex-offer-label-menu):
84 * textmodes/reftex-sel.el (reftex-select-unmark):
85 * textmodes/reftex-toc.el (reftex-toc-do-promote):
86 * vc-mcvs.el (vc-mcvs-checkin): Use mapc rather than mapcar.
87
88 * cus-edit.el (custom-variable-menu, custom-face-menu)
89 (custom-group-menu): Check init-file-user rather than
90 user-init-file, in case cus-edit is loaded by site-run-file.
91
922007-10-11 Dan Nicolaescu <dann@ics.uci.edu>
93
94 * vc.el (vc-deduce-fileset): Delete unused code.
95 (vc-next-action): Fix typos.
96
972007-10-11 Juanma Barranquero <lekktu@gmail.com>
98
99 * bs.el (bs--mark-unmark): New function.
100 (bs-mark-current, bs-unmark-current): Use it.
101
1022007-10-11 Eric S. Raymond <esr@snark.thyrsus.com>
103
104 * vc.el (vc-diff, vc-diff-internal): Bug fixes by Juanma Barranquero.
105 Temporarily disable the check for his edge case, it's calling some
106 brittle code.
107 (with-vc-properties): Fievaluation time of a macro argument.
108
109 * ediff-vers.el (ediff-vc-internal):
110 * vc-hooks.el:
111 * loaddefs.el: Follow up on VC terminology change.
112
1132007-10-11 Juanma Barranquero <lekktu@gmail.com>
114
115 * follow.el (follow-stop-intercept-process-output):
116 Use `follow-call-process-filter' rather than `process-filter'.
117 Simplify.
118
1192007-10-11 Eric S. Raymond <esr@snark.thyrsus.com>
120
121 * vc.el: Address an edge case in vc-diff pointed out by
122 Juanma Barranquero. This is an experimental fix and may change.
123
124 * vc-hooks.el (vc-registered): Robustify this function a bit
125 against filenames with no directory component.
126
1272007-10-11 Stefan Monnier <monnier@iro.umontreal.ca>
128
129 * international/characters.el: Undo unwanted and unexplained change.
130
1312007-10-10 Vinicius Jose Latorre <viniciusjl@ig.com.br>
132
133 * ps-print.el: Fix the usage of :foreground and :background face
134 attributes. Reported by Nikolaj Schumacher <n_schumacher@web.de>.
135 (ps-print-version): New version 6.7.6.
136 (ps-face-attributes, ps-face-attribute-list, ps-face-background):
137 Fix code.
138 (ps-face-foreground-color-p, ps-face-background-color-p)
139 (ps-face-color-p): New inline funs.
140
1412007-10-10 Carsten Dominik <dominik@science.uva.nl>
142
143 * org.el (org-additional-option-like-keywords): New constant.
144 (org-complete): Use `org-additional-option-like-keywords'.
145 (org-parse-local-options): New function.
146
1472007-10-10 Carsten Dominik <dominik@science.uva.nl>
148
149 * org.el (org-in-clocktable-p): New function.
150 (org-clock-report): Only update the table at point, or insert a
151 new one.
152 (org-clock-goto): New function.
153 (org-open-file): Use `start-process-shell-command' instead of
154 `shell-command' with an ampersand.
155 (org-deadline, org-schedule): New argument REMOVE to remove the
156 date from the entry.
157 (org-agenda-schedule, org-agenda-deadline): Pass the prefix
158 argument to `org-schedule' and `org-deadline'.
159 (org-trim): Use the correct expressions for beginning and end of
160 the string.
161 (org-get-cleaned-entry): Trim the string before returning it.
162 (org-clock-find-position): New function.
163 (org-clock-into-drawer): New option.
164 (org-agenda-tags-column): Rename from
165 `org-agenda-align-tags-to-column'.
166 (org-agenda-align-tags): Allow negative values for
167 `org-agenda-tags-column'.
168 (org-insert-labeled-timestamps-before-properties-drawer): Remove var.
169 (org-agenda-to-appt): New optional argument FILTER.
170 (org-completion-fallback-command): New variable.
171 (org-complete): Use `org-completion-fallback-command'.
172 (org-find-base-buffer-visiting): Catch the case that there is no
173 buffer visiting the file.
174 (org-property-or-variable-value): New function.
175 (org-todo): Use `org-property-or-variable-value'
176 (org-agenda-compact-blocks): New option.
177 (org-prepare-agenda, org-agenda-list): Use `org-agenda-compact-blocks'.
178 (org-agenda-schedule, org-agenda-deadline):
179 Call `org-agenda-show-new-time'.
180 (org-agenda-show-new-time): New argument PREFIX.
181 (org-colgroup-info-to-vline-list): Fix but that cause a
182 shift in the vertical lines.
183 (org-buffer-property-keys): New argument INCLUDE-DEFAULTS.
184 (org-maybe-renumber-ordered-list, org-cycle-list-bullet)
185 (org-indent-item): No arg in call to `org-fix-bullet-type'.
186 (org-fix-bullet-type): Remove argument.
187 (org-read-date): Check for am/pm twice, to catch the end time.
188 (org-goto-map): Use `suppress-keymap'.
189 (org-remember-apply-template): Respect the dynamically scoped
190 selection character.
191
192 * org.texi (Appointment reminders): New section.
193
1942007-10-10 Bastien Guerry <Bastien.Guerry@ens.fr>
195
196 * org-export-latex.el (org-export-latex-protect-string):
197 Renaming of `org-latex-protect'.
198 (org-export-latex-emphasis-alist): By default, don't protect
199 any emphasis formatter from further conversion.
200 (org-export-latex-tables): Honor column grouping for tables.
201 (org-export-latex-title-command): New option.
202 (org-export-latex-treat-backslash-char): Use \textbackslash{} to
203 export backslash character.
204
2052007-10-10 Stefan Monnier <monnier@iro.umontreal.ca>
206
207 * frame.el (frame-inherited-parameters): Remove unused `environment'
208 parameter, and let server.el add `client' when needed.
209
210 * server.el (server-create-tty-frame)
211 (server-create-window-system-frame): Set frame-inherited-parameters.
212
213 * frame.el (frame-inherited-parameters): New var.
214 (make-frame): Use it.
215
216 * font-lock.el (lisp-font-lock-keywords-2): Remove let-environment.
217
218 * env.el (let-environment): Remove. Unused.
219 (read-envvar-name): Simplify.
220 (setenv): Remove unused arg `frame'.
221
222 * help-fns.el (describe-variable): Add missing " " for multiline
223 obsolescence info and missing EOL after global value.
224
2252007-10-10 Eric S. Raymond <esr@snark.thyrsus.com>
226
227 * add-log.el:
228 * ediff-vers.el:
229 * log-view.el:
230 * pcvs.el:
231 * vc-arch.el:
232 * vc-bzr.el:
233 * vc-cvs.el:
234 * vc.el:
235 * vc-git.el:
236 * vc-hg.el:
237 * vc-hooks.el:
238 * vc-mcvs.el:
239 * vc-mtn.el:
240 * vc-rcs.el:
241 * vc-sccs.el:
242 * vc-svn.el: Terminology cleanup: workfile-version -> working-revision,
243 {find,init,next,previous,annotate-*,log}-version ->
244 {find,init,next,previous,annotate-*,log}-revision,
245 annotate-focus-version -> annotate-working-revision, The term
246 'focus' is gone. The term 'revision' is now used consistently
247 everywhere that reference to a revision ID is intended, replacing
248 older use of 'version'.
249
2502007-10-10 Juanma Barranquero <lekktu@gmail.com>
251
252 * follow.el: Change all instances of "Follow Mode" to "Follow
253 mode" in docstrings and messages.
254 (follow-menu-filter): Fix arg passed to `bound-and-true-p'.
255
2562007-10-10 Eric S. Raymond <esr@snark.thyrsus.com>
257
258 * vc.el (vc-next-action): Rewrite completely; this principal
259 entry point now operates on a current fileset selected either
260 explicitly via VC-Dired or implicitly by visiting a file buffer,
261 rather than always operating on the file of the current buffer as
262 in older versions. Rewrite the rest of the mode to match.
263 (with-vc-properties): Rewrite to operate on a file list.
264 (with-vc-file): vc-checkin takes a file list argument now.
265 (vc-post-command-functions): This hook now receives a file list.
266 (vc-do-command): Take a either a file or a file list as argument.
267 (vc-deduce-fileset): New function for deducing a file list to
268 operate on.
269 (vc-next-action-on-file, vc-next-action-dired): Remove.
270 Merge into vc-next-action.
271 (vc-register): Adapt to the fact that vc-start-entry now takes a
272 file list.
273 (vc-register-with): New function.
274 (vc-start-entry): Take a file list argument rather than a
275 file argument.
276 (vc-checkout): Cope with vc-start-entry taking a file list.
277 (vc-steal-lock): Cope with with-vc-properties taking a
278 file list.
279 (vc-checkin): Take a file list argument rather than a file argument.
280 (vc-finish-logentry): Use the filelist passed by vc-start-entry.
281 (vc-diff-internal): Rewrite for filesets.
282 (vc-diff-sentinel): New function, tests whether changes were
283 written into a diff buffer.
284 (vc-diff): Rewrite for filesets.
285 (vc-version-diff): Rewrite for filesets.
286 (vc-print-log): Take a fileset argument.
287 (vc-revert): Revert the entire selected fileset, not just the
288 current buffer.
289 (vc-rollback): Roll back the entire selected fileset, if
290 possible. No longer accepts a prefix argument.
291 (vc-update): Merge new changes for the entire selected
292 fileset, not just the current buffer.
293 (vc-revert-file): Cope with with-vc-properties taking a file list.
294 (vc-default-dired-state-info): Add + status suffix if the file is
295 modified.
296 (vc-annotate-warp-version): Use the new diff machinery.
297 (vc-log-edit): Take a file list argument rather than a file argument.
298
2992007-10-10 Michael Albinus <michael.albinus@gmx.de>
300
301 Sync with Tramp 2.1.11.
302
303 * net/tramp.el (tramp-open-connection-setup-interactive-shell):
304 Pacify byte compiler.
305
306 * net/trampver.el: Update release number.
307
12007-10-09 Juanma Barranquero <lekktu@gmail.com> 3082007-10-09 Juanma Barranquero <lekktu@gmail.com>
2 309
3 * follow.el: Require easymenu. 310 * follow.el: Require easymenu.
@@ -11,7 +318,7 @@
11 (handle-select-window): When autoselecting window set input 318 (handle-select-window): When autoselecting window set input
12 focus. Restructure. 319 focus. Restructure.
13 320
14 * frame.el (focus-follows-mouse): Moved to frame.c. 321 * frame.el (focus-follows-mouse): Move to frame.c.
15 * cus-start.el (all): Add focus-follows-mouse. 322 * cus-start.el (all): Add focus-follows-mouse.
16 323
172007-10-08 Juanma Barranquero <lekktu@gmail.com> 3242007-10-08 Juanma Barranquero <lekktu@gmail.com>
@@ -210,10 +517,10 @@
210 517
2112007-10-08 Stefan Monnier <monnier@iro.umontreal.ca> 5182007-10-08 Stefan Monnier <monnier@iro.umontreal.ca>
212 519
213 * pcvs.el (cvs-mode-add-change-log-entry-other-window): Use 520 * pcvs.el (cvs-mode-add-change-log-entry-other-window):
214 add-log-buffer-file-name-function rather than bind buffer-file-name, 521 Use add-log-buffer-file-name-function rather than binding
215 so we dont end up calling change-log-mode in *cvs* when `fi' is the 522 buffer-file-name, so we don't end up calling change-log-mode in *cvs*
216 ChangeLog file itself. 523 when `fi' is the ChangeLog file itself.
217 524
218 * outline.el (outline-flag-region): Use front-advance. 525 * outline.el (outline-flag-region): Use front-advance.
219 526
diff --git a/lisp/add-log.el b/lisp/add-log.el
index 546f87b4e4d..a58d6318670 100644
--- a/lisp/add-log.el
+++ b/lisp/add-log.el
@@ -379,7 +379,7 @@ With a numeric prefix ARG, go back ARG comments."
379 379
380(defun change-log-version-number-search () 380(defun change-log-version-number-search ()
381 "Return version number of current buffer's file. 381 "Return version number of current buffer's file.
382This is the value returned by `vc-workfile-version' or, if that is 382This is the value returned by `vc-working-revision' or, if that is
383nil, by matching `change-log-version-number-regexp-list'." 383nil, by matching `change-log-version-number-regexp-list'."
384 (let* ((size (buffer-size)) 384 (let* ((size (buffer-size))
385 (limit 385 (limit
@@ -390,7 +390,7 @@ nil, by matching `change-log-version-number-regexp-list'."
390 ;; Apply percentage only if buffer size is bigger than 390 ;; Apply percentage only if buffer size is bigger than
391 ;; approx 100 lines. 391 ;; approx 100 lines.
392 (if (> size (* 100 80)) (+ (point) (/ size 10))))) 392 (if (> size (* 100 80)) (+ (point) (/ size 10)))))
393 (or (and buffer-file-name (vc-workfile-version buffer-file-name)) 393 (or (and buffer-file-name (vc-working-revision buffer-file-name))
394 (save-restriction 394 (save-restriction
395 (widen) 395 (widen)
396 (let ((regexps change-log-version-number-regexp-list) 396 (let ((regexps change-log-version-number-regexp-list)
diff --git a/lisp/bs.el b/lisp/bs.el
index 4d13c97c2fd..6390bd2dd81 100644
--- a/lisp/bs.el
+++ b/lisp/bs.el
@@ -864,35 +864,32 @@ the status of buffer on current line."
864 (bs--set-window-height) 864 (bs--set-window-height)
865 (bs--show-config-message what)) 865 (bs--show-config-message what))
866 866
867(defun bs--mark-unmark (count fun)
868 "Call FUN on COUNT consecutive buffers of *buffer-selection*."
869 (let ((dir (if (> count 0) 1 -1)))
870 (dotimes (i (abs count))
871 (let ((buffer (bs--current-buffer)))
872 (when buffer (funcall fun buffer))
873 (bs--update-current-line)
874 (bs-down dir)))))
875
867(defun bs-mark-current (count) 876(defun bs-mark-current (count)
868 "Mark buffers. 877 "Mark buffers.
869COUNT is the number of buffers to mark. 878COUNT is the number of buffers to mark.
870Move cursor vertically down COUNT lines." 879Move cursor vertically down COUNT lines."
871 (interactive "p") 880 (interactive "p")
872 (let ((dir (if (> count 0) 1 -1)) 881 (bs--mark-unmark count
873 (count (abs count))) 882 (lambda (buf)
874 (while (> count 0) 883 (add-to-list 'bs--marked-buffers buf))))
875 (let ((buffer (bs--current-buffer)))
876 (if buffer
877 (setq bs--marked-buffers (cons buffer bs--marked-buffers)))
878 (bs--update-current-line)
879 (bs-down dir))
880 (setq count (1- count)))))
881 884
882(defun bs-unmark-current (count) 885(defun bs-unmark-current (count)
883 "Unmark buffers. 886 "Unmark buffers.
884COUNT is the number of buffers to unmark. 887COUNT is the number of buffers to unmark.
885Move cursor vertically down COUNT lines." 888Move cursor vertically down COUNT lines."
886 (interactive "p") 889 (interactive "p")
887 (let ((dir (if (> count 0) 1 -1)) 890 (bs--mark-unmark count
888 (count (abs count))) 891 (lambda (buf)
889 (while (> count 0) 892 (setq bs--marked-buffers (delq buf bs--marked-buffers)))))
890 (let ((buffer (bs--current-buffer)))
891 (if buffer
892 (setq bs--marked-buffers (delq buffer bs--marked-buffers)))
893 (bs--update-current-line)
894 (bs-down dir))
895 (setq count (1- count)))))
896 893
897(defun bs--show-config-message (what) 894(defun bs--show-config-message (what)
898 "Show message indicating the new showing status WHAT. 895 "Show message indicating the new showing status WHAT.
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 8f7ad22dce6..3bc83604227 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -2682,7 +2682,12 @@ try matching its doc string against `custom-guess-doc-alist'."
2682 `(("Set for Current Session" custom-variable-set 2682 `(("Set for Current Session" custom-variable-set
2683 (lambda (widget) 2683 (lambda (widget)
2684 (eq (widget-get widget :custom-state) 'modified))) 2684 (eq (widget-get widget :custom-state) 'modified)))
2685 ,@(when (or custom-file user-init-file) 2685 ;; Note that in all the backquoted code in this file, we test
2686 ;; init-file-user rather than user-init-file. This is in case
2687 ;; cus-edit is loaded by something in site-start.el, because
2688 ;; user-init-file is not set at that stage.
2689 ;; http://lists.gnu.org/archive/html/emacs-devel/2007-10/msg00310.html
2690 ,@(when (or custom-file init-file-user)
2686 '(("Save for Future Sessions" custom-variable-save 2691 '(("Save for Future Sessions" custom-variable-save
2687 (lambda (widget) 2692 (lambda (widget)
2688 (memq (widget-get widget :custom-state) 2693 (memq (widget-get widget :custom-state)
@@ -2697,7 +2702,7 @@ try matching its doc string against `custom-guess-doc-alist'."
2697 (get (widget-value widget) 'saved-variable-comment)) 2702 (get (widget-value widget) 'saved-variable-comment))
2698 (memq (widget-get widget :custom-state) 2703 (memq (widget-get widget :custom-state)
2699 '(modified set changed rogue))))) 2704 '(modified set changed rogue)))))
2700 ,@(when (or custom-file user-init-file) 2705 ,@(when (or custom-file init-file-user)
2701 '(("Erase Customization" custom-variable-reset-standard 2706 '(("Erase Customization" custom-variable-reset-standard
2702 (lambda (widget) 2707 (lambda (widget)
2703 (and (get (widget-value widget) 'standard-value) 2708 (and (get (widget-value widget) 'standard-value)
@@ -3371,7 +3376,7 @@ SPEC must be a full face spec."
3371 3376
3372(defvar custom-face-menu 3377(defvar custom-face-menu
3373 `(("Set for Current Session" custom-face-set) 3378 `(("Set for Current Session" custom-face-set)
3374 ,@(when (or custom-file user-init-file) 3379 ,@(when (or custom-file init-file-user)
3375 '(("Save for Future Sessions" custom-face-save))) 3380 '(("Save for Future Sessions" custom-face-save)))
3376 ("Undo Edits" custom-redraw 3381 ("Undo Edits" custom-redraw
3377 (lambda (widget) 3382 (lambda (widget)
@@ -3380,7 +3385,7 @@ SPEC must be a full face spec."
3380 (lambda (widget) 3385 (lambda (widget)
3381 (or (get (widget-value widget) 'saved-face) 3386 (or (get (widget-value widget) 'saved-face)
3382 (get (widget-value widget) 'saved-face-comment)))) 3387 (get (widget-value widget) 'saved-face-comment))))
3383 ,@(when (or custom-file user-init-file) 3388 ,@(when (or custom-file init-file-user)
3384 '(("Erase Customization" custom-face-reset-standard 3389 '(("Erase Customization" custom-face-reset-standard
3385 (lambda (widget) 3390 (lambda (widget)
3386 (get (widget-value widget) 'face-defface-spec))))) 3391 (get (widget-value widget) 'face-defface-spec)))))
@@ -3978,7 +3983,7 @@ Creating group members... %2d%%"
3978 `(("Set for Current Session" custom-group-set 3983 `(("Set for Current Session" custom-group-set
3979 (lambda (widget) 3984 (lambda (widget)
3980 (eq (widget-get widget :custom-state) 'modified))) 3985 (eq (widget-get widget :custom-state) 'modified)))
3981 ,@(when (or custom-file user-init-file) 3986 ,@(when (or custom-file init-file-user)
3982 '(("Save for Future Sessions" custom-group-save 3987 '(("Save for Future Sessions" custom-group-save
3983 (lambda (widget) 3988 (lambda (widget)
3984 (memq (widget-get widget :custom-state) '(modified set)))))) 3989 (memq (widget-get widget :custom-state) '(modified set))))))
@@ -3988,7 +3993,7 @@ Creating group members... %2d%%"
3988 ("Reset to Saved" custom-group-reset-saved 3993 ("Reset to Saved" custom-group-reset-saved
3989 (lambda (widget) 3994 (lambda (widget)
3990 (memq (widget-get widget :custom-state) '(modified set)))) 3995 (memq (widget-get widget :custom-state) '(modified set))))
3991 ,@(when (or custom-file user-init-file) 3996 ,@(when (or custom-file init-file-user)
3992 '(("Erase Customization" custom-group-reset-standard 3997 '(("Erase Customization" custom-group-reset-standard
3993 (lambda (widget) 3998 (lambda (widget)
3994 (memq (widget-get widget :custom-state) '(modified set saved))))))) 3999 (memq (widget-get widget :custom-state) '(modified set saved)))))))
diff --git a/lisp/cus-start.el b/lisp/cus-start.el
index ee6491a1a79..53245d902ae 100644
--- a/lisp/cus-start.el
+++ b/lisp/cus-start.el
@@ -436,7 +436,7 @@ since it could result in memory overflow and make Emacs crash."
436 ((string-match "\\`w32-" (symbol-name symbol)) 436 ((string-match "\\`w32-" (symbol-name symbol))
437 (eq system-type 'windows-nt)) 437 (eq system-type 'windows-nt))
438 ((string-match "\\`mac-" (symbol-name symbol)) 438 ((string-match "\\`mac-" (symbol-name symbol))
439 (or (eq system-type 'mac) (eq system-type 'darwin))) 439 (eq window-system 'mac))
440 ((string-match "\\`x-.*gtk" (symbol-name symbol)) 440 ((string-match "\\`x-.*gtk" (symbol-name symbol))
441 (featurep 'gtk)) 441 (featurep 'gtk))
442 ((string-match "\\`x-" (symbol-name symbol)) 442 ((string-match "\\`x-" (symbol-name symbol))
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el
index 609c5ef6490..894a12b1193 100644
--- a/lisp/diff-mode.el
+++ b/lisp/diff-mode.el
@@ -1578,6 +1578,10 @@ then `diff-jump-to-old-file' is also set, for the next invocations."
1578(defun diff-current-defun () 1578(defun diff-current-defun ()
1579 "Find the name of function at point. 1579 "Find the name of function at point.
1580For use in `add-log-current-defun-function'." 1580For use in `add-log-current-defun-function'."
1581 ;; Kill change-log-default-name so it gets recomputed each time, since
1582 ;; each hunk may belong to another file which may belong to another
1583 ;; directory and hence have a different ChangeLog file.
1584 (kill-local-variable 'change-log-default-name)
1581 (save-excursion 1585 (save-excursion
1582 (when (looking-at diff-hunk-header-re) 1586 (when (looking-at diff-hunk-header-re)
1583 (forward-line 1) 1587 (forward-line 1)
@@ -1649,7 +1653,8 @@ For use in `add-log-current-defun-function'."
1649 1653
1650(defface diff-fine-change 1654(defface diff-fine-change
1651 '((t :background "yellow")) 1655 '((t :background "yellow"))
1652 "Face used for char-based changes shown by `diff-fine-highlight'.") 1656 "Face used for char-based changes shown by `diff-fine-highlight'."
1657 :group 'diff-mode)
1653 1658
1654(defun diff-fine-highlight-preproc () 1659(defun diff-fine-highlight-preproc ()
1655 (while (re-search-forward "^." nil t) 1660 (while (re-search-forward "^." nil t)
diff --git a/lisp/ediff-vers.el b/lisp/ediff-vers.el
index d0a323980c2..8480984b95c 100644
--- a/lisp/ediff-vers.el
+++ b/lisp/ediff-vers.el
@@ -84,12 +84,12 @@ comparison or merge operations are being performed."
84 (setq rev1 (ediff-vc-latest-version (buffer-file-name)))) 84 (setq rev1 (ediff-vc-latest-version (buffer-file-name))))
85 (save-window-excursion 85 (save-window-excursion
86 (save-excursion 86 (save-excursion
87 (vc-version-other-window rev1) 87 (vc-revision-other-window rev1)
88 (setq rev1buf (current-buffer) 88 (setq rev1buf (current-buffer)
89 file1 (buffer-file-name))) 89 file1 (buffer-file-name)))
90 (save-excursion 90 (save-excursion
91 (or (string= rev2 "") ; use current buffer 91 (or (string= rev2 "") ; use current buffer
92 (vc-version-other-window rev2)) 92 (vc-revision-other-window rev2))
93 (setq rev2buf (current-buffer) 93 (setq rev2buf (current-buffer)
94 file2 (buffer-file-name))) 94 file2 (buffer-file-name)))
95 (setq startup-hooks 95 (setq startup-hooks
@@ -191,17 +191,17 @@ comparison or merge operations are being performed."
191 (let (buf1 buf2 ancestor-buf) 191 (let (buf1 buf2 ancestor-buf)
192 (save-window-excursion 192 (save-window-excursion
193 (save-excursion 193 (save-excursion
194 (vc-version-other-window rev1) 194 (vc-revision-other-window rev1)
195 (setq buf1 (current-buffer))) 195 (setq buf1 (current-buffer)))
196 (save-excursion 196 (save-excursion
197 (or (string= rev2 "") 197 (or (string= rev2 "")
198 (vc-version-other-window rev2)) 198 (vc-revision-other-window rev2))
199 (setq buf2 (current-buffer))) 199 (setq buf2 (current-buffer)))
200 (if ancestor-rev 200 (if ancestor-rev
201 (save-excursion 201 (save-excursion
202 (if (string= ancestor-rev "") 202 (if (string= ancestor-rev "")
203 (setq ancestor-rev (vc-workfile-version buffer-file-name))) 203 (setq ancestor-rev (vc-working-revision buffer-file-name)))
204 (vc-version-other-window ancestor-rev) 204 (vc-revision-other-window ancestor-rev)
205 (setq ancestor-buf (current-buffer)))) 205 (setq ancestor-buf (current-buffer))))
206 (setq startup-hooks 206 (setq startup-hooks
207 (cons 207 (cons
diff --git a/lisp/emacs-lisp/byte-opt.el b/lisp/emacs-lisp/byte-opt.el
index 2ab57f9c0d4..60f1cdd3754 100644
--- a/lisp/emacs-lisp/byte-opt.el
+++ b/lisp/emacs-lisp/byte-opt.el
@@ -2012,17 +2012,17 @@ If FOR-EFFECT is non-nil, the return value is assumed to be of no importance."
2012 (assq 'byte-code (symbol-function 'byte-optimize-form)) 2012 (assq 'byte-code (symbol-function 'byte-optimize-form))
2013 (let ((byte-optimize nil) 2013 (let ((byte-optimize nil)
2014 (byte-compile-warnings nil)) 2014 (byte-compile-warnings nil))
2015 (mapcar (lambda (x) 2015 (mapc (lambda (x)
2016 (or noninteractive (message "compiling %s..." x)) 2016 (or noninteractive (message "compiling %s..." x))
2017 (byte-compile x) 2017 (byte-compile x)
2018 (or noninteractive (message "compiling %s...done" x))) 2018 (or noninteractive (message "compiling %s...done" x)))
2019 '(byte-optimize-form 2019 '(byte-optimize-form
2020 byte-optimize-body 2020 byte-optimize-body
2021 byte-optimize-predicate 2021 byte-optimize-predicate
2022 byte-optimize-binary-predicate 2022 byte-optimize-binary-predicate
2023 ;; Inserted some more than necessary, to speed it up. 2023 ;; Inserted some more than necessary, to speed it up.
2024 byte-optimize-form-code-walker 2024 byte-optimize-form-code-walker
2025 byte-optimize-lapcode)))) 2025 byte-optimize-lapcode))))
2026 nil) 2026 nil)
2027 2027
2028;; arch-tag: 0f14076b-737e-4bef-aae6-908826ec1ff1 2028;; arch-tag: 0f14076b-737e-4bef-aae6-908826ec1ff1
diff --git a/lisp/env.el b/lisp/env.el
index 128228be3db..90d576dc71d 100644
--- a/lisp/env.el
+++ b/lisp/env.el
@@ -47,15 +47,14 @@ Optional second arg MUSTMATCH, if non-nil, means require existing envvar name.
47If it is also not t, RET does not exit if it does non-null completion." 47If it is also not t, RET does not exit if it does non-null completion."
48 (completing-read prompt 48 (completing-read prompt
49 (mapcar (lambda (enventry) 49 (mapcar (lambda (enventry)
50 (list (if enable-multibyte-characters 50 (let ((str (substring enventry 0
51 (decode-coding-string 51 (string-match "=" enventry))))
52 (substring enventry 0 52 (if (multibyte-string-p str)
53 (string-match "=" enventry)) 53 (decode-coding-string
54 locale-coding-system t) 54 str locale-coding-system t)
55 (substring enventry 0 55 str)))
56 (string-match "=" enventry)))))
57 (append process-environment 56 (append process-environment
58 nil ;;(frame-parameter (frame-with-environment) 'environment) 57 ;;(frame-environment)
59 )) 58 ))
60 nil mustmatch nil 'read-envvar-name-history)) 59 nil mustmatch nil 'read-envvar-name-history))
61 60
@@ -128,7 +127,7 @@ Changes ENV by side-effect, and returns its new value."
128 127
129;; Fixme: Should the environment be recoded if LC_CTYPE &c is set? 128;; Fixme: Should the environment be recoded if LC_CTYPE &c is set?
130 129
131(defun setenv (variable &optional value substitute-env-vars frame) 130(defun setenv (variable &optional value substitute-env-vars)
132 "Set the value of the environment variable named VARIABLE to VALUE. 131 "Set the value of the environment variable named VARIABLE to VALUE.
133VARIABLE should be a string. VALUE is optional; if not provided or 132VARIABLE should be a string. VALUE is optional; if not provided or
134nil, the environment variable VARIABLE will be removed. 133nil, the environment variable VARIABLE will be removed.
@@ -143,19 +142,11 @@ SUBSTITUTE-ENV-VARS, if non-nil, means to substitute environment
143variables in VALUE with `substitute-env-vars', which see. 142variables in VALUE with `substitute-env-vars', which see.
144This is normally used only for interactive calls. 143This is normally used only for interactive calls.
145 144
146If optional parameter FRAME is non-nil, this function modifies
147only the frame-local value of VARIABLE on FRAME, ignoring
148`process-environment'. Note that frames on the same terminal
149device usually share their environment, so calling `setenv' on
150one of them affects the others as well.
151
152If FRAME is nil, `setenv' changes the global value of VARIABLE by
153modifying `process-environment'. Note that the global value
154overrides any frame-local values.
155
156The return value is the new value of VARIABLE, or nil if 145The return value is the new value of VARIABLE, or nil if
157it was removed from the environment. 146it was removed from the environment.
158 147
148This function works by modifying `process-environment'.
149
159As a special case, setting variable `TZ' calls `set-time-zone-rule' as 150As a special case, setting variable `TZ' calls `set-time-zone-rule' as
160a side-effect." 151a side-effect."
161 (interactive 152 (interactive
@@ -188,12 +179,8 @@ a side-effect."
188 (error "Environment variable name `%s' contains `='" variable)) 179 (error "Environment variable name `%s' contains `='" variable))
189 (if (string-equal "TZ" variable) 180 (if (string-equal "TZ" variable)
190 (set-time-zone-rule value)) 181 (set-time-zone-rule value))
191 (if (null frame) 182 (setq process-environment (setenv-internal process-environment
192 (setq process-environment (setenv-internal process-environment 183 variable value t))
193 variable value t))
194 (setq frame (frame-with-environment frame))
195 (setq process-environment (setenv-internal process-environment
196 variable value nil)))
197 value) 184 value)
198 185
199(defun getenv (variable &optional frame) 186(defun getenv (variable &optional frame)
@@ -238,8 +225,7 @@ Non-ASCII characters are encoded according to the initial value of
238`locale-coding-system', i.e. the elements must normally be decoded for use. 225`locale-coding-system', i.e. the elements must normally be decoded for use.
239See `setenv' and `getenv'." 226See `setenv' and `getenv'."
240 (let* ((env (append process-environment 227 (let* ((env (append process-environment
241;; (frame-parameter (frame-with-environment frame) 228 ;; (frame-environment frame)
242;; 'environment)
243 nil)) 229 nil))
244 (scan env) 230 (scan env)
245 prev seen) 231 prev seen)
@@ -269,45 +255,6 @@ See `setenv' and `getenv'."
269 scan (cdr scan)))) 255 scan (cdr scan))))
270 env)) 256 env))
271 257
272(defmacro let-environment (varlist &rest body)
273 "Evaluate BODY with environment variables set according to VARLIST.
274The environment variables are then restored to their previous
275values.
276The value of the last form in BODY is returned.
277
278Each element of VARLIST is either a string (which variable is
279then removed from the environment), or a list (NAME
280VALUEFORM) (which sets NAME to the value of VALUEFORM, a string).
281All the VALUEFORMs are evaluated before any variables are set."
282 (declare (indent 2))
283 (let ((old-env (make-symbol "old-env"))
284 (name (make-symbol "name"))
285 (value (make-symbol "value"))
286 (entry (make-symbol "entry"))
287 (frame (make-symbol "frame")))
288 `(let ((,frame (selected-frame))
289 ,old-env)
290 ;; Evaluate VALUEFORMs and replace them in VARLIST with their values.
291 (dolist (,entry ,varlist)
292 (unless (stringp ,entry)
293 (if (cdr (cdr ,entry))
294 (error "`let-environment' bindings can have only one value-form"))
295 (setcdr ,entry (eval (cadr ,entry)))))
296 ;; Set the variables.
297 (dolist (,entry ,varlist)
298 (let ((,name (if (stringp ,entry) ,entry (car ,entry)))
299 (,value (if (consp ,entry) (cdr ,entry))))
300 (setq ,old-env (cons (cons ,name (getenv ,name)) ,old-env))
301 (setenv ,name ,value)))
302 (unwind-protect
303 (progn ,@body)
304 ;; Restore old values.
305 (with-selected-frame (if (frame-live-p ,frame)
306 ,frame
307 (selected-frame))
308 (dolist (,entry ,old-env)
309 (setenv (car ,entry) (cdr ,entry))))))))
310
311(provide 'env) 258(provide 'env)
312 259
313;; arch-tag: b7d6a8f7-bc81-46db-8e39-8d721d4ed0b8 260;; arch-tag: b7d6a8f7-bc81-46db-8e39-8d721d4ed0b8
diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog
index f262a6324fb..fb824f08996 100644
--- a/lisp/erc/ChangeLog
+++ b/lisp/erc/ChangeLog
@@ -1,3 +1,8 @@
12007-10-13 Glenn Morris <rgm@gnu.org>
2
3 * erc-track.el (erc-modified-channels-update): Use mapc rather
4 than mapcar.
5
12007-09-18 Exal de Jesus Garcia Carrillo <exal@gmx.de> (tiny change) 62007-09-18 Exal de Jesus Garcia Carrillo <exal@gmx.de> (tiny change)
2 7
3 * erc.texi (Special-Features): Fix small typo. 8 * erc.texi (Special-Features): Fix small typo.
diff --git a/lisp/erc/erc-track.el b/lisp/erc/erc-track.el
index 1408adcd942..ad3eaf73a4b 100644
--- a/lisp/erc/erc-track.el
+++ b/lisp/erc/erc-track.el
@@ -701,17 +701,17 @@ ARGS are ignored."
701 (unless erc-modified-channels-update-inside 701 (unless erc-modified-channels-update-inside
702 (let ((erc-modified-channels-update-inside t) 702 (let ((erc-modified-channels-update-inside t)
703 (removed-channel nil)) 703 (removed-channel nil))
704 (mapcar (lambda (elt) 704 (mapc (lambda (elt)
705 (let ((buffer (car elt))) 705 (let ((buffer (car elt)))
706 (when (or (not (bufferp buffer)) 706 (when (or (not (bufferp buffer))
707 (not (buffer-live-p buffer)) 707 (not (buffer-live-p buffer))
708 (erc-buffer-visible buffer) 708 (erc-buffer-visible buffer)
709 (and erc-track-remove-disconnected-buffers 709 (and erc-track-remove-disconnected-buffers
710 (not (with-current-buffer buffer 710 (not (with-current-buffer buffer
711 erc-server-connected)))) 711 erc-server-connected))))
712 (setq removed-channel t) 712 (setq removed-channel t)
713 (erc-modified-channels-remove-buffer buffer)))) 713 (erc-modified-channels-remove-buffer buffer))))
714 erc-modified-channels-alist) 714 erc-modified-channels-alist)
715 (when removed-channel 715 (when removed-channel
716 (erc-modified-channels-display) 716 (erc-modified-channels-display)
717 (force-mode-line-update t))))) 717 (force-mode-line-update t)))))
diff --git a/lisp/follow.el b/lisp/follow.el
index e6538e5a350..55a331a22d3 100644
--- a/lisp/follow.el
+++ b/lisp/follow.el
@@ -37,7 +37,7 @@
37;; 37;;
38;; * The windows always display adjacent sections of the buffer. 38;; * The windows always display adjacent sections of the buffer.
39;; This means that whenever one window is moved, all the 39;; This means that whenever one window is moved, all the
40;; others will follow. (Hence the name Follow Mode.) 40;; others will follow. (Hence the name Follow mode.)
41;; 41;;
42;; * Should the point (cursor) end up outside a window, another 42;; * Should the point (cursor) end up outside a window, another
43;; window displaying that point is selected, if possible. This 43;; window displaying that point is selected, if possible. This
@@ -149,15 +149,15 @@
149;; The following is a list of commands useful when follow-mode is active. 149;; The following is a list of commands useful when follow-mode is active.
150;; 150;;
151;; follow-scroll-up C-c . C-v 151;; follow-scroll-up C-c . C-v
152;; Scroll text in a Follow Mode window chain up. 152;; Scroll text in a Follow mode window chain up.
153;; 153;;
154;; follow-scroll-down C-c . v 154;; follow-scroll-down C-c . v
155;; Like `follow-scroll-up', but in the other direction. 155;; Like `follow-scroll-up', but in the other direction.
156;; 156;;
157;; follow-delete-other-windows-and-split C-c . 1 157;; follow-delete-other-windows-and-split C-c . 1
158;; Maximize the visible area of the current buffer, 158;; Maximize the visible area of the current buffer,
159;; and enter Follow Mode. This is a very convenient 159;; and enter Follow mode. This is a very convenient
160;; way to start Follow Mode, hence we recomend that 160;; way to start Follow mode, hence we recomend that
161;; this command be added to the global keymap. 161;; this command be added to the global keymap.
162;; 162;;
163;; follow-recenter C-c . C-l 163;; follow-recenter C-c . C-l
@@ -330,7 +330,7 @@ After that, changing the prefix key requires manipulating keymaps."
330 330
331 (define-key mainmap follow-mode-prefix map) 331 (define-key mainmap follow-mode-prefix map)
332 332
333 ;; Replace the standard `end-of-buffer', when in Follow Mode. (I 333 ;; Replace the standard `end-of-buffer', when in Follow mode. (I
334 ;; don't see the point in trying to replace every function that 334 ;; don't see the point in trying to replace every function that
335 ;; could be enhanced in Follow mode. End-of-buffer is a special 335 ;; could be enhanced in Follow mode. End-of-buffer is a special
336 ;; case since it is very simple to define and it greatly enhances 336 ;; case since it is very simple to define and it greatly enhances
@@ -343,9 +343,9 @@ After that, changing the prefix key requires manipulating keymaps."
343;; When the mode is not activated, only one item is visible to activate 343;; When the mode is not activated, only one item is visible to activate
344;; the mode. 344;; the mode.
345(defun follow-menu-filter (menu) 345(defun follow-menu-filter (menu)
346 (if (bound-and-true-p 'follow-mode) 346 (if (bound-and-true-p follow-mode)
347 menu 347 menu
348 '(["Follow mode " follow-mode 348 '(["Follow mode" follow-mode
349 :style toggle :selected follow-mode]))) 349 :style toggle :selected follow-mode])))
350 350
351;; If there is a `tools' menu, we use it. However, we can't add a 351;; If there is a `tools' menu, we use it. However, we can't add a
@@ -391,7 +391,7 @@ are \" Fw\", or simply \"\"."
391 :group 'follow) 391 :group 'follow)
392 392
393(defcustom follow-intercept-processes (fboundp 'start-process) 393(defcustom follow-intercept-processes (fboundp 'start-process)
394 "When non-nil, Follow Mode will monitor process output." 394 "When non-nil, Follow mode will monitor process output."
395 :type 'boolean 395 :type 'boolean
396 :group 'follow) 396 :group 'follow)
397 397
@@ -401,11 +401,11 @@ are \" Fw\", or simply \"\"."
401A \"tail window\" is a window that displays only the end of 401A \"tail window\" is a window that displays only the end of
402the buffer. Normally it is practical for the user that empty 402the buffer. Normally it is practical for the user that empty
403windows are recentered automatically. However, when using 403windows are recentered automatically. However, when using
404Follow Mode it breaks the display when the end is displayed 404Follow mode it breaks the display when the end is displayed
405in a window \"above\" the last window. This is for 405in a window \"above\" the last window. This is for
406example the case when displaying a short page in info. 406example the case when displaying a short page in info.
407 407
408Must be set before Follow Mode is loaded. 408Must be set before Follow mode is loaded.
409 409
410Please note that it is not possible to fully prevent Emacs from 410Please note that it is not possible to fully prevent Emacs from
411recentering empty windows. Please report if you find a repeatable 411recentering empty windows. Please report if you find a repeatable
@@ -494,7 +494,7 @@ of two major techniques:
494 494
495* The windows always displays adjacent sections of the buffer. 495* The windows always displays adjacent sections of the buffer.
496 This means that whenever one window is moved, all the 496 This means that whenever one window is moved, all the
497 others will follow. (Hence the name Follow Mode.) 497 others will follow. (Hence the name Follow mode.)
498 498
499* Should the point (cursor) end up outside a window, another 499* Should the point (cursor) end up outside a window, another
500 window displaying that point is selected, if possible. This 500 window displaying that point is selected, if possible. This
@@ -545,7 +545,7 @@ Keys specific to Follow mode:
545(add-hook 'find-file-hook 'follow-find-file-hook t) 545(add-hook 'find-file-hook 'follow-find-file-hook t)
546 546
547(defun follow-find-file-hook () 547(defun follow-find-file-hook ()
548 "Find-file hook for Follow Mode. See the variable `follow-auto'." 548 "Find-file hook for Follow mode. See the variable `follow-auto'."
549 (if follow-auto (follow-mode t))) 549 (if follow-auto (follow-mode t)))
550 550
551;;}}} 551;;}}}
@@ -558,7 +558,7 @@ Keys specific to Follow mode:
558 558
559;;{{{ Scroll 559;;{{{ Scroll
560 560
561;; `scroll-up' and `-down', but for windows in Follow Mode. 561;; `scroll-up' and `-down', but for windows in Follow mode.
562;; 562;;
563;; Almost like the real thing, excpet when the cursor ends up outside 563;; Almost like the real thing, excpet when the cursor ends up outside
564;; the top or bottom... In our case however, we end up outside the 564;; the top or bottom... In our case however, we end up outside the
@@ -574,7 +574,7 @@ Keys specific to Follow mode:
574;; good redisplay abstraction.) 574;; good redisplay abstraction.)
575 575
576(defun follow-scroll-up (&optional arg) 576(defun follow-scroll-up (&optional arg)
577 "Scroll text in a Follow Mode window chain up. 577 "Scroll text in a Follow mode window chain up.
578 578
579If called with no ARG, the `next-screen-context-lines' last lines of 579If called with no ARG, the `next-screen-context-lines' last lines of
580the bottom window in the chain will be visible in the top window. 580the bottom window in the chain will be visible in the top window.
@@ -582,7 +582,7 @@ the bottom window in the chain will be visible in the top window.
582If called with an argument, scroll ARG lines up. 582If called with an argument, scroll ARG lines up.
583Negative ARG means scroll downward. 583Negative ARG means scroll downward.
584 584
585Works like `scroll-up' when not in Follow Mode." 585Works like `scroll-up' when not in Follow mode."
586 (interactive "P") 586 (interactive "P")
587 (cond ((not (and (boundp 'follow-mode) follow-mode)) 587 (cond ((not (and (boundp 'follow-mode) follow-mode))
588 (scroll-up arg)) 588 (scroll-up arg))
@@ -603,7 +603,7 @@ Works like `scroll-up' when not in Follow Mode."
603 603
604 604
605(defun follow-scroll-down (&optional arg) 605(defun follow-scroll-down (&optional arg)
606 "Scroll text in a Follow Mode window chain down. 606 "Scroll text in a Follow mode window chain down.
607 607
608If called with no ARG, the `next-screen-context-lines' top lines of 608If called with no ARG, the `next-screen-context-lines' top lines of
609the top window in the chain will be visible in the bottom window. 609the top window in the chain will be visible in the bottom window.
@@ -611,7 +611,7 @@ the top window in the chain will be visible in the bottom window.
611If called with an argument, scroll ARG lines down. 611If called with an argument, scroll ARG lines down.
612Negative ARG means scroll upward. 612Negative ARG means scroll upward.
613 613
614Works like `scroll-up' when not in Follow Mode." 614Works like `scroll-up' when not in Follow mode."
615 (interactive "P") 615 (interactive "P")
616 (cond ((not (and (boundp 'follow-mode) follow-mode)) 616 (cond ((not (and (boundp 'follow-mode) follow-mode))
617 (scroll-up arg)) 617 (scroll-up arg))
@@ -638,12 +638,12 @@ Works like `scroll-up' when not in Follow Mode."
638 638
639;;;###autoload 639;;;###autoload
640(defun follow-delete-other-windows-and-split (&optional arg) 640(defun follow-delete-other-windows-and-split (&optional arg)
641 "Create two side by side windows and enter Follow Mode. 641 "Create two side by side windows and enter Follow mode.
642 642
643Execute this command to display as much as possible of the text 643Execute this command to display as much as possible of the text
644in the selected window. All other windows, in the current 644in the selected window. All other windows, in the current
645frame, are deleted and the selected window is split in two 645frame, are deleted and the selected window is split in two
646side-by-side windows. Follow Mode is activated, hence the 646side-by-side windows. Follow mode is activated, hence the
647two windows always will display two successive pages. 647two windows always will display two successive pages.
648\(If one window is moved, the other one will follow.) 648\(If one window is moved, the other one will follow.)
649 649
@@ -671,7 +671,7 @@ in your `~/.emacs' file, replacing [f7] by your favourite key:
671 (follow-mode 1))) 671 (follow-mode 1)))
672 672
673(defun follow-switch-to-buffer (buffer) 673(defun follow-switch-to-buffer (buffer)
674 "Show BUFFER in all windows in the current Follow Mode window chain." 674 "Show BUFFER in all windows in the current Follow mode window chain."
675 (interactive "BSwitch to Buffer: ") 675 (interactive "BSwitch to Buffer: ")
676 (let ((orig-window (selected-window)) 676 (let ((orig-window (selected-window))
677 (windows (follow-all-followers))) 677 (windows (follow-all-followers)))
@@ -699,7 +699,7 @@ Defaults to current buffer."
699 699
700 700
701(defun follow-switch-to-current-buffer-all () 701(defun follow-switch-to-current-buffer-all ()
702 "Show current buffer in all windows on this frame, and enter Follow Mode. 702 "Show current buffer in all windows on this frame, and enter Follow mode.
703 703
704To bind this command to a hotkey place the following line 704To bind this command to a hotkey place the following line
705in your `~/.emacs' file: 705in your `~/.emacs' file:
@@ -796,10 +796,10 @@ Follow mode since the windows should always be aligned."
796;;{{{ End of buffer 796;;{{{ End of buffer
797 797
798(defun follow-end-of-buffer (&optional arg) 798(defun follow-end-of-buffer (&optional arg)
799 "Move point to the end of the buffer, Follow Mode style. 799 "Move point to the end of the buffer, Follow mode style.
800 800
801If the end is not visible, it will be displayed in the last possible 801If the end is not visible, it will be displayed in the last possible
802window in the Follow Mode window chain. 802window in the Follow mode window chain.
803 803
804The mark is left at the previous position. With arg N, put point N/10 804The mark is left at the previous position. With arg N, put point N/10
805of the way from the true end." 805of the way from the true end."
@@ -1315,7 +1315,7 @@ position of the first window. Otherwise it is a good guess."
1315 "Make sure windows displaying the end of a buffer aren't recentered. 1315 "Make sure windows displaying the end of a buffer aren't recentered.
1316 1316
1317This is done by reading and rewriting the start position of 1317This is done by reading and rewriting the start position of
1318non-first windows in Follow Mode." 1318non-first windows in Follow mode."
1319 (if follow-avoid-tail-recenter-p 1319 (if follow-avoid-tail-recenter-p
1320 (let* ((orig-buffer (current-buffer)) 1320 (let* ((orig-buffer (current-buffer))
1321 (top (frame-first-window (selected-frame))) 1321 (top (frame-first-window (selected-frame)))
@@ -1607,7 +1607,7 @@ non-first windows in Follow Mode."
1607 (after 1607 (after
1608 ,(intern (concat "follow-" (symbol-name (car cmds)))) 1608 ,(intern (concat "follow-" (symbol-name (car cmds))))
1609 activate) 1609 activate)
1610 "Adviced by Follow Mode." 1610 "Adviced by Follow mode."
1611 (follow-redraw-after-event (ad-get-arg 0)))) 1611 (follow-redraw-after-event (ad-get-arg 0))))
1612 (setq cmds (cdr cmds)))) 1612 (setq cmds (cdr cmds))))
1613 1613
@@ -1718,9 +1718,9 @@ WINDOW can be an object or a window."
1718;; filter... 1718;; filter...
1719 1719
1720(defadvice set-process-filter (before follow-set-process-filter activate) 1720(defadvice set-process-filter (before follow-set-process-filter activate)
1721 "Ensure process output will be displayed correctly in Follow Mode buffers. 1721 "Ensure process output will be displayed correctly in Follow mode buffers.
1722 1722
1723Follow Mode inserts its own process filter to do its 1723Follow mode inserts its own process filter to do its
1724magic stuff before the real process filter is called." 1724magic stuff before the real process filter is called."
1725 (if follow-intercept-processes 1725 (if follow-intercept-processes
1726 (progn 1726 (progn
@@ -1794,7 +1794,7 @@ magic stuff before the real process filter is called."
1794(defun follow-intercept-process-output () 1794(defun follow-intercept-process-output ()
1795 "Intercept all active processes. 1795 "Intercept all active processes.
1796 1796
1797This is needed so that Follow Mode can track all display events in the 1797This is needed so that Follow mode can track all display events in the
1798system. (See `follow-mode'.)" 1798system. (See `follow-mode'.)"
1799 (interactive) 1799 (interactive)
1800 (let ((list (process-list))) 1800 (let ((list (process-list)))
@@ -1808,7 +1808,7 @@ system. (See `follow-mode'.)"
1808 1808
1809 1809
1810(defun follow-stop-intercept-process-output () 1810(defun follow-stop-intercept-process-output ()
1811 "Stop Follow Mode from spying on processes. 1811 "Stop Follow mode from spying on processes.
1812 1812
1813All current spypoints are removed and no new will be added. 1813All current spypoints are removed and no new will be added.
1814 1814
@@ -1820,17 +1820,14 @@ would interfere with some other package. If this happens, please
1820report this using the `report-emacs-bug' function." 1820report this using the `report-emacs-bug' function."
1821 (interactive) 1821 (interactive)
1822 (follow-tidy-process-filter-alist) 1822 (follow-tidy-process-filter-alist)
1823 (let ((list (process-list))) 1823 (dolist (process (process-list))
1824 (while list 1824 (when (eq (follow-call-process-filter process) 'follow-generic-filter)
1825 (if (eq (process-filter (car list)) 'follow-generic-filter) 1825 (follow-call-set-process-filter
1826 (progn 1826 process
1827 (follow-call-set-process-filter 1827 (cdr-safe (assq process follow-process-filter-alist)))
1828 (car list) 1828 (setq follow-process-filter-alist
1829 (cdr-safe (assq (car list) follow-process-filter-alist))) 1829 (delq (assq process follow-process-filter-alist)
1830 (setq follow-process-filter-alist 1830 follow-process-filter-alist))))
1831 (delq (assq (car list) follow-process-filter-alist)
1832 follow-process-filter-alist))))
1833 (setq list (cdr list))))
1834 (setq follow-intercept-processes nil)) 1831 (setq follow-intercept-processes nil))
1835 1832
1836;;}}} 1833;;}}}
@@ -2073,7 +2070,7 @@ report this using the `report-emacs-bug' function."
2073;;{{{ Tail window handling 2070;;{{{ Tail window handling
2074 2071
2075;; In Emacs (not XEmacs) windows showing nothing are sometimes 2072;; In Emacs (not XEmacs) windows showing nothing are sometimes
2076;; recentered. When in Follow Mode, this is not desirable for 2073;; recentered. When in Follow mode, this is not desirable for
2077;; non-first windows in the window chain. This section tries to 2074;; non-first windows in the window chain. This section tries to
2078;; make the windows stay where they should be. 2075;; make the windows stay where they should be.
2079;; 2076;;
@@ -2107,10 +2104,10 @@ report this using the `report-emacs-bug' function."
2107 2104
2108(if follow-avoid-tail-recenter-p 2105(if follow-avoid-tail-recenter-p
2109 (defadvice sit-for (before follow-sit-for activate) 2106 (defadvice sit-for (before follow-sit-for activate)
2110 "Adviced by Follow Mode. 2107 "Adviced by Follow mode.
2111 2108
2112Avoid to recenter windows displaying only the end of a file as when 2109Avoid to recenter windows displaying only the end of a file as when
2113displaying a short file in two windows, using Follow Mode." 2110displaying a short file in two windows, using Follow mode."
2114 (follow-avoid-tail-recenter))) 2111 (follow-avoid-tail-recenter)))
2115 2112
2116 2113
@@ -2120,7 +2117,7 @@ displaying a short file in two windows, using Follow Mode."
2120(if (and follow-avoid-tail-recenter-p 2117(if (and follow-avoid-tail-recenter-p
2121 (fboundp 'move-overlay)) 2118 (fboundp 'move-overlay))
2122 (defadvice move-overlay (before follow-move-overlay activate) 2119 (defadvice move-overlay (before follow-move-overlay activate)
2123 "Adviced by Follow Mode. 2120 "Adviced by Follow mode.
2124Don't recenter windows showing only the end of a buffer. 2121Don't recenter windows showing only the end of a buffer.
2125This prevents `mouse-drag-region' from messing things up." 2122This prevents `mouse-drag-region' from messing things up."
2126 (follow-avoid-tail-recenter))) 2123 (follow-avoid-tail-recenter)))
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index d7882d3e988..f8201250096 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -2228,7 +2228,7 @@ other modes in which C preprocessor directives are used. e.g. `asm-mode' and
2228 `(;; Control structures. Emacs Lisp forms. 2228 `(;; Control structures. Emacs Lisp forms.
2229 (,(concat 2229 (,(concat
2230 "(" (regexp-opt 2230 "(" (regexp-opt
2231 '("cond" "if" "while" "while-no-input" "let" "let*" "let-environment" 2231 '("cond" "if" "while" "while-no-input" "let" "let*"
2232 "prog" "progn" "progv" "prog1" "prog2" "prog*" 2232 "prog" "progn" "progv" "prog1" "prog2" "prog*"
2233 "inline" "lambda" "save-restriction" "save-excursion" 2233 "inline" "lambda" "save-restriction" "save-excursion"
2234 "save-window-excursion" "save-selected-window" 2234 "save-window-excursion" "save-selected-window"
diff --git a/lisp/frame.el b/lisp/frame.el
index d9688804266..37673835f34 100644
--- a/lisp/frame.el
+++ b/lisp/frame.el
@@ -673,6 +673,10 @@ The functions are run with one arg, the newly created frame.")
673;; Alias, kept temporarily. 673;; Alias, kept temporarily.
674(define-obsolete-function-alias 'new-frame 'make-frame "22.1") 674(define-obsolete-function-alias 'new-frame 'make-frame "22.1")
675 675
676(defvar frame-inherited-parameters '()
677 ;; FIXME: Shouldn't we add `font' here as well?
678 "Parameters `make-frame' copies from the `selected-frame' to the new frame.")
679
676(defun make-frame (&optional parameters) 680(defun make-frame (&optional parameters)
677 "Return a newly created frame displaying the current buffer. 681 "Return a newly created frame displaying the current buffer.
678Optional argument PARAMETERS is an alist of parameters for the new frame. 682Optional argument PARAMETERS is an alist of parameters for the new frame.
@@ -723,15 +727,11 @@ setup is for focus to follow the pointer."
723 (run-hooks 'before-make-frame-hook) 727 (run-hooks 'before-make-frame-hook)
724 (setq frame (funcall frame-creation-function (append parameters (cdr (assq w window-system-default-frame-alist))))) 728 (setq frame (funcall frame-creation-function (append parameters (cdr (assq w window-system-default-frame-alist)))))
725 (normal-erase-is-backspace-setup-frame frame) 729 (normal-erase-is-backspace-setup-frame frame)
726 ;; Inherit the 'environment and 'client parameters. 730 ;; Inherit the original frame's parameters.
727 (let ((env (frame-parameter oldframe 'environment)) 731 (dolist (param frame-inherited-parameters)
728 (client (frame-parameter oldframe 'client))) 732 (unless (assq param parameters) ;Overridden by explicit parameters.
729 (if (not (framep env)) 733 (let ((val (frame-parameter oldframe param)))
730 (setq env oldframe)) 734 (when val (set-frame-parameter frame param val)))))
731 (if (and env (not (assq 'environment parameters)))
732 (set-frame-parameter frame 'environment env))
733 (if (and client (not (assq 'client parameters)))
734 (set-frame-parameter frame 'client client)))
735 (run-hook-with-args 'after-make-frame-functions frame) 735 (run-hook-with-args 'after-make-frame-functions frame)
736 frame)) 736 frame))
737 737
diff --git a/lisp/help-fns.el b/lisp/help-fns.el
index 25e8ca7ed3b..eee0794b673 100644
--- a/lisp/help-fns.el
+++ b/lisp/help-fns.el
@@ -565,7 +565,8 @@ it is displayed along with the global value."
565 ;; See previous comment for this function. 565 ;; See previous comment for this function.
566 ;; (help-xref-on-pp from (point)) 566 ;; (help-xref-on-pp from (point))
567 (if (< (point) (+ from 20)) 567 (if (< (point) (+ from 20))
568 (delete-region (1- from) from))))))) 568 (delete-region (1- from) from))))))
569 (terpri))
569 570
570 ;; If the value is large, move it to the end. 571 ;; If the value is large, move it to the end.
571 (with-current-buffer standard-output 572 (with-current-buffer standard-output
@@ -617,7 +618,7 @@ it is displayed along with the global value."
617 (setq extra-line t) 618 (setq extra-line t)
618 (princ " This variable is obsolete") 619 (princ " This variable is obsolete")
619 (if (cdr obsolete) (princ (format " since %s" (cdr obsolete)))) 620 (if (cdr obsolete) (princ (format " since %s" (cdr obsolete))))
620 (princ ";") (terpri) 621 (princ ";\n ")
621 (princ (if (stringp (car obsolete)) (car obsolete) 622 (princ (if (stringp (car obsolete)) (car obsolete)
622 (format "use `%s' instead." (car obsolete)))) 623 (format "use `%s' instead." (car obsolete))))
623 (terpri)) 624 (terpri))
diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el
index 7e2a32a42e5..c7679a7e58a 100644
--- a/lisp/ldefs-boot.el
+++ b/lisp/ldefs-boot.el
@@ -29117,10 +29117,10 @@ If FILE-NAME is non-nil, save the result to FILE-NAME.
29117 29117
29118;;;*** 29118;;;***
29119 29119
29120;;;### (autoloads (vc-annotate vc-branch-part vc-trunk-p vc-update-change-log 29120;;;### (autoloads (vc-annotate vc-update-change-log vc-rename-file
29121;;;;;; vc-rename-file vc-transfer-file vc-switch-backend vc-update 29121;;;;;; vc-transfer-file vc-switch-backend vc-rollback vc-update
29122;;;;;; vc-rollback vc-revert vc-print-log vc-retrieve-snapshot vc-create-snapshot 29122;;;;;; vc-revert vc-print-log vc-retrieve-snapshot vc-create-snapshot
29123;;;;;; vc-directory vc-merge vc-insert-headers vc-version-other-window 29123;;;;;; vc-directory vc-merge vc-insert-headers vc-revision-other-window
29124;;;;;; vc-diff vc-register vc-next-action vc-do-command edit-vc-file 29124;;;;;; vc-diff vc-register vc-next-action vc-do-command edit-vc-file
29125;;;;;; with-vc-file vc-before-checkin-hook vc-checkin-hook vc-checkout-hook) 29125;;;;;; with-vc-file vc-before-checkin-hook vc-checkin-hook vc-checkout-hook)
29126;;;;;; "vc" "vc.el" (18190 35214)) 29126;;;;;; "vc" "vc.el" (18190 35214))
diff --git a/lisp/log-view.el b/lisp/log-view.el
index b215917a559..194afb8d5de 100644
--- a/lisp/log-view.el
+++ b/lisp/log-view.el
@@ -76,7 +76,7 @@
76 76
77(eval-when-compile (require 'cl)) 77(eval-when-compile (require 'cl))
78(require 'pcvs-util) 78(require 'pcvs-util)
79(autoload 'vc-find-version "vc") 79(autoload 'vc-find-revision "vc")
80(autoload 'vc-version-diff "vc") 80(autoload 'vc-version-diff "vc")
81 81
82(defvar cvs-minor-wrap-function) 82(defvar cvs-minor-wrap-function)
@@ -93,7 +93,7 @@
93 ;; ("e" . cvs-mode-edit-log) 93 ;; ("e" . cvs-mode-edit-log)
94 ("d" . log-view-diff) 94 ("d" . log-view-diff)
95 ("a" . log-view-annotate-version) 95 ("a" . log-view-annotate-version)
96 ("f" . log-view-find-version) 96 ("f" . log-view-find-revision)
97 ("n" . log-view-msg-next) 97 ("n" . log-view-msg-next)
98 ("p" . log-view-msg-prev) 98 ("p" . log-view-msg-prev)
99 ("\t" . log-view-msg-next) 99 ("\t" . log-view-msg-next)
@@ -116,7 +116,7 @@
116 ;; ["Kill This Buffer" kill-this-buffer] 116 ;; ["Kill This Buffer" kill-this-buffer]
117 ["Mark Log Entry for Diff" set-mark-command] 117 ["Mark Log Entry for Diff" set-mark-command]
118 ["Diff Revisions" log-view-diff] 118 ["Diff Revisions" log-view-diff]
119 ["Visit Version" log-view-find-version] 119 ["Visit Version" log-view-find-revision]
120 ["Annotate Version" log-view-annotate-version] 120 ["Annotate Version" log-view-annotate-version]
121 ["Next Log Entry" log-view-msg-next] 121 ["Next Log Entry" log-view-msg-next]
122 ["Previous Log Entry" log-view-msg-prev] 122 ["Previous Log Entry" log-view-msg-prev]
@@ -365,12 +365,12 @@ log entries."
365 (cvs-force-command "/F")) 365 (cvs-force-command "/F"))
366 (funcall f)))) 366 (funcall f))))
367 367
368(defun log-view-find-version (pos) 368(defun log-view-find-revision (pos)
369 "Visit the version at point." 369 "Visit the version at point."
370 (interactive "d") 370 (interactive "d")
371 (save-excursion 371 (save-excursion
372 (goto-char pos) 372 (goto-char pos)
373 (switch-to-buffer (vc-find-version (log-view-current-file) 373 (switch-to-buffer (vc-find-revision (log-view-current-file)
374 (log-view-current-tag))))) 374 (log-view-current-tag)))))
375 375
376(defun log-view-annotate-version (pos) 376(defun log-view-annotate-version (pos)
diff --git a/lisp/mail/feedmail.el b/lisp/mail/feedmail.el
index b8d42debe6f..e75387f48ac 100644
--- a/lisp/mail/feedmail.el
+++ b/lisp/mail/feedmail.el
@@ -1588,7 +1588,7 @@ backup file names and the like)."
1588 (setq list-of-possible-fqms (directory-files feedmail-queue-directory t)) 1588 (setq list-of-possible-fqms (directory-files feedmail-queue-directory t))
1589 (if feedmail-queue-run-orderer 1589 (if feedmail-queue-run-orderer
1590 (setq list-of-possible-fqms (funcall feedmail-queue-run-orderer list-of-possible-fqms))) 1590 (setq list-of-possible-fqms (funcall feedmail-queue-run-orderer list-of-possible-fqms)))
1591 (mapcar 1591 (mapc
1592 '(lambda (blobby) 1592 '(lambda (blobby)
1593 (setq maybe-file (expand-file-name blobby feedmail-queue-directory)) 1593 (setq maybe-file (expand-file-name blobby feedmail-queue-directory))
1594 (cond 1594 (cond
@@ -1835,7 +1835,7 @@ the counts."
1835 (let ((q-cnt 0) (q-oth 0) (high-water 0) (blobbet)) 1835 (let ((q-cnt 0) (q-oth 0) (high-water 0) (blobbet))
1836 ;; iterate, counting things we find along the way in the directory 1836 ;; iterate, counting things we find along the way in the directory
1837 (if (file-directory-p queue-directory) 1837 (if (file-directory-p queue-directory)
1838 (mapcar 1838 (mapc
1839 '(lambda (blobby) 1839 '(lambda (blobby)
1840 (cond 1840 (cond
1841 ((file-directory-p blobby) nil) ; don't care about subdirs 1841 ((file-directory-p blobby) nil) ; don't care about subdirs
diff --git a/lisp/mail/reporter.el b/lisp/mail/reporter.el
index 5c6bcb83efd..596c7ee9627 100644
--- a/lisp/mail/reporter.el
+++ b/lisp/mail/reporter.el
@@ -252,7 +252,7 @@ dumped."
252 (erase-buffer) 252 (erase-buffer)
253 (insert "(setq\n") 253 (insert "(setq\n")
254 (lisp-indent-line) 254 (lisp-indent-line)
255 (mapcar 255 (mapc
256 (function 256 (function
257 (lambda (varsym-or-cons-cell) 257 (lambda (varsym-or-cons-cell)
258 (let ((varsym (or (car-safe varsym-or-cons-cell) 258 (let ((varsym (or (car-safe varsym-or-cons-cell)
diff --git a/lisp/mail/rmail.el b/lisp/mail/rmail.el
index 53c9220f14f..4a7bd12ba42 100644
--- a/lisp/mail/rmail.el
+++ b/lisp/mail/rmail.el
@@ -1,7 +1,8 @@
1;;; rmail.el --- main code of "RMAIL" mail reader for Emacs 1;;; rmail.el --- main code of "RMAIL" mail reader for Emacs
2 2
3;; Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998, 3;; Copyright (C) 1985, 1986, 1987, 1988, 1993, 1994, 1995, 1996, 1997, 1998,
4;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. 4;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
5;; Free Software Foundation, Inc.
5 6
6;; Maintainer: FSF 7;; Maintainer: FSF
7;; Keywords: mail 8;; Keywords: mail
@@ -1460,7 +1461,7 @@ original copy."
1460 1461
1461(defun rmail-list-to-menu (menu-name l action &optional full-name) 1462(defun rmail-list-to-menu (menu-name l action &optional full-name)
1462 (let ((menu (make-sparse-keymap menu-name))) 1463 (let ((menu (make-sparse-keymap menu-name)))
1463 (mapcar 1464 (mapc
1464 (function (lambda (item) 1465 (function (lambda (item)
1465 (let (command) 1466 (let (command)
1466 (if (consp item) 1467 (if (consp item)
diff --git a/lisp/net/eudc-hotlist.el b/lisp/net/eudc-hotlist.el
index 0509ac9ab79..2914ebdc1b0 100644
--- a/lisp/net/eudc-hotlist.el
+++ b/lisp/net/eudc-hotlist.el
@@ -69,10 +69,10 @@ These are the special commands of this mode:
69 (switch-to-buffer (get-buffer-create "*EUDC Servers*")) 69 (switch-to-buffer (get-buffer-create "*EUDC Servers*"))
70 (setq buffer-read-only nil) 70 (setq buffer-read-only nil)
71 (erase-buffer) 71 (erase-buffer)
72 (mapcar (function 72 (mapc (function
73 (lambda (entry) 73 (lambda (entry)
74 (setq proto-col (max (length (car entry)) proto-col)))) 74 (setq proto-col (max (length (car entry)) proto-col))))
75 eudc-server-hotlist) 75 eudc-server-hotlist)
76 (setq proto-col (+ 3 proto-col)) 76 (setq proto-col (+ 3 proto-col))
77 (setq gap (make-string (- proto-col 6) ?\ )) 77 (setq gap (make-string (- proto-col 6) ?\ ))
78 (insert " EUDC Servers\n" 78 (insert " EUDC Servers\n"
@@ -82,7 +82,7 @@ These are the special commands of this mode:
82 "------" gap "--------\n" 82 "------" gap "--------\n"
83 "\n") 83 "\n")
84 (setq eudc-hotlist-list-beginning (point)) 84 (setq eudc-hotlist-list-beginning (point))
85 (mapcar '(lambda (entry) 85 (mapc '(lambda (entry)
86 (insert (car entry)) 86 (insert (car entry))
87 (indent-to proto-col) 87 (indent-to proto-col)
88 (insert (symbol-name (cdr entry)) "\n")) 88 (insert (symbol-name (cdr entry)) "\n"))
diff --git a/lisp/net/eudc.el b/lisp/net/eudc.el
index 4ee09a26951..0f300c20736 100644
--- a/lisp/net/eudc.el
+++ b/lisp/net/eudc.el
@@ -502,15 +502,15 @@ otherwise they are formatted according to `eudc-user-attribute-names-alist'."
502 records)) 502 records))
503 ;; Display the records 503 ;; Display the records
504 (setq first-record (point)) 504 (setq first-record (point))
505 (mapcar 505 (mapc
506 (function 506 (function
507 (lambda (record) 507 (lambda (record)
508 (setq beg (point)) 508 (setq beg (point))
509 ;; Map over the record fields to print the attribute/value pairs 509 ;; Map over the record fields to print the attribute/value pairs
510 (mapcar (function 510 (mapc (function
511 (lambda (field) 511 (lambda (field)
512 (eudc-print-record-field field width))) 512 (eudc-print-record-field field width)))
513 record) 513 record)
514 ;; Store the record internal format in some convenient place 514 ;; Store the record internal format in some convenient place
515 (overlay-put (make-overlay beg (point)) 515 (overlay-put (make-overlay beg (point))
516 'eudc-record 516 'eudc-record
@@ -540,13 +540,13 @@ otherwise they are formatted according to `eudc-user-attribute-names-alist'."
540 (if (not (and (boundp 'eudc-form-widget-list) 540 (if (not (and (boundp 'eudc-form-widget-list)
541 eudc-form-widget-list)) 541 eudc-form-widget-list))
542 (error "Not in a directory query form buffer") 542 (error "Not in a directory query form buffer")
543 (mapcar (function 543 (mapc (function
544 (lambda (wid-field) 544 (lambda (wid-field)
545 (setq value (widget-value (cdr wid-field))) 545 (setq value (widget-value (cdr wid-field)))
546 (if (not (string= value "")) 546 (if (not (string= value ""))
547 (setq query-alist (cons (cons (car wid-field) value) 547 (setq query-alist (cons (cons (car wid-field) value)
548 query-alist))))) 548 query-alist)))))
549 eudc-form-widget-list) 549 eudc-form-widget-list)
550 (kill-buffer (current-buffer)) 550 (kill-buffer (current-buffer))
551 (eudc-display-records (eudc-query query-alist) eudc-use-raw-directory-names)))) 551 (eudc-display-records (eudc-query query-alist) eudc-use-raw-directory-names))))
552 552
@@ -565,15 +565,15 @@ otherwise they are formatted according to `eudc-user-attribute-names-alist'."
565 565
566 (if (null (eudc-cdar rec)) 566 (if (null (eudc-cdar rec))
567 (list record) ; No duplicate attrs in this record 567 (list record) ; No duplicate attrs in this record
568 (mapcar (function 568 (mapc (function
569 (lambda (field) 569 (lambda (field)
570 (if (listp (cdr field)) 570 (if (listp (cdr field))
571 (setq duplicates (cons field duplicates)) 571 (setq duplicates (cons field duplicates))
572 (setq unique (cons field unique))))) 572 (setq unique (cons field unique)))))
573 record) 573 record)
574 (setq result (list unique)) 574 (setq result (list unique))
575 ;; Map over the record fields that have multiple values 575 ;; Map over the record fields that have multiple values
576 (mapcar 576 (mapc
577 (function 577 (function
578 (lambda (field) 578 (lambda (field)
579 (let ((method (if (consp eudc-duplicate-attribute-handling-method) 579 (let ((method (if (consp eudc-duplicate-attribute-handling-method)
@@ -641,7 +641,7 @@ Each copy is added a new field containing one of the values of FIELD."
641 (while values 641 (while values
642 (setcdr values (delete (car values) (cdr values))) 642 (setcdr values (delete (car values) (cdr values)))
643 (setq values (cdr values))) 643 (setq values (cdr values)))
644 (mapcar 644 (mapc
645 (function 645 (function
646 (lambda (value) 646 (lambda (value)
647 (let ((result-list (copy-sequence records))) 647 (let ((result-list (copy-sequence records)))
@@ -974,11 +974,11 @@ queries the server for the existing fields and displays a corresponding form."
974 (capitalize (symbol-name field))))) 974 (capitalize (symbol-name field)))))
975 fields))) 975 fields)))
976 ;; Loop over prompt strings to find the longest one 976 ;; Loop over prompt strings to find the longest one
977 (mapcar (function 977 (mapc (function
978 (lambda (prompt) 978 (lambda (prompt)
979 (if (> (length prompt) width) 979 (if (> (length prompt) width)
980 (setq width (length prompt))))) 980 (setq width (length prompt)))))
981 prompts) 981 prompts)
982 ;; Insert the first widget out of the mapcar to leave the cursor 982 ;; Insert the first widget out of the mapcar to leave the cursor
983 ;; in the first field 983 ;; in the first field
984 (widget-insert "\n\n" (format (concat "%" (int-to-string width) "s: ") (car prompts))) 984 (widget-insert "\n\n" (format (concat "%" (int-to-string width) "s: ") (car prompts)))
@@ -988,15 +988,15 @@ queries the server for the existing fields and displays a corresponding form."
988 eudc-form-widget-list)) 988 eudc-form-widget-list))
989 (setq fields (cdr fields)) 989 (setq fields (cdr fields))
990 (setq prompts (cdr prompts)) 990 (setq prompts (cdr prompts))
991 (mapcar (function 991 (mapc (function
992 (lambda (field) 992 (lambda (field)
993 (widget-insert "\n\n" (format (concat "%" (int-to-string width) "s: ") (car prompts))) 993 (widget-insert "\n\n" (format (concat "%" (int-to-string width) "s: ") (car prompts)))
994 (setq widget (widget-create 'editable-field 994 (setq widget (widget-create 'editable-field
995 :size 15)) 995 :size 15))
996 (setq eudc-form-widget-list (cons (cons field widget) 996 (setq eudc-form-widget-list (cons (cons field widget)
997 eudc-form-widget-list)) 997 eudc-form-widget-list))
998 (setq prompts (cdr prompts)))) 998 (setq prompts (cdr prompts))))
999 fields) 999 fields)
1000 (widget-insert "\n\n") 1000 (widget-insert "\n\n")
1001 (widget-create 'push-button 1001 (widget-create 'push-button
1002 :notify (lambda (&rest ignore) 1002 :notify (lambda (&rest ignore)
diff --git a/lisp/net/eudcb-bbdb.el b/lisp/net/eudcb-bbdb.el
index f84d98aaed8..7e37d9d4123 100644
--- a/lisp/net/eudcb-bbdb.el
+++ b/lisp/net/eudcb-bbdb.el
@@ -75,7 +75,7 @@
75 "Return RECORD if it matches `eudc-bbdb-current-query', nil otherwise." 75 "Return RECORD if it matches `eudc-bbdb-current-query', nil otherwise."
76 (catch 'unmatch 76 (catch 'unmatch
77 (progn 77 (progn
78 (mapcar 78 (mapc
79 (function 79 (function
80 (lambda (condition) 80 (lambda (condition)
81 (let ((attr (car condition)) 81 (let ((attr (car condition))
@@ -197,22 +197,22 @@ RETURN-ATTRS is a list of attributes to return, defaulting to
197 (if (car query-attrs) 197 (if (car query-attrs)
198 (setq records (eval `(bbdb-search ,(quote records) ,@bbdb-attrs)))) 198 (setq records (eval `(bbdb-search ,(quote records) ,@bbdb-attrs))))
199 (setq query-attrs (cdr query-attrs))) 199 (setq query-attrs (cdr query-attrs)))
200 (mapcar (function 200 (mapc (function
201 (lambda (record) 201 (lambda (record)
202 (setq filtered (eudc-filter-duplicate-attributes record)) 202 (setq filtered (eudc-filter-duplicate-attributes record))
203 ;; If there were duplicate attributes reverse the order of the 203 ;; If there were duplicate attributes reverse the order of the
204 ;; record so the unique attributes appear first 204 ;; record so the unique attributes appear first
205 (if (> (length filtered) 1) 205 (if (> (length filtered) 1)
206 (setq filtered (mapcar (function 206 (setq filtered (mapcar (function
207 (lambda (rec) 207 (lambda (rec)
208 (reverse rec))) 208 (reverse rec)))
209 filtered))) 209 filtered)))
210 (setq result (append result filtered)))) 210 (setq result (append result filtered))))
211 (delq nil 211 (delq nil
212 (mapcar 'eudc-bbdb-format-record-as-result 212 (mapcar 'eudc-bbdb-format-record-as-result
213 (delq nil 213 (delq nil
214 (mapcar 'eudc-bbdb-filter-non-matching-record 214 (mapcar 'eudc-bbdb-filter-non-matching-record
215 records))))) 215 records)))))
216 result)) 216 result))
217 217
218;;}}} 218;;}}}
diff --git a/lisp/net/eudcb-ldap.el b/lisp/net/eudcb-ldap.el
index c484c590abf..f286fe761c9 100644
--- a/lisp/net/eudcb-ldap.el
+++ b/lisp/net/eudcb-ldap.el
@@ -130,7 +130,7 @@ RETURN-ATTRS is a list of attributes to return, defaulting to
130 (setq result (eudc-filter-partial-records result return-attrs))) 130 (setq result (eudc-filter-partial-records result return-attrs)))
131 ;; Apply eudc-duplicate-attribute-handling-method 131 ;; Apply eudc-duplicate-attribute-handling-method
132 (if (not (eq 'list eudc-duplicate-attribute-handling-method)) 132 (if (not (eq 'list eudc-duplicate-attribute-handling-method))
133 (mapcar 133 (mapc
134 (function (lambda (record) 134 (function (lambda (record)
135 (setq final-result 135 (setq final-result
136 (append (eudc-filter-duplicate-attributes record) 136 (append (eudc-filter-duplicate-attributes record)
diff --git a/lisp/net/socks.el b/lisp/net/socks.el
index 5079e84ce19..fd8e7ec59f2 100644
--- a/lisp/net/socks.el
+++ b/lisp/net/socks.el
@@ -247,7 +247,7 @@ If PATTERN is omitted, it defaults to \"[ \\f\\t\\n\\r\\v]+\"."
247(defun socks-build-auth-list () 247(defun socks-build-auth-list ()
248 (let ((num 0) 248 (let ((num 0)
249 (retval "")) 249 (retval ""))
250 (mapcar 250 (mapc
251 (function 251 (function
252 (lambda (x) 252 (lambda (x)
253 (if (fboundp (cdr (cdr x))) 253 (if (fboundp (cdr (cdr x)))
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index 26846f562f5..c8b2a72aad0 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -5695,7 +5695,7 @@ process to set up. VEC specifies the connection."
5695 (if (featurep 'mule) 5695 (if (featurep 'mule)
5696 ;; Use MULE to select the right EOL convention for communicating 5696 ;; Use MULE to select the right EOL convention for communicating
5697 ;; with the process. 5697 ;; with the process.
5698 (let* ((cs (or (process-coding-system proc) 5698 (let* ((cs (or (funcall (symbol-function 'process-coding-system) proc)
5699 (cons 'undecided 'undecided))) 5699 (cons 'undecided 'undecided)))
5700 cs-decode cs-encode) 5700 cs-decode cs-encode)
5701 (when (symbolp cs) (setq cs (cons cs cs))) 5701 (when (symbolp cs) (setq cs (cons cs cs)))
@@ -5708,7 +5708,8 @@ process to set up. VEC specifies the connection."
5708 (when (search-forward "\r" nil t) 5708 (when (search-forward "\r" nil t)
5709 (setq cs-decode (tramp-coding-system-change-eol-conversion 5709 (setq cs-decode (tramp-coding-system-change-eol-conversion
5710 cs-decode 'dos))) 5710 cs-decode 'dos)))
5711 (set-buffer-process-coding-system cs-decode cs-encode)) 5711 (funcall (symbol-function 'set-buffer-process-coding-system)
5712 cs-decode cs-encode))
5712 ;; Look for ^M and do something useful if found. 5713 ;; Look for ^M and do something useful if found.
5713 (when (search-forward "\r" nil t) 5714 (when (search-forward "\r" nil t)
5714 ;; We have found a ^M but cannot frob the process coding system 5715 ;; We have found a ^M but cannot frob the process coding system
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index c8da0add016..a83d81966a8 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -30,14 +30,14 @@
30;; "autoconf && ./configure" to change them. (X)Emacs version check is defined 30;; "autoconf && ./configure" to change them. (X)Emacs version check is defined
31;; in macro AC_EMACS_INFO of aclocal.m4; should be changed only there. 31;; in macro AC_EMACS_INFO of aclocal.m4; should be changed only there.
32 32
33(defconst tramp-version "2.1.11-pre" 33(defconst tramp-version "2.1.11"
34 "This version of Tramp.") 34 "This version of Tramp.")
35 35
36(defconst tramp-bug-report-address "tramp-devel@gnu.org" 36(defconst tramp-bug-report-address "tramp-devel@gnu.org"
37 "Email address to send bug reports to.") 37 "Email address to send bug reports to.")
38 38
39;; Check for (X)Emacs version. 39;; Check for (X)Emacs version.
40(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"))) 40(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")))
41 (unless (string-match "\\`ok\\'" x) (error x))) 41 (unless (string-match "\\`ok\\'" x) (error x)))
42 42
43(provide 'trampver) 43(provide 'trampver)
diff --git a/lisp/obsolete/hilit19.el b/lisp/obsolete/hilit19.el
index 9221753a864..be0b5d622a2 100644
--- a/lisp/obsolete/hilit19.el
+++ b/lisp/obsolete/hilit19.el
@@ -975,24 +975,24 @@ the entire buffer is forced."
975 (progn 975 (progn
976 976
977 ;; BUFFER highlights... 977 ;; BUFFER highlights...
978 (mapcar (lambda (hook) 978 (mapc (lambda (hook)
979 (if hilit-mode 979 (if hilit-mode
980 (add-hook hook 'hilit-rehighlight-buffer-quietly) 980 (add-hook hook 'hilit-rehighlight-buffer-quietly)
981 (remove-hook hook 'hilit-rehighlight-buffer-quietly))) 981 (remove-hook hook 'hilit-rehighlight-buffer-quietly)))
982 '( 982 '(
983 Info-selection-hook 983 Info-selection-hook
984 984
985 ;; runs too early vm-summary-mode-hooks 985 ;; runs too early vm-summary-mode-hooks
986 vm-summary-pointer-hook 986 vm-summary-pointer-hook
987 vm-preview-message-hook 987 vm-preview-message-hook
988 vm-show-message-hook 988 vm-show-message-hook
989 989
990 rmail-show-message-hook 990 rmail-show-message-hook
991 mail-setup-hook 991 mail-setup-hook
992 mh-show-mode-hook 992 mh-show-mode-hook
993 993
994 dired-after-readin-hook 994 dired-after-readin-hook
995 )) 995 ))
996 ) 996 )
997 (error (message "Error loading highlight hooks: %s" c) 997 (error (message "Error loading highlight hooks: %s" c)
998 (ding) (sit-for 1))))) 998 (ding) (sit-for 1)))))
diff --git a/lisp/pcvs.el b/lisp/pcvs.el
index 1e45fe6974b..a0bac0b2871 100644
--- a/lisp/pcvs.el
+++ b/lisp/pcvs.el
@@ -2411,7 +2411,7 @@ The exact behavior is determined also by `cvs-dired-use-hook'."
2411 (let* ((file (expand-file-name buffer-file-name)) 2411 (let* ((file (expand-file-name buffer-file-name))
2412 (version (and (fboundp 'vc-backend) 2412 (version (and (fboundp 'vc-backend)
2413 (eq (vc-backend file) 'CVS) 2413 (eq (vc-backend file) 'CVS)
2414 (vc-workfile-version file)))) 2414 (vc-working-revision file))))
2415 (when version 2415 (when version
2416 (save-excursion 2416 (save-excursion
2417 (dolist (cvs-buf (buffer-list)) 2417 (dolist (cvs-buf (buffer-list))
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 860893bcfa6..db052c4b8f5 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -2595,7 +2595,7 @@ sentence motion in or near comments and multiline strings."
2595;; set up electric character functions to work with pending-del, 2595;; set up electric character functions to work with pending-del,
2596;; (a.k.a. delsel) mode. All symbols get the t value except 2596;; (a.k.a. delsel) mode. All symbols get the t value except
2597;; the functions which delete, which gets 'supersede. 2597;; the functions which delete, which gets 'supersede.
2598(mapcar 2598(mapc
2599 (function 2599 (function
2600 (lambda (sym) 2600 (lambda (sym)
2601 (put sym 'delete-selection t) ; for delsel (Emacs) 2601 (put sym 'delete-selection t) ; for delsel (Emacs)
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index f234404e81d..00ec64a85a0 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -841,7 +841,7 @@ Note that the style variables are always made local to the buffer."
841 (and c-file-style 841 (and c-file-style
842 (c-set-style c-file-style)) 842 (c-set-style c-file-style))
843 (and c-file-offsets 843 (and c-file-offsets
844 (mapcar 844 (mapc
845 (lambda (langentry) 845 (lambda (langentry)
846 (let ((langelem (car langentry)) 846 (let ((langelem (car langentry))
847 (offset (cdr langentry))) 847 (offset (cdr langentry)))
@@ -1430,15 +1430,15 @@ Key bindings:
1430 adaptive-fill-mode 1430 adaptive-fill-mode
1431 adaptive-fill-regexp) 1431 adaptive-fill-regexp)
1432 nil))) 1432 nil)))
1433 (mapcar (lambda (var) (unless (boundp var) 1433 (mapc (lambda (var) (unless (boundp var)
1434 (setq vars (delq var vars)))) 1434 (setq vars (delq var vars))))
1435 '(signal-error-on-buffer-boundary 1435 '(signal-error-on-buffer-boundary
1436 filladapt-mode 1436 filladapt-mode
1437 defun-prompt-regexp 1437 defun-prompt-regexp
1438 font-lock-mode 1438 font-lock-mode
1439 font-lock-maximum-decoration 1439 font-lock-maximum-decoration
1440 parse-sexp-lookup-properties 1440 parse-sexp-lookup-properties
1441 lookup-syntax-properties)) 1441 lookup-syntax-properties))
1442 vars) 1442 vars)
1443 (lambda () 1443 (lambda ()
1444 (run-hooks 'c-prepare-bug-report-hooks) 1444 (run-hooks 'c-prepare-bug-report-hooks)
diff --git a/lisp/progmodes/cc-styles.el b/lisp/progmodes/cc-styles.el
index c5b9b063812..1ffcb170ca3 100644
--- a/lisp/progmodes/cc-styles.el
+++ b/lisp/progmodes/cc-styles.el
@@ -381,11 +381,11 @@ a null operation."
381 ;; fallback entry. 381 ;; fallback entry.
382 (setq c-special-indent-hook 382 (setq c-special-indent-hook
383 (default-value 'c-special-indent-hook))) 383 (default-value 'c-special-indent-hook)))
384 (mapcar (lambda (elem) 384 (mapc (lambda (elem)
385 (c-set-style-1 elem dont-override)) 385 (c-set-style-1 elem dont-override))
386 ;; Need to go through the variables backwards when we 386 ;; Need to go through the variables backwards when we
387 ;; don't override any settings. 387 ;; don't override any settings.
388 (if (eq dont-override t) (nreverse vars) vars))) 388 (if (eq dont-override t) (nreverse vars) vars)))
389 (setq c-indentation-style stylename) 389 (setq c-indentation-style stylename)
390 (c-keep-region-active)) 390 (c-keep-region-active))
391 391
@@ -636,7 +636,7 @@ any reason to call this function directly."
636 'make-variable-buffer-local)) 636 'make-variable-buffer-local))
637 (varsyms (cons 'c-indentation-style (copy-alist c-style-variables)))) 637 (varsyms (cons 'c-indentation-style (copy-alist c-style-variables))))
638 (delq 'c-special-indent-hook varsyms) 638 (delq 'c-special-indent-hook varsyms)
639 (mapcar func varsyms) 639 (mapc func varsyms)
640 ;; Hooks must be handled specially 640 ;; Hooks must be handled specially
641 (if this-buf-only-p 641 (if this-buf-only-p
642 (make-local-hook 'c-special-indent-hook) 642 (make-local-hook 'c-special-indent-hook)
diff --git a/lisp/progmodes/cperl-mode.el b/lisp/progmodes/cperl-mode.el
index 4de1a845ab4..d030110d85a 100644
--- a/lisp/progmodes/cperl-mode.el
+++ b/lisp/progmodes/cperl-mode.el
@@ -1107,11 +1107,11 @@ versions of Emacs."
1107;;; (setq interpreter-mode-alist (append interpreter-mode-alist 1107;;; (setq interpreter-mode-alist (append interpreter-mode-alist
1108;;; '(("miniperl" . perl-mode)))))) 1108;;; '(("miniperl" . perl-mode))))))
1109(eval-when-compile 1109(eval-when-compile
1110 (mapcar (lambda (p) 1110 (mapc (lambda (p)
1111 (condition-case nil 1111 (condition-case nil
1112 (require p) 1112 (require p)
1113 (error nil))) 1113 (error nil)))
1114 '(imenu easymenu etags timer man info)) 1114 '(imenu easymenu etags timer man info))
1115 (if (fboundp 'ps-extend-face-list) 1115 (if (fboundp 'ps-extend-face-list)
1116 (defmacro cperl-ps-extend-face-list (arg) 1116 (defmacro cperl-ps-extend-face-list (arg)
1117 `(ps-extend-face-list ,arg)) 1117 `(ps-extend-face-list ,arg))
@@ -5385,15 +5385,15 @@ indentation and initial hashes. Behaves usually outside of comment."
5385 (t 5385 (t
5386 (or name 5386 (or name
5387 (setq name "+++BACK+++")) 5387 (setq name "+++BACK+++"))
5388 (mapcar (lambda (elt) 5388 (mapc (lambda (elt)
5389 (if (and (listp elt) (listp (cdr elt))) 5389 (if (and (listp elt) (listp (cdr elt)))
5390 (progn 5390 (progn
5391 ;; In the other order it goes up 5391 ;; In the other order it goes up
5392 ;; one level only ;-( 5392 ;; one level only ;-(
5393 (setcdr elt (cons (cons name lst) 5393 (setcdr elt (cons (cons name lst)
5394 (cdr elt))) 5394 (cdr elt)))
5395 (cperl-imenu-addback (cdr elt) t name)))) 5395 (cperl-imenu-addback (cdr elt) t name))))
5396 (if isback (cdr lst) lst)) 5396 (if isback (cdr lst) lst))
5397 lst))) 5397 lst)))
5398 5398
5399(defun cperl-imenu--create-perl-index (&optional regexp) 5399(defun cperl-imenu--create-perl-index (&optional regexp)
@@ -6986,17 +6986,17 @@ Use as
6986 (setq cperl-unreadable-ok t 6986 (setq cperl-unreadable-ok t
6987 tm nil) ; Return empty list 6987 tm nil) ; Return empty list
6988 (error "Aborting: unreadable directory %s" file))))))) 6988 (error "Aborting: unreadable directory %s" file)))))))
6989 (mapcar (function 6989 (mapc (function
6990 (lambda (file) 6990 (lambda (file)
6991 (cond 6991 (cond
6992 ((string-match cperl-noscan-files-regexp file) 6992 ((string-match cperl-noscan-files-regexp file)
6993 nil) 6993 nil)
6994 ((not (file-directory-p file)) 6994 ((not (file-directory-p file))
6995 (if (string-match cperl-scan-files-regexp file) 6995 (if (string-match cperl-scan-files-regexp file)
6996 (cperl-write-tags file erase recurse nil t noxs topdir))) 6996 (cperl-write-tags file erase recurse nil t noxs topdir)))
6997 ((not recurse) nil) 6997 ((not recurse) nil)
6998 (t (cperl-write-tags file erase recurse t t noxs topdir))))) 6998 (t (cperl-write-tags file erase recurse t t noxs topdir)))))
6999 files))) 6999 files)))
7000 (t 7000 (t
7001 (setq xs (string-match "\\.xs$" file)) 7001 (setq xs (string-match "\\.xs$" file))
7002 (if (not (and xs noxs)) 7002 (if (not (and xs noxs))
@@ -7110,16 +7110,16 @@ One may build such TAGS files from CPerl mode menu."
7110 (cperl-tags-hier-fill)) 7110 (cperl-tags-hier-fill))
7111 (or tags-table-list 7111 (or tags-table-list
7112 (call-interactively 'visit-tags-table)) 7112 (call-interactively 'visit-tags-table))
7113 (mapcar 7113 (mapc
7114 (function 7114 (function
7115 (lambda (tagsfile) 7115 (lambda (tagsfile)
7116 (message "Updating list of classes... %s" tagsfile) 7116 (message "Updating list of classes... %s" tagsfile)
7117 (set-buffer (get-file-buffer tagsfile)) 7117 (set-buffer (get-file-buffer tagsfile))
7118 (cperl-tags-hier-fill))) 7118 (cperl-tags-hier-fill)))
7119 tags-table-list) 7119 tags-table-list)
7120 (message "Updating list of classes... postprocessing...")) 7120 (message "Updating list of classes... postprocessing..."))
7121 (mapcar remover (car cperl-hierarchy)) 7121 (mapc remover (car cperl-hierarchy))
7122 (mapcar remover (nth 1 cperl-hierarchy)) 7122 (mapc remover (nth 1 cperl-hierarchy))
7123 (setq to (list nil (cons "Packages: " (nth 1 cperl-hierarchy)) 7123 (setq to (list nil (cons "Packages: " (nth 1 cperl-hierarchy))
7124 (cons "Methods: " (car cperl-hierarchy)))) 7124 (cons "Methods: " (car cperl-hierarchy))))
7125 (cperl-tags-treeify to 1) 7125 (cperl-tags-treeify to 1)
@@ -7183,40 +7183,40 @@ One may build such TAGS files from CPerl mode menu."
7183 (setcdr to l1) ; Init to dynamic space 7183 (setcdr to l1) ; Init to dynamic space
7184 (setq writeto to) 7184 (setq writeto to)
7185 (setq ord 1) 7185 (setq ord 1)
7186 (mapcar move-deeper packages) 7186 (mapc move-deeper packages)
7187 (setq ord 2) 7187 (setq ord 2)
7188 (mapcar move-deeper methods) 7188 (mapc move-deeper methods)
7189 (if recurse 7189 (if recurse
7190 (mapcar (function (lambda (elt) 7190 (mapc (function (lambda (elt)
7191 (cperl-tags-treeify elt (1+ level)))) 7191 (cperl-tags-treeify elt (1+ level))))
7192 (cdr to))) 7192 (cdr to)))
7193 ;;Now clean up leaders with one child only 7193 ;;Now clean up leaders with one child only
7194 (mapcar (function (lambda (elt) 7194 (mapc (function (lambda (elt)
7195 (if (not (and (listp (cdr elt)) 7195 (if (not (and (listp (cdr elt))
7196 (eq (length elt) 2))) nil 7196 (eq (length elt) 2))) nil
7197 (setcar elt (car (nth 1 elt))) 7197 (setcar elt (car (nth 1 elt)))
7198 (setcdr elt (cdr (nth 1 elt)))))) 7198 (setcdr elt (cdr (nth 1 elt))))))
7199 (cdr to)) 7199 (cdr to))
7200 ;; Sort the roots of subtrees 7200 ;; Sort the roots of subtrees
7201 (if (default-value 'imenu-sort-function) 7201 (if (default-value 'imenu-sort-function)
7202 (setcdr to 7202 (setcdr to
7203 (sort (cdr to) (default-value 'imenu-sort-function)))) 7203 (sort (cdr to) (default-value 'imenu-sort-function))))
7204 ;; Now add back functions removed from display 7204 ;; Now add back functions removed from display
7205 (mapcar (function (lambda (elt) 7205 (mapc (function (lambda (elt)
7206 (setcdr to (cons elt (cdr to))))) 7206 (setcdr to (cons elt (cdr to)))))
7207 (if (default-value 'imenu-sort-function) 7207 (if (default-value 'imenu-sort-function)
7208 (nreverse 7208 (nreverse
7209 (sort root-functions (default-value 'imenu-sort-function))) 7209 (sort root-functions (default-value 'imenu-sort-function)))
7210 root-functions)) 7210 root-functions))
7211 ;; Now add back packages removed from display 7211 ;; Now add back packages removed from display
7212 (mapcar (function (lambda (elt) 7212 (mapc (function (lambda (elt)
7213 (setcdr to (cons (cons (concat "package " (car elt)) 7213 (setcdr to (cons (cons (concat "package " (car elt))
7214 (cdr elt)) 7214 (cdr elt))
7215 (cdr to))))) 7215 (cdr to)))))
7216 (if (default-value 'imenu-sort-function) 7216 (if (default-value 'imenu-sort-function)
7217 (nreverse 7217 (nreverse
7218 (sort root-packages (default-value 'imenu-sort-function))) 7218 (sort root-packages (default-value 'imenu-sort-function)))
7219 root-packages)))) 7219 root-packages))))
7220 7220
7221;;;(x-popup-menu t 7221;;;(x-popup-menu t
7222;;; '(keymap "Name1" 7222;;; '(keymap "Name1"
diff --git a/lisp/progmodes/ebnf-yac.el b/lisp/progmodes/ebnf-yac.el
index c1b00bdddfc..14640649d02 100644
--- a/lisp/progmodes/ebnf-yac.el
+++ b/lisp/progmodes/ebnf-yac.el
@@ -273,12 +273,12 @@
273 ;; control character & 8-bit character are set to `error' 273 ;; control character & 8-bit character are set to `error'
274 (let ((table (make-vector 256 'error))) 274 (let ((table (make-vector 256 'error)))
275 ;; upper & lower case letters: 275 ;; upper & lower case letters:
276 (mapcar 276 (mapc
277 #'(lambda (char) 277 #'(lambda (char)
278 (aset table char 'non-terminal)) 278 (aset table char 'non-terminal))
279 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz") 279 "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz")
280 ;; printable characters: 280 ;; printable characters:
281 (mapcar 281 (mapc
282 #'(lambda (char) 282 #'(lambda (char)
283 (aset table char 'character)) 283 (aset table char 'character))
284 "!#$&()*+-.0123456789=?@[\\]^_`~") 284 "!#$&()*+-.0123456789=?@[\\]^_`~")
diff --git a/lisp/progmodes/ebnf2ps.el b/lisp/progmodes/ebnf2ps.el
index be25293c643..66aefe66045 100644
--- a/lisp/progmodes/ebnf2ps.el
+++ b/lisp/progmodes/ebnf2ps.el
@@ -5004,11 +5004,11 @@ killed after process termination."
5004 5004
5005(defvar ebnf-map-name 5005(defvar ebnf-map-name
5006 (let ((map (make-vector 256 ?\_))) 5006 (let ((map (make-vector 256 ?\_)))
5007 (mapcar #'(lambda (char) 5007 (mapc #'(lambda (char)
5008 (aset map char char)) 5008 (aset map char char))
5009 (concat "#$%&+-.0123456789=?@~" 5009 (concat "#$%&+-.0123456789=?@~"
5010 "ABCDEFGHIJKLMNOPQRSTUVWXYZ" 5010 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
5011 "abcdefghijklmnopqrstuvwxyz")) 5011 "abcdefghijklmnopqrstuvwxyz"))
5012 map)) 5012 map))
5013 5013
5014 5014
@@ -5553,7 +5553,7 @@ killed after process termination."
5553 (ebnf-log "(ebnf-dimensions tree)") 5553 (ebnf-log "(ebnf-dimensions tree)")
5554 (let ((ebnf-total (length tree)) 5554 (let ((ebnf-total (length tree))
5555 (ebnf-nprod 0)) 5555 (ebnf-nprod 0))
5556 (mapcar 'ebnf-production-dimension tree)) 5556 (mapc 'ebnf-production-dimension tree))
5557 tree) 5557 tree)
5558 5558
5559 5559
diff --git a/lisp/progmodes/idlw-shell.el b/lisp/progmodes/idlw-shell.el
index f903d490565..4d2dd7f315e 100644
--- a/lisp/progmodes/idlw-shell.el
+++ b/lisp/progmodes/idlw-shell.el
@@ -3461,12 +3461,12 @@ breakpoint overlays."
3461 line (string-to-number (match-string (nth 2 indmap))) 3461 line (string-to-number (match-string (nth 2 indmap)))
3462 file (idlwave-shell-file-name (match-string (nth 3 indmap)))) 3462 file (idlwave-shell-file-name (match-string (nth 3 indmap))))
3463 (if (eq bp-re bp-re55) 3463 (if (eq bp-re bp-re55)
3464 (setq count (if (match-string 10) 1 3464 (setq count (if (match-string 10) 1
3465 (if (match-string 8) 3465 (if (match-string 8)
3466 (string-to-number (match-string 8)))) 3466 (string-to-number (match-string 8))))
3467 condition (match-string 13) 3467 condition (match-string 13)
3468 disabled (not (null (match-string 15))))) 3468 disabled (not (null (match-string 15)))))
3469 3469
3470 ;; Add the breakpoint info to the list 3470 ;; Add the breakpoint info to the list
3471 (nconc idlwave-shell-bp-alist 3471 (nconc idlwave-shell-bp-alist
3472 (list (cons (list file line) 3472 (list (cons (list file line)
@@ -3476,9 +3476,9 @@ breakpoint overlays."
3476 count nil condition disabled)))))) 3476 count nil condition disabled))))))
3477 (setq idlwave-shell-bp-alist (cdr idlwave-shell-bp-alist)) 3477 (setq idlwave-shell-bp-alist (cdr idlwave-shell-bp-alist))
3478 ;; Update breakpoint data 3478 ;; Update breakpoint data
3479 (if (eq bp-re bp-re54) 3479 (if (eq bp-re bp-re54)
3480 (mapcar 'idlwave-shell-update-bp old-bp-alist) 3480 (mapc 'idlwave-shell-update-bp old-bp-alist)
3481 (mapcar 'idlwave-shell-update-bp-command-only old-bp-alist)))) 3481 (mapc 'idlwave-shell-update-bp-command-only old-bp-alist))))
3482 ;; Update the breakpoint overlays 3482 ;; Update the breakpoint overlays
3483 (unless no-show (idlwave-shell-update-bp-overlays)) 3483 (unless no-show (idlwave-shell-update-bp-overlays))
3484 ;; Return the new list 3484 ;; Return the new list
@@ -4530,27 +4530,27 @@ idlwave-shell-electric-debug-mode-map)
4530 4530
4531(if (or (featurep 'easymenu) (load "easymenu" t)) 4531(if (or (featurep 'easymenu) (load "easymenu" t))
4532 (progn 4532 (progn
4533 (easy-menu-define 4533 (easy-menu-define
4534 idlwave-mode-debug-menu idlwave-mode-map "IDL debugging menus" 4534 idlwave-mode-debug-menu idlwave-mode-map "IDL debugging menus"
4535 idlwave-shell-menu-def) 4535 idlwave-shell-menu-def)
4536 (easy-menu-define 4536 (easy-menu-define
4537 idlwave-shell-mode-menu idlwave-shell-mode-map "IDL shell menus" 4537 idlwave-shell-mode-menu idlwave-shell-mode-map "IDL shell menus"
4538 idlwave-shell-menu-def) 4538 idlwave-shell-menu-def)
4539 (save-excursion 4539 (save-excursion
4540 (mapcar (lambda (buf) 4540 (mapc (lambda (buf)
4541 (set-buffer buf) 4541 (set-buffer buf)
4542 (if (eq major-mode 'idlwave-mode) 4542 (if (eq major-mode 'idlwave-mode)
4543 (progn 4543 (progn
4544 (easy-menu-remove idlwave-mode-debug-menu) 4544 (easy-menu-remove idlwave-mode-debug-menu)
4545 (easy-menu-add idlwave-mode-debug-menu)))) 4545 (easy-menu-add idlwave-mode-debug-menu))))
4546 (buffer-list))))) 4546 (buffer-list)))))
4547 4547
4548;; The Breakpoint Glyph ------------------------------------------------------- 4548;; The Breakpoint Glyph -------------------------------------------------------
4549 4549
4550(defvar idlwave-shell-bp-glyph nil 4550(defvar idlwave-shell-bp-glyph nil
4551 "The glyphs to mark breakpoint lines in the source code.") 4551 "The glyphs to mark breakpoint lines in the source code.")
4552 4552
4553(let ((image-alist 4553(let ((image-alist
4554 '((bp . "/* XPM */ 4554 '((bp . "/* XPM */
4555static char * file[] = { 4555static char * file[] = {
4556\"14 12 3 1\", 4556\"14 12 3 1\",
diff --git a/lisp/progmodes/idlw-toolbar.el b/lisp/progmodes/idlw-toolbar.el
index 2d143a3ddaa..4400c30b09d 100644
--- a/lisp/progmodes/idlw-toolbar.el
+++ b/lisp/progmodes/idlw-toolbar.el
@@ -916,21 +916,21 @@ static char * file[] = {
916 (idlwave-toolbar-add)) 916 (idlwave-toolbar-add))
917 (buffer-list))) 917 (buffer-list)))
918 ;; For Emacs, add the key definitions to the mode maps 918 ;; For Emacs, add the key definitions to the mode maps
919 (mapcar (lambda (x) 919 (mapc (lambda (x)
920 (let* ((icon (aref x 0)) 920 (let* ((icon (aref x 0))
921 (func (aref x 1)) 921 (func (aref x 1))
922 (show (aref x 2)) 922 (show (aref x 2))
923 (help (aref x 3)) 923 (help (aref x 3))
924 (key (vector 'tool-bar func)) 924 (key (vector 'tool-bar func))
925 (def (list 'menu-item 925 (def (list 'menu-item
926 "a" 926 "a"
927 func 927 func
928 :image (symbol-value icon) 928 :image (symbol-value icon)
929 :visible show 929 :visible show
930 :help help))) 930 :help help)))
931 (define-key idlwave-mode-map key def) 931 (define-key idlwave-mode-map key def)
932 (define-key idlwave-shell-mode-map key def))) 932 (define-key idlwave-shell-mode-map key def)))
933 (reverse idlwave-toolbar))) 933 (reverse idlwave-toolbar)))
934 (setq idlwave-toolbar-visible t))) 934 (setq idlwave-toolbar-visible t)))
935 935
936(defun idlwave-toolbar-remove-everywhere () 936(defun idlwave-toolbar-remove-everywhere ()
@@ -947,15 +947,15 @@ static char * file[] = {
947 (idlwave-toolbar-remove)) 947 (idlwave-toolbar-remove))
948 (buffer-list))) 948 (buffer-list)))
949 ;; For Emacs, remove the key definitions from the mode maps 949 ;; For Emacs, remove the key definitions from the mode maps
950 (mapcar (lambda (x) 950 (mapc (lambda (x)
951 (let* (;;(icon (aref x 0)) 951 (let* (;;(icon (aref x 0))
952 (func (aref x 1)) 952 (func (aref x 1))
953 ;;(show (aref x 2)) 953 ;;(show (aref x 2))
954 ;;(help (aref x 3)) 954 ;;(help (aref x 3))
955 (key (vector 'tool-bar func))) 955 (key (vector 'tool-bar func)))
956 (define-key idlwave-mode-map key nil) 956 (define-key idlwave-mode-map key nil)
957 (define-key idlwave-shell-mode-map key nil))) 957 (define-key idlwave-shell-mode-map key nil)))
958 idlwave-toolbar)) 958 idlwave-toolbar))
959 (setq idlwave-toolbar-visible nil))) 959 (setq idlwave-toolbar-visible nil)))
960 960
961(defun idlwave-toolbar-toggle (&optional force-on) 961(defun idlwave-toolbar-toggle (&optional force-on)
diff --git a/lisp/progmodes/idlwave.el b/lisp/progmodes/idlwave.el
index 1e600d6c456..646f6a80d8e 100644
--- a/lisp/progmodes/idlwave.el
+++ b/lisp/progmodes/idlwave.el
@@ -2827,10 +2827,10 @@ If the optional argument EXPAND is non-nil then the actions in
2827 ;; Before indenting, run action routines. 2827 ;; Before indenting, run action routines.
2828 ;; 2828 ;;
2829 (if (and expand idlwave-do-actions) 2829 (if (and expand idlwave-do-actions)
2830 (mapcar 'idlwave-do-action idlwave-indent-expand-table)) 2830 (mapc 'idlwave-do-action idlwave-indent-expand-table))
2831 ;; 2831 ;;
2832 (if idlwave-do-actions 2832 (if idlwave-do-actions
2833 (mapcar 'idlwave-do-action idlwave-indent-action-table)) 2833 (mapc 'idlwave-do-action idlwave-indent-action-table))
2834 ;; 2834 ;;
2835 ;; No longer expand abbrevs on the line. The user can do this 2835 ;; No longer expand abbrevs on the line. The user can do this
2836 ;; manually using expand-region-abbrevs. 2836 ;; manually using expand-region-abbrevs.
@@ -4242,9 +4242,9 @@ blank lines."
4242 4242
4243(defun idlwave-sintern-keyword-list (kwd-list &optional set) 4243(defun idlwave-sintern-keyword-list (kwd-list &optional set)
4244 "Sintern a set of keywords (file (key . link) (key2 . link2) ...)" 4244 "Sintern a set of keywords (file (key . link) (key2 . link2) ...)"
4245 (mapcar (lambda(x) 4245 (mapc (lambda(x)
4246 (setcar x (idlwave-sintern-keyword (car x) set))) 4246 (setcar x (idlwave-sintern-keyword (car x) set)))
4247 (cdr kwd-list)) 4247 (cdr kwd-list))
4248 kwd-list) 4248 kwd-list)
4249 4249
4250(defun idlwave-sintern-rinfo-list (list &optional set default-dir) 4250(defun idlwave-sintern-rinfo-list (list &optional set default-dir)
@@ -5560,11 +5560,11 @@ directories and save the routine info.
5560 ;; Define the routine info list 5560 ;; Define the routine info list
5561 (insert "\n(setq idlwave-user-catalog-routines\n '(") 5561 (insert "\n(setq idlwave-user-catalog-routines\n '(")
5562 (let ((standard-output (current-buffer))) 5562 (let ((standard-output (current-buffer)))
5563 (mapcar (lambda (x) 5563 (mapc (lambda (x)
5564 (insert "\n ") 5564 (insert "\n ")
5565 (prin1 x) 5565 (prin1 x)
5566 (goto-char (point-max))) 5566 (goto-char (point-max)))
5567 idlwave-user-catalog-routines)) 5567 idlwave-user-catalog-routines))
5568 (insert (format "))\n\n;;; %s ends here\n" 5568 (insert (format "))\n\n;;; %s ends here\n"
5569 (file-name-nondirectory idlwave-user-catalog-file))) 5569 (file-name-nondirectory idlwave-user-catalog-file)))
5570 (goto-char (point-min)) 5570 (goto-char (point-min))
@@ -5604,11 +5604,11 @@ directories and save the routine info.
5604 ;; Define the variable which contains a list of all scanned directories 5604 ;; Define the variable which contains a list of all scanned directories
5605 (insert "\n(setq idlwave-path-alist\n '(") 5605 (insert "\n(setq idlwave-path-alist\n '(")
5606 (let ((standard-output (current-buffer))) 5606 (let ((standard-output (current-buffer)))
5607 (mapcar (lambda (x) 5607 (mapc (lambda (x)
5608 (insert "\n ") 5608 (insert "\n ")
5609 (prin1 x) 5609 (prin1 x)
5610 (goto-char (point-max))) 5610 (goto-char (point-max)))
5611 idlwave-path-alist)) 5611 idlwave-path-alist))
5612 (insert "))\n") 5612 (insert "))\n")
5613 (save-buffer 0) 5613 (save-buffer 0)
5614 (kill-buffer (current-buffer)))) 5614 (kill-buffer (current-buffer))))
@@ -6319,12 +6319,12 @@ When TYPE is not specified, both procedures and functions will be considered."
6319 (if (null method) 6319 (if (null method)
6320 (mapcar 'car (idlwave-class-alist)) 6320 (mapcar 'car (idlwave-class-alist))
6321 (let (rtn) 6321 (let (rtn)
6322 (mapcar (lambda (x) 6322 (mapc (lambda (x)
6323 (and (nth 2 x) 6323 (and (nth 2 x)
6324 (or (not type) 6324 (or (not type)
6325 (eq type (nth 1 x))) 6325 (eq type (nth 1 x)))
6326 (push (nth 2 x) rtn))) 6326 (push (nth 2 x) rtn)))
6327 (idlwave-all-assq method (idlwave-routines))) 6327 (idlwave-all-assq method (idlwave-routines)))
6328 (idlwave-uniquify rtn)))) 6328 (idlwave-uniquify rtn))))
6329 6329
6330(defun idlwave-all-method-keyword-classes (method keyword &optional type) 6330(defun idlwave-all-method-keyword-classes (method keyword &optional type)
@@ -6335,13 +6335,13 @@ When TYPE is not specified, both procedures and functions will be considered."
6335 (null keyword)) 6335 (null keyword))
6336 nil 6336 nil
6337 (let (rtn) 6337 (let (rtn)
6338 (mapcar (lambda (x) 6338 (mapc (lambda (x)
6339 (and (nth 2 x) ; non-nil class 6339 (and (nth 2 x) ; non-nil class
6340 (or (not type) ; correct or unspecified type 6340 (or (not type) ; correct or unspecified type
6341 (eq type (nth 1 x))) 6341 (eq type (nth 1 x)))
6342 (assoc keyword (idlwave-entry-keywords x)) 6342 (assoc keyword (idlwave-entry-keywords x))
6343 (push (nth 2 x) rtn))) 6343 (push (nth 2 x) rtn)))
6344 (idlwave-all-assq method (idlwave-routines))) 6344 (idlwave-all-assq method (idlwave-routines)))
6345 (idlwave-uniquify rtn)))) 6345 (idlwave-uniquify rtn))))
6346 6346
6347(defun idlwave-members-only (list club) 6347(defun idlwave-members-only (list club)
@@ -7551,7 +7551,7 @@ The list is cached in `idlwave-class-info' for faster access."
7551If RECORD-LINK is non-nil, the keyword text is copied and a text 7551If RECORD-LINK is non-nil, the keyword text is copied and a text
7552property indicating the link is added." 7552property indicating the link is added."
7553 (let (kwds) 7553 (let (kwds)
7554 (mapcar 7554 (mapc
7555 (lambda (key-list) 7555 (lambda (key-list)
7556 (let ((file (car key-list))) 7556 (let ((file (car key-list)))
7557 (mapcar (lambda (key-cons) 7557 (mapcar (lambda (key-cons)
@@ -8277,8 +8277,8 @@ demand _EXTRA in the keyword list."
8277 (memq (nth 2 entry) super-classes) ; an inherited class 8277 (memq (nth 2 entry) super-classes) ; an inherited class
8278 (eq (nth 1 entry) type) ; correct type 8278 (eq (nth 1 entry) type) ; correct type
8279 (eq (car entry) name) ; correct name 8279 (eq (car entry) name) ; correct name
8280 (mapcar (lambda (k) (add-to-list 'keywords k)) 8280 (mapc (lambda (k) (add-to-list 'keywords k))
8281 (idlwave-entry-keywords entry 'do-link)))) 8281 (idlwave-entry-keywords entry 'do-link))))
8282 (setq keywords (idlwave-uniquify keywords))) 8282 (setq keywords (idlwave-uniquify keywords)))
8283 8283
8284 ;; Return the final list 8284 ;; Return the final list
@@ -8437,7 +8437,7 @@ If we do not know about MODULE, just return KEYWORD literally."
8437 (if (null keywords) 8437 (if (null keywords)
8438 (insert " No keywords accepted.") 8438 (insert " No keywords accepted.")
8439 (setq col 9) 8439 (setq col 9)
8440 (mapcar 8440 (mapc
8441 (lambda (x) 8441 (lambda (x)
8442 (if (>= (+ col 1 (length (car x))) 8442 (if (>= (+ col 1 (length (car x)))
8443 (window-width)) 8443 (window-width))
diff --git a/lisp/server.el b/lisp/server.el
index 02190a97c6f..22b947ea9f8 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -561,6 +561,7 @@ Server mode runs a process that accepts commands from the
561 (server-quote-arg text))))))))) 561 (server-quote-arg text)))))))))
562 562
563(defun server-create-tty-frame (tty type proc) 563(defun server-create-tty-frame (tty type proc)
564 (add-to-list 'frame-inherited-parameters 'client)
564 (let ((frame 565 (let ((frame
565 (server-with-environment (process-get proc 'env) 566 (server-with-environment (process-get proc 'env)
566 '("LANG" "LC_CTYPE" "LC_ALL" 567 '("LANG" "LC_CTYPE" "LC_ALL"
@@ -575,6 +576,16 @@ Server mode runs a process that accepts commands from the
575 ;; Ignore nowait here; we always need to 576 ;; Ignore nowait here; we always need to
576 ;; clean up opened ttys when the client dies. 577 ;; clean up opened ttys when the client dies.
577 `((client . ,proc) 578 `((client . ,proc)
579 ;; This is a leftover from an earlier
580 ;; attempt at making it possible for process
581 ;; run in the server process to use the
582 ;; environment of the client process.
583 ;; It has no effect now and to make it work
584 ;; we'd need to decide how to make
585 ;; process-environment interact with client
586 ;; envvars, and then to change the
587 ;; C functions `child_setup' and
588 ;; `getenv_internal' accordingly.
578 (environment . ,(process-get proc 'env))))))) 589 (environment . ,(process-get proc 'env)))))))
579 590
580 ;; ttys don't use the `display' parameter, but callproc.c does to set 591 ;; ttys don't use the `display' parameter, but callproc.c does to set
@@ -594,6 +605,7 @@ Server mode runs a process that accepts commands from the
594 frame)) 605 frame))
595 606
596(defun server-create-window-system-frame (display nowait proc) 607(defun server-create-window-system-frame (display nowait proc)
608 (add-to-list 'frame-inherited-parameters 'client)
597 (if (not (fboundp 'make-frame-on-display)) 609 (if (not (fboundp 'make-frame-on-display))
598 (progn 610 (progn
599 ;; This emacs does not support X. 611 ;; This emacs does not support X.
@@ -606,6 +618,7 @@ Server mode runs a process that accepts commands from the
606 ;; `server-save-buffers-kill-terminal' from unexpectedly 618 ;; `server-save-buffers-kill-terminal' from unexpectedly
607 ;; killing emacs on that frame. 619 ;; killing emacs on that frame.
608 (let* ((params `((client . ,(if nowait 'nowait proc)) 620 (let* ((params `((client . ,(if nowait 'nowait proc))
621 ;; This is a leftover, see above.
609 (environment . ,(process-get proc 'env)))) 622 (environment . ,(process-get proc 'env))))
610 (frame (make-frame-on-display 623 (frame (make-frame-on-display
611 (or display 624 (or display
@@ -614,9 +627,8 @@ Server mode runs a process that accepts commands from the
614 (error "Please specify display")) 627 (error "Please specify display"))
615 params))) 628 params)))
616 (server-log (format "%s created" frame) proc) 629 (server-log (format "%s created" frame) proc)
617 ;; XXX We need to ensure the parameters are 630 ;; XXX We need to ensure the parameters are really set because Emacs
618 ;; really set because Emacs forgets unhandled 631 ;; forgets unhandled initialization parameters for X frames at
619 ;; initialization parameters for X frames at
620 ;; the moment. 632 ;; the moment.
621 (modify-frame-parameters frame params) 633 (modify-frame-parameters frame params)
622 (select-frame frame) 634 (select-frame frame)
diff --git a/lisp/startup.el b/lisp/startup.el
index 947fc0da57a..d1e44bdad6b 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -875,6 +875,10 @@ opening the first frame (e.g. open a connection to an X server).")
875 ;; Run the site-start library if it exists. The point of this file is 875 ;; Run the site-start library if it exists. The point of this file is
876 ;; that it is run before .emacs. There is no point in doing this after 876 ;; that it is run before .emacs. There is no point in doing this after
877 ;; .emacs; that is useless. 877 ;; .emacs; that is useless.
878 ;; Note that user-init-file is nil at this point. Code that might
879 ;; be loaded from site-run-file and wants to test if -q was given
880 ;; should check init-file-user instead, since that is already set.
881 ;; See cus-edit.el for an example.
878 (if site-run-file 882 (if site-run-file
879 (load site-run-file t t)) 883 (load site-run-file t t))
880 884
@@ -1014,11 +1018,9 @@ opening the first frame (e.g. open a connection to an X server).")
1014 (with-current-buffer (window-buffer) 1018 (with-current-buffer (window-buffer)
1015 (deactivate-mark))) 1019 (deactivate-mark)))
1016 1020
1017 ;; If the user has a file of abbrevs, read it. 1021 ;; If the user has a file of abbrevs, read it (unless -batch).
1018 ;; FIXME: after the 22.0 release this should be changed so 1022 (when (and (not noninteractive)
1019 ;; that it does not read the abbrev file when -batch is used 1023 (file-exists-p abbrev-file-name)
1020 ;; on the command line.
1021 (when (and (file-exists-p abbrev-file-name)
1022 (file-readable-p abbrev-file-name)) 1024 (file-readable-p abbrev-file-name))
1023 (quietly-read-abbrev-file abbrev-file-name)) 1025 (quietly-read-abbrev-file abbrev-file-name))
1024 1026
@@ -1449,7 +1451,7 @@ a face or button specification."
1449 1451
1450 (when concise 1452 (when concise
1451 (fancy-splash-insert 1453 (fancy-splash-insert
1452 :face 'variable-pitch "\n\n" 1454 :face 'variable-pitch "\n"
1453 :link '("Dismiss" (lambda (button) 1455 :link '("Dismiss" (lambda (button)
1454 (when startup-screen-inhibit-startup-screen 1456 (when startup-screen-inhibit-startup-screen
1455 (customize-set-variable 'inhibit-startup-screen t) 1457 (customize-set-variable 'inhibit-startup-screen t)
@@ -1489,34 +1491,39 @@ a face or button specification."
1489 "Display fancy startup screen. 1491 "Display fancy startup screen.
1490If CONCISE is non-nil, display a concise version of the 1492If CONCISE is non-nil, display a concise version of the
1491splash screen in another window." 1493splash screen in another window."
1492 (with-current-buffer (get-buffer-create "*GNU Emacs*") 1494 (let ((splash-buffer (get-buffer-create "*GNU Emacs*")))
1493 (let ((inhibit-read-only t)) 1495 (with-current-buffer splash-buffer
1494 (erase-buffer) 1496 (let ((inhibit-read-only t))
1495 (make-local-variable 'startup-screen-inhibit-startup-screen) 1497 (erase-buffer)
1496 (if pure-space-overflow 1498 (make-local-variable 'startup-screen-inhibit-startup-screen)
1497 (insert pure-space-overflow-message)) 1499 (if pure-space-overflow
1498 (unless concise 1500 (insert pure-space-overflow-message))
1499 (fancy-splash-head)) 1501 (unless concise
1500 (dolist (text fancy-startup-text) 1502 (fancy-splash-head))
1501 (apply #'fancy-splash-insert text) 1503 (dolist (text fancy-startup-text)
1502 (insert "\n")) 1504 (apply #'fancy-splash-insert text)
1503 (skip-chars-backward "\n") 1505 (insert "\n"))
1504 (delete-region (point) (point-max)) 1506 (skip-chars-backward "\n")
1505 (insert "\n") 1507 (delete-region (point) (point-max))
1506 (fancy-startup-tail concise)) 1508 (insert "\n")
1507 (use-local-map splash-screen-keymap) 1509 (fancy-startup-tail concise))
1508 (setq tab-width 22) 1510 (use-local-map splash-screen-keymap)
1509 (set-buffer-modified-p nil) 1511 (setq tab-width 22
1510 (setq buffer-read-only t) 1512 buffer-read-only t)
1511 (if (and view-read-only (not view-mode)) 1513 (set-buffer-modified-p nil)
1512 (view-mode-enter nil 'kill-buffer)) 1514 (if (and view-read-only (not view-mode))
1513 (goto-char (point-min))) 1515 (view-mode-enter nil 'kill-buffer))
1514 (if (or (window-minibuffer-p) 1516 (goto-char (point-max)))
1515 (window-dedicated-p (selected-window))) 1517 (if concise
1516 (pop-to-buffer (current-buffer))) 1518 (progn
1517 (if concise 1519 (display-buffer splash-buffer)
1518 (display-buffer (get-buffer "*GNU Emacs*")) 1520 ;; If the splash screen is in a split window, fit it.
1519 (switch-to-buffer "*GNU Emacs*"))) 1521 (let ((window (get-buffer-window splash-buffer t)))
1522 (or (null window)
1523 (eq window (selected-window))
1524 (eq window (next-window window))
1525 (fit-window-to-buffer window))))
1526 (switch-to-buffer splash-buffer))))
1520 1527
1521(defun fancy-about-screen () 1528(defun fancy-about-screen ()
1522 "Display fancy About screen." 1529 "Display fancy About screen."
@@ -2149,9 +2156,11 @@ A fancy display is used on graphic displays, normal otherwise."
2149 (expand-file-name 2156 (expand-file-name
2150 (command-line-normalize-file-name orig-argi) 2157 (command-line-normalize-file-name orig-argi)
2151 dir))) 2158 dir)))
2152 (if (= file-count 1) 2159 (cond ((= file-count 1)
2153 (setq first-file-buffer (find-file file)) 2160 (setq first-file-buffer (find-file file)))
2154 (find-file-other-window file))) 2161 (inhibit-startup-screen
2162 (find-file-other-window file))
2163 (t (find-file file))))
2155 (or (zerop line) 2164 (or (zerop line)
2156 (goto-line line)) 2165 (goto-line line))
2157 (setq line 0) 2166 (setq line 0)
@@ -2208,12 +2217,12 @@ A fancy display is used on graphic displays, normal otherwise."
2208 ;; Don't let the hook be run twice. 2217 ;; Don't let the hook be run twice.
2209 (setq window-setup-hook nil)) 2218 (setq window-setup-hook nil))
2210 2219
2211 ;; Do this now to avoid an annoying delay if the user 2220 ;; ;; Do this now to avoid an annoying delay if the user
2212 ;; clicks the menu bar during the sit-for. 2221 ;; ;; clicks the menu bar during the sit-for.
2213 (when (display-popup-menus-p) 2222 ;; (when (display-popup-menus-p)
2214 (precompute-menubar-bindings)) 2223 ;; (precompute-menubar-bindings))
2215 (with-no-warnings 2224 ;; (with-no-warnings
2216 (setq menubar-bindings-done t)) 2225 ;; (setq menubar-bindings-done t))
2217 2226
2218 ;; If *scratch* exists and is empty, insert initial-scratch-message. 2227 ;; If *scratch* exists and is empty, insert initial-scratch-message.
2219 (and initial-scratch-message 2228 (and initial-scratch-message
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 8326c920528..1c4b60706aa 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -89,18 +89,18 @@
89 (define-key map "\e[23;6~" [C-S-f11]) 89 (define-key map "\e[23;6~" [C-S-f11])
90 (define-key map "\e[24;6~" [C-S-f12]) 90 (define-key map "\e[24;6~" [C-S-f12])
91 91
92 (define-key map "\eO3P" [A-f1]) 92 (define-key map "\eO3P" [M-f1])
93 (define-key map "\eO3Q" [A-f2]) 93 (define-key map "\eO3Q" [M-f2])
94 (define-key map "\eO3R" [A-f3]) 94 (define-key map "\eO3R" [M-f3])
95 (define-key map "\eO3S" [A-f4]) 95 (define-key map "\eO3S" [M-f4])
96 (define-key map "\e[15;3~" [A-f5]) 96 (define-key map "\e[15;3~" [M-f5])
97 (define-key map "\e[17;3~" [A-f6]) 97 (define-key map "\e[17;3~" [M-f6])
98 (define-key map "\e[18;3~" [A-f7]) 98 (define-key map "\e[18;3~" [M-f7])
99 (define-key map "\e[19;3~" [A-f8]) 99 (define-key map "\e[19;3~" [M-f8])
100 (define-key map "\e[20;3~" [A-f9]) 100 (define-key map "\e[20;3~" [M-f9])
101 (define-key map "\e[21;3~" [A-f10]) 101 (define-key map "\e[21;3~" [M-f10])
102 (define-key map "\e[23;3~" [A-f11]) 102 (define-key map "\e[23;3~" [M-f11])
103 (define-key map "\e[24;3~" [A-f12]) 103 (define-key map "\e[24;3~" [M-f12])
104 104
105 (define-key map "\eO4P" [M-S-f1]) 105 (define-key map "\eO4P" [M-S-f1])
106 (define-key map "\eO4Q" [M-S-f2]) 106 (define-key map "\eO4Q" [M-S-f2])
@@ -164,12 +164,12 @@
164 (define-key map "\e[1;8F" [C-M-S-end]) 164 (define-key map "\e[1;8F" [C-M-S-end])
165 (define-key map "\e[1;8H" [C-M-S-home]) 165 (define-key map "\e[1;8H" [C-M-S-home])
166 166
167 (define-key map "\e[1;3A" [A-up]) 167 (define-key map "\e[1;3A" [M-up])
168 (define-key map "\e[1;3B" [A-down]) 168 (define-key map "\e[1;3B" [M-down])
169 (define-key map "\e[1;3C" [A-right]) 169 (define-key map "\e[1;3C" [M-right])
170 (define-key map "\e[1;3D" [A-left]) 170 (define-key map "\e[1;3D" [M-left])
171 (define-key map "\e[1;3F" [A-end]) 171 (define-key map "\e[1;3F" [M-end])
172 (define-key map "\e[1;3H" [A-home]) 172 (define-key map "\e[1;3H" [M-home])
173 173
174 (define-key map "\e[2~" [insert]) 174 (define-key map "\e[2~" [insert])
175 (define-key map "\e[3~" [delete]) 175 (define-key map "\e[3~" [delete])
@@ -206,10 +206,10 @@
206 (define-key map "\e[5;8~" [C-M-S-prior]) 206 (define-key map "\e[5;8~" [C-M-S-prior])
207 (define-key map "\e[6;8~" [C-M-S-next]) 207 (define-key map "\e[6;8~" [C-M-S-next])
208 208
209 (define-key map "\e[2;3~" [A-insert]) 209 (define-key map "\e[2;3~" [M-insert])
210 (define-key map "\e[3;3~" [A-delete]) 210 (define-key map "\e[3;3~" [M-delete])
211 (define-key map "\e[5;3~" [A-prior]) 211 (define-key map "\e[5;3~" [M-prior])
212 (define-key map "\e[6;3~" [A-next]) 212 (define-key map "\e[6;3~" [M-next])
213 213
214 (define-key map "\e[4~" [select]) 214 (define-key map "\e[4~" [select])
215 (define-key map "\e[29~" [print]) 215 (define-key map "\e[29~" [print])
@@ -425,18 +425,18 @@
425 (define-key map [f47] [C-S-f11]) 425 (define-key map [f47] [C-S-f11])
426 (define-key map [f48] [C-S-f12]) 426 (define-key map [f48] [C-S-f12])
427 427
428 (define-key map [f49] [A-f1]) 428 (define-key map [f49] [M-f1])
429 (define-key map [f50] [A-f2]) 429 (define-key map [f50] [M-f2])
430 (define-key map [f51] [A-f3]) 430 (define-key map [f51] [M-f3])
431 (define-key map [f52] [A-f4]) 431 (define-key map [f52] [M-f4])
432 (define-key map [f53] [A-f5]) 432 (define-key map [f53] [M-f5])
433 (define-key map [f54] [A-f6]) 433 (define-key map [f54] [M-f6])
434 (define-key map [f55] [A-f7]) 434 (define-key map [f55] [M-f7])
435 (define-key map [f56] [A-f8]) 435 (define-key map [f56] [M-f8])
436 (define-key map [f57] [A-f9]) 436 (define-key map [f57] [M-f9])
437 (define-key map [f58] [A-f10]) 437 (define-key map [f58] [M-f10])
438 (define-key map [f59] [A-f11]) 438 (define-key map [f59] [M-f11])
439 (define-key map [f60] [A-f12]) 439 (define-key map [f60] [M-f12])
440 440
441 map) 441 map)
442 "Keymap of possible alternative meanings for some keys.") 442 "Keymap of possible alternative meanings for some keys.")
diff --git a/lisp/textmodes/org-export-latex.el b/lisp/textmodes/org-export-latex.el
index 9aedae9461b..2cf08b399e6 100644
--- a/lisp/textmodes/org-export-latex.el
+++ b/lisp/textmodes/org-export-latex.el
@@ -1,10 +1,15 @@
1;;; org-export-latex.el --- LaTeX exporter for Org-mode 1 ;;; org-export-latex.el --- LaTeX exporter for org-mode
2;;
2;; Copyright (C) 2007 Free Software Foundation, Inc. 3;; Copyright (C) 2007 Free Software Foundation, Inc.
3;; 4;;
5;; Emacs Lisp Archive Entry
6;; Filename: org-export-latex.el
7;; Version: 5.11
4;; Author: Bastien Guerry <bzg AT altern DOT org> 8;; Author: Bastien Guerry <bzg AT altern DOT org>
5;; Keywords: org organizer latex export convert 9;; Maintainer: Bastien Guerry <bzg AT altern DOT org>
6;; Homepage: http://www.cognition.ens.fr/~guerry/u/org-export-latex.el 10;; Keywords: org, wp, tex
7;; Version: 5.09 11;; Description: Converts an org-mode buffer into LaTeX
12;; URL: http://www.cognition.ens.fr/~guerry/u/org-export-latex.el
8;; 13;;
9;; This file is part of GNU Emacs. 14;; This file is part of GNU Emacs.
10;; 15;;
@@ -17,7 +22,7 @@
17;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 22;; ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for 23;; FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19;; more details. 24;; more details.
20;; 25;;
21;; You should have received a copy of the GNU General Public License along 26;; You should have received a copy of the GNU General Public License along
22;; with GNU Emacs; see the file COPYING. If not, write to the Free Software 27;; with GNU Emacs; see the file COPYING. If not, write to the Free Software
23;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 28;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
@@ -83,12 +88,17 @@ The %s formatter will be replaced by the title of the section."
83 :type 'alist) 88 :type 'alist)
84 89
85(defcustom org-export-latex-emphasis-alist 90(defcustom org-export-latex-emphasis-alist
86 '(("*" "\\textbf{%s}") 91 '(("*" "\\textbf{%s}" nil)
87 ("/" "\\emph{%s}") 92 ("/" "\\emph{%s}" nil)
88 ("_" "\\underline{%s}") 93 ("_" "\\underline{%s}" nil)
89 ("+" "\\texttt{%s}") 94 ("+" "\\texttt{%s}" nil)
90 ("=" "\\texttt{%s}")) 95 ("=" "\\texttt{%s}" nil))
91 "Alist of LaTeX expressions to convert emphasis fontifiers." 96 "Alist of LaTeX expressions to convert emphasis fontifiers.
97Each element of the list is a list of three elements.
98The first element is the character used as a marker for fontification.
99The second element is a formatting string to wrap fontified text with.
100The third element decides whether to protect converted text from other
101conversions."
92 :group 'org-export-latex 102 :group 'org-export-latex
93 :type 'alist) 103 :type 'alist)
94 104
@@ -101,6 +111,14 @@ The %s formatter will be replaced by the title of the section."
101 :group 'org-export-latex 111 :group 'org-export-latex
102 :type 'string) 112 :type 'string)
103 113
114(defcustom org-export-latex-title-command "\\maketitle"
115 "The command used to insert the title just after \\begin{document}.
116If this string contains the formatting specification \"%s\" then
117it will be used as a formatting string, passing the title as an
118argument."
119 :group 'org-export-latex
120 :type 'string)
121
104(defcustom org-export-latex-date-format 122(defcustom org-export-latex-date-format
105 "%d %B %Y" 123 "%d %B %Y"
106 "Format string for \\date{...}." 124 "Format string for \\date{...}."
@@ -124,11 +142,14 @@ For example:
124 :type 'alist) 142 :type 'alist)
125 143
126(defcustom org-export-latex-low-levels 'description 144(defcustom org-export-latex-low-levels 'description
127 "Choice for converting sections that are below the current 145 "How to convert sections below the current level of sectioning,
128admitted level of sectioning. This can be either nil (ignore the 146as specified by `org-export-headline-levels' or the value of \"H:\"
129sections), 'description (convert them as description lists) or a 147in Org's #+OPTION line.
130string to be used instead of \\section{%s} (a %s for inserted the 148
131headline is mandatory)." 149This can be either nil (skip the sections), 'description (convert
150the sections as descriptive lists) or a string to be used instead
151of \\section{%s}. In this latter case, the %s stands here for the
152inserted headline and is mandatory."
132 :group 'org-export-latex 153 :group 'org-export-latex
133 :type '(choice (const :tag "Ignore" nil) 154 :type '(choice (const :tag "Ignore" nil)
134 (symbol :tag "Convert as descriptive list" description) 155 (symbol :tag "Convert as descriptive list" description)
@@ -248,7 +269,8 @@ in a window. A non-interactive call will only retunr the buffer."
248 (message "Exporting to LaTeX...") 269 (message "Exporting to LaTeX...")
249 (org-update-radio-target-regexp) 270 (org-update-radio-target-regexp)
250 (org-export-latex-set-initial-vars ext-plist) 271 (org-export-latex-set-initial-vars ext-plist)
251 (let* ((opt-plist org-latex-options-plist) 272 (let* ((wcf (current-window-configuration))
273 (opt-plist org-latex-options-plist)
252 (filename (concat (file-name-as-directory 274 (filename (concat (file-name-as-directory
253 (org-export-directory :LaTeX ext-plist)) 275 (org-export-directory :LaTeX ext-plist))
254 (file-name-sans-extension 276 (file-name-sans-extension
@@ -284,15 +306,27 @@ in a window. A non-interactive call will only retunr the buffer."
284 region :emph-multiline t 306 region :emph-multiline t
285 :for-LaTeX t 307 :for-LaTeX t
286 :comments nil 308 :comments nil
287 :add-text text 309 :add-text (if (eq to-buffer 'string) nil text)
288 :skip-before-1st-heading skip 310 :skip-before-1st-heading skip
289 :LaTeX-fragments nil))) 311 :LaTeX-fragments nil)))
290 (set-buffer buffer) 312
313 (set-buffer buffer)
291 (erase-buffer) 314 (erase-buffer)
292 315
293 (unless body-only (insert preamble)) 316 (and (fboundp 'set-buffer-file-coding-system)
294 (when text (insert (org-export-latex-content text) "\n\n")) 317 (set-buffer-file-coding-system coding-system-for-write))
295 (unless skip (insert first-lines)) 318
319 ;; insert the preamble and initial document commands
320 (unless (or (eq to-buffer 'string) body-only)
321 (insert preamble))
322
323 ;; insert text found in #+TEXT
324 (when (and text (not (eq to-buffer 'string)))
325 (insert (org-export-latex-content text) "\n\n"))
326
327 ;; insert lines before the first headline
328 (unless (or skip (eq to-buffer 'string))
329 (insert first-lines))
296 330
297 ;; handle the case where the region does not begin with a section 331 ;; handle the case where the region does not begin with a section
298 (when region-p 332 (when region-p
@@ -300,25 +334,30 @@ in a window. A non-interactive call will only retunr the buffer."
300 (insert string-for-export) 334 (insert string-for-export)
301 (org-export-latex-first-lines)))) 335 (org-export-latex-first-lines))))
302 336
337 ;; export the content of headlines
303 (org-export-latex-global 338 (org-export-latex-global
304 (with-temp-buffer 339 (with-temp-buffer
305 (insert string-for-export) 340 (insert string-for-export)
306 (goto-char (point-min)) 341 (goto-char (point-min))
307 (re-search-forward "^\\(\\*+\\) " nil t) 342 (when (re-search-forward "^\\(\\*+\\) " nil t)
308 (let* ((asters (length (match-string 1))) 343 (let* ((asters (length (match-string 1)))
309 (level (if odd (- asters 2) (- asters 1)))) 344 (level (if odd (- asters 2) (- asters 1))))
310 (setq org-latex-add-level 345 (setq org-latex-add-level
311 (if odd (1- (/ (1+ asters) 2)) (1- asters))) 346 (if odd (1- (/ (1+ asters) 2)) (1- asters)))
312 (org-export-latex-parse-global level odd)))) 347 (org-export-latex-parse-global level odd)))))
313 348
349 ;; finalization
314 (unless body-only (insert "\n\\end{document}")) 350 (unless body-only (insert "\n\\end{document}"))
315 (or to-buffer (save-buffer)) 351 (or to-buffer (save-buffer))
316 (goto-char (point-min)) 352 (goto-char (point-min))
317 (message "Exporting to LaTeX...done") 353 (message "Exporting to LaTeX...done")
318 (if (eq to-buffer 'string) 354 (prog1
319 (prog1 (buffer-substring (point-min) (point-max)) 355 (if (eq to-buffer 'string)
320 (kill-buffer (current-buffer))) 356 (prog1 (buffer-substring (point-min) (point-max))
321 (current-buffer)))) 357 (kill-buffer (current-buffer)))
358 (current-buffer))
359 (set-window-configuration wcf))))
360
322 361
323;;; Parsing functions: 362;;; Parsing functions:
324(defun org-export-latex-parse-global (level odd) 363(defun org-export-latex-parse-global (level odd)
@@ -484,8 +523,11 @@ and its content."
484 523
485 524
486;;; Exporting internals: 525;;; Exporting internals:
487(defun org-latex-protect (string) 526(defun org-export-latex-protect-string (string)
488 (add-text-properties 0 (length string) '(org-protected t) string) string) 527 "Prevent further conversion for STRING by adding the
528org-protect property."
529 (add-text-properties
530 0 (length string) '(org-protected t) string) string)
489 531
490(defun org-export-latex-protect-char-in-string (char-list string) 532(defun org-export-latex-protect-char-in-string (char-list string)
491 "Add org-protected text-property to char from CHAR-LIST in STRING." 533 "Add org-protected text-property to char from CHAR-LIST in STRING."
@@ -518,54 +560,65 @@ EXT-PLIST is an optional additional plist."
518 "Make the LaTeX preamble and return it as a string. 560 "Make the LaTeX preamble and return it as a string.
519Argument OPT-PLIST is the options plist for current buffer." 561Argument OPT-PLIST is the options plist for current buffer."
520 (let ((toc (plist-get opt-plist :table-of-contents))) 562 (let ((toc (plist-get opt-plist :table-of-contents)))
521 (concat (if (plist-get opt-plist :time-stamp-file) 563 (concat
522 (format-time-string "% Created %Y-%m-%d %a %H:%M\n")) 564 (if (plist-get opt-plist :time-stamp-file)
523 565 (format-time-string "% Created %Y-%m-%d %a %H:%M\n"))
524 ;; LaTeX custom preamble 566
525 org-export-latex-preamble "\n" 567 ;; insert LaTeX custom preamble
526 568 org-export-latex-preamble "\n"
527 ;; LaTeX packages 569
528 (if org-export-latex-packages-alist 570 ;; insert information on LaTeX packages
529 (mapconcat (lambda(p) 571 (when org-export-latex-packages-alist
530 (if (equal "" (car p)) 572 (mapconcat (lambda(p)
531 (format "\\usepackage{%s}" (cadr p)) 573 (if (equal "" (car p))
532 (format "\\usepackage[%s]{%s}" 574 (format "\\usepackage{%s}" (cadr p))
533 (car p) (cadr p)))) 575 (format "\\usepackage[%s]{%s}"
534 org-export-latex-packages-alist "\n") "") 576 (car p) (cadr p))))
535 "\n\\begin{document}\n\n" 577 org-export-latex-packages-alist "\n"))
536 578
537 ;; title 579 ;; insert the title
538 (format 580 (format
539 "\\title{%s}\n" 581 "\\title{%s}\n"
540 (or (plist-get opt-plist :title) 582 (or (plist-get opt-plist :title)
541 (and (not 583 (and (not
542 (plist-get opt-plist :skip-before-1st-heading)) 584 (plist-get opt-plist :skip-before-1st-heading))
543 (org-export-grab-title-from-buffer)) 585 (org-export-grab-title-from-buffer))
544 (and buffer-file-name 586 (and buffer-file-name
545 (file-name-sans-extension 587 (file-name-sans-extension
546 (file-name-nondirectory buffer-file-name))) 588 (file-name-nondirectory buffer-file-name)))
547 "UNTITLED")) 589 "UNTITLED"))
548 590
549 ;; author info 591 ;; insert author info
550 (if (plist-get opt-plist :author-info) 592 (if (plist-get opt-plist :author-info)
551 (format "\\author{%s}\n" 593 (format "\\author{%s}\n"
552 (or (plist-get opt-plist :author) user-full-name)) 594 (or (plist-get opt-plist :author) user-full-name))
553 (format "%%\\author{%s}\n" 595 (format "%%\\author{%s}\n"
554 (or (plist-get opt-plist :author) user-full-name))) 596 (or (plist-get opt-plist :author) user-full-name)))
555 597
556 ;; date 598 ;; insert the date
557 (format "\\date{%s}\n" 599 (format "\\date{%s}\n"
558 (format-time-string 600 (format-time-string
559 (or (plist-get opt-plist :date) 601 (or (plist-get opt-plist :date)
560 org-export-latex-date-format))) 602 org-export-latex-date-format)))
561 603
562 "\\maketitle\n\n" 604 ;; beginning of the document
563 ;; table of contents 605 "\n\\begin{document}\n\n"
564 (if (and (plist-get opt-plist :section-numbers) toc) 606
565 (format "\\setcounter{tocdepth}{%s}\n" 607 ;; insert the title command
566 (plist-get opt-plist :headline-levels)) "") 608 (if (string-match "%s" org-export-latex-title-command)
567 (if (and (plist-get opt-plist :section-numbers) toc) 609 (format org-export-latex-title-command
568 "\\tableofcontents\n" "\n")))) 610 (plist-get opt-plist :title))
611 org-export-latex-title-command)
612 "\n\n"
613
614 ;; table of contents
615 (when (and org-export-with-toc
616 (plist-get opt-plist :section-numbers))
617 (cond ((numberp toc)
618 (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\n"
619 (min toc (plist-get opt-plist :headline-levels))))
620 (toc (format "\\setcounter{tocdepth}{%s}\n\\tableofcontents\n\n"
621 (plist-get opt-plist :headline-levels))))))))
569 622
570(defun org-export-latex-first-lines (&optional comments) 623(defun org-export-latex-first-lines (&optional comments)
571 "Export the first lines before first headline. 624 "Export the first lines before first headline.
@@ -640,6 +693,7 @@ formatting string like %%%%s if we want to comment them out."
640 (plist-get org-latex-options-plist :tables)) 693 (plist-get org-latex-options-plist :tables))
641 (org-export-latex-fixed-width 694 (org-export-latex-fixed-width
642 (plist-get org-latex-options-plist :fixed-width)) 695 (plist-get org-latex-options-plist :fixed-width))
696 ;; return string
643 (buffer-substring (point-min) (point-max)))) 697 (buffer-substring (point-min) (point-max))))
644 698
645(defun org-export-latex-quotation-marks () 699(defun org-export-latex-quotation-marks ()
@@ -658,7 +712,7 @@ Local definition of the language overrides
658 (mapc (lambda(l) (goto-char (point-min)) 712 (mapc (lambda(l) (goto-char (point-min))
659 (while (re-search-forward (car l) nil t) 713 (while (re-search-forward (car l) nil t)
660 (let ((rpl (concat (match-string 1) (cadr l)))) 714 (let ((rpl (concat (match-string 1) (cadr l))))
661 (org-latex-protect rpl) 715 (org-export-latex-protect-string rpl)
662 (org-if-unprotected 716 (org-if-unprotected
663 (replace-match rpl t t))))) quote-rpl))) 717 (replace-match rpl t t))))) quote-rpl)))
664 718
@@ -688,42 +742,42 @@ See the `org-export-latex.el' code for a complete conversion table."
688 ;; Put the point where to check for org-protected 742 ;; Put the point where to check for org-protected
689 (unless (get-text-property (match-beginning 2) 'org-protected) 743 (unless (get-text-property (match-beginning 2) 'org-protected)
690 (cond ((member (match-string 2) '("\\$" "$")) 744 (cond ((member (match-string 2) '("\\$" "$"))
691 (if (equal (match-string 2) "\\$") 745 (if (equal (match-string 2) "\\$")
692 (replace-match (concat (match-string 1) "$" 746 (replace-match (concat (match-string 1) "$"
693 (match-string 3)) t t) 747 (match-string 3)) t t)
694 (replace-match (concat (match-string 1) "\\$" 748 (replace-match (concat (match-string 1) "\\$"
695 (match-string 3)) t t))) 749 (match-string 3)) t t)))
696 ((member (match-string 2) '("&" "#" "%")) 750 ((member (match-string 2) '("&" "%" "#"))
697 (if (equal (match-string 1) "\\") 751 (if (equal (match-string 1) "\\")
698 (replace-match (match-string 2) t t) 752 (replace-match (match-string 2) t t)
699 (replace-match (concat (match-string 1) "\\" 753 (replace-match (concat (match-string 1) "\\"
700 (match-string 2)) t t))) 754 (match-string 2)) t t)))
701 ((equal (match-string 2) "~") 755 ((equal (match-string 2) "~")
702 (cond ((equal (match-string 1) "\\") nil) 756 (cond ((equal (match-string 1) "\\") nil)
703 ((eq 'org-link (get-text-property 0 'face (match-string 2))) 757 ((eq 'org-link (get-text-property 0 'face (match-string 2)))
704 (replace-match (concat (match-string 1) "\\~") t t)) 758 (replace-match (concat (match-string 1) "\\~") t t))
705 (t (replace-match 759 (t (replace-match
706 (org-latex-protect 760 (org-export-latex-protect-string
707 (concat (match-string 1) "\\~{}")) t t)))) 761 (concat (match-string 1) "\\~{}")) t t))))
708 ((member (match-string 2) '("{" "}")) 762 ((member (match-string 2) '("{" "}"))
709 (unless (save-match-data (org-inside-LaTeX-fragment-p)) 763 (unless (save-match-data (org-inside-LaTeX-fragment-p))
710 (if (equal (match-string 1) "\\") 764 (if (equal (match-string 1) "\\")
711 (replace-match (match-string 2) t t) 765 (replace-match (match-string 2) t t)
712 (replace-match (concat (match-string 1) "\\" 766 (replace-match (concat (match-string 1) "\\"
713 (match-string 2)) t t))))) 767 (match-string 2)) t t)))))
714 (unless (save-match-data (org-inside-LaTeX-fragment-p)) 768 (unless (save-match-data (org-inside-LaTeX-fragment-p))
715 (cond ((equal (match-string 2) "\\") 769 (cond ((equal (match-string 2) "\\")
716 (replace-match (or (save-match-data 770 (replace-match (or (save-match-data
717 (org-export-latex-treat-backslash-char 771 (org-export-latex-treat-backslash-char
718 (match-string 1) 772 (match-string 1)
719 (match-string 3))) "") t t)) 773 (match-string 3))) "") t t))
720 ((member (match-string 2) '("_" "^")) 774 ((member (match-string 2) '("_" "^"))
721 (replace-match (or (save-match-data 775 (replace-match (or (save-match-data
722 (org-export-latex-treat-sub-super-char 776 (org-export-latex-treat-sub-super-char
723 sub-superscript 777 sub-superscript
724 (match-string 1) 778 (match-string 1)
725 (match-string 2) 779 (match-string 2)
726 (match-string 3))) "") t t))))))) 780 (match-string 3))) "") t t)))))))
727 '("^\\([^\n$]*?\\|^\\)\\(\\\\?\\$\\)\\([^\n$]*\\)$" 781 '("^\\([^\n$]*?\\|^\\)\\(\\\\?\\$\\)\\([^\n$]*\\)$"
728 "\\([a-za-z0-9]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\([a-za-z0-9]+\\|[ \t\n]\\|[:punct:]\\|{[a-za-z0-9]+}\\|([a-za-z0-9]+)\\)" 782 "\\([a-za-z0-9]+\\|[ \t\n]\\|\\b\\|\\\\\\)\\(_\\|\\^\\)\\([a-za-z0-9]+\\|[ \t\n]\\|[:punct:]\\|{[a-za-z0-9]+}\\|([a-za-z0-9]+)\\)"
729 "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|[a-zA-Z&#%{}\"]+\\)" 783 "\\(.\\|^\\)\\(\\\\\\)\\([ \t\n]\\|[a-zA-Z&#%{}\"]+\\)"
@@ -732,7 +786,10 @@ See the `org-export-latex.el' code for a complete conversion table."
732 "\\(.\\|^\\)\\(%\\)" 786 "\\(.\\|^\\)\\(%\\)"
733 "\\(.\\|^\\)\\({\\)" 787 "\\(.\\|^\\)\\({\\)"
734 "\\(.\\|^\\)\\(}\\)" 788 "\\(.\\|^\\)\\(}\\)"
735 "\\(.\\|^\\)\\(~\\)"))) 789 "\\(.\\|^\\)\\(~\\)"
790 ;; (?\< . "\\textless{}")
791 ;; (?\> . "\\textgreater{}")
792 )))
736 793
737(defun org-export-latex-treat-sub-super-char 794(defun org-export-latex-treat-sub-super-char
738 (subsup string-before char string-after) 795 (subsup string-before char string-after)
@@ -759,9 +816,9 @@ Convert CHAR depending on STRING-BEFORE and STRING-AFTER."
759 (format "$%s%s{%s}$" string-before char 816 (format "$%s%s{%s}$" string-before char
760 (match-string 1 string-after))) 817 (match-string 1 string-after)))
761 (subsup (concat "$" string-before char string-after "$")) 818 (subsup (concat "$" string-before char string-after "$"))
762 (t (org-latex-protect 819 (t (org-export-latex-protect-string
763 (concat string-before "\\" char "{}" string-after))))) 820 (concat string-before "\\" char "{}" string-after)))))
764 (t (org-latex-protect 821 (t (org-export-latex-protect-string
765 (concat string-before "\\" char "{}" string-after))))) 822 (concat string-before "\\" char "{}" string-after)))))
766 823
767(defun org-export-latex-treat-backslash-char (string-before string-after) 824(defun org-export-latex-treat-backslash-char (string-before string-after)
@@ -775,17 +832,21 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
775 ((and (not (string-match "^[ \n\t]" string-after)) 832 ((and (not (string-match "^[ \n\t]" string-after))
776 (not (string-match "[ \t]\\'\\|^" string-before))) 833 (not (string-match "[ \t]\\'\\|^" string-before)))
777 ;; backslash is inside a word 834 ;; backslash is inside a word
778 (concat string-before "$\\backslash$" string-after)) 835 (org-export-latex-protect-string
836 (concat string-before "\\textbackslash{}" string-after)))
779 ((not (or (equal string-after "") 837 ((not (or (equal string-after "")
780 (string-match "^[ \t\n]" string-after))) 838 (string-match "^[ \t\n]" string-after)))
781 ;; backslash might escape a character (like \#) or a user TeX 839 ;; backslash might escape a character (like \#) or a user TeX
782 ;; macro (like \setcounter) 840 ;; macro (like \setcounter)
783 (concat string-before "\\" string-after)) 841 (org-export-latex-protect-string
842 (concat string-before "\\" string-after)))
784 ((and (string-match "^[ \t\n]" string-after) 843 ((and (string-match "^[ \t\n]" string-after)
785 (string-match "[ \t\n]\\'" string-before)) 844 (string-match "[ \t\n]\\'" string-before))
786 ;; backslash is alone, convert it to $\backslash$ 845 ;; backslash is alone, convert it to $\backslash$
787 (concat string-before "$\\backslash$" string-after)) 846 (org-export-latex-protect-string
788 (t (concat string-before "$\\backslash$" string-after)))) 847 (concat string-before "\\textbackslash{}" string-after)))
848 (t (org-export-latex-protect-string
849 (concat string-before "\\textbackslash{}" string-after)))))
789 850
790(defun org-export-latex-keywords (timestamps) 851(defun org-export-latex-keywords (timestamps)
791 "Convert special keywords to LaTeX. 852 "Convert special keywords to LaTeX.
@@ -801,6 +862,7 @@ Regexps are those from `org-latex-special-string-regexps'."
801(defun org-export-latex-fixed-width (opt) 862(defun org-export-latex-fixed-width (opt)
802 "When OPT is non-nil convert fixed-width sections to LaTeX." 863 "When OPT is non-nil convert fixed-width sections to LaTeX."
803 (goto-char (point-min)) 864 (goto-char (point-min))
865 ;; FIXME the search shouldn't be performed on already converted text
804 (while (re-search-forward "^[ \t]*:" nil t) 866 (while (re-search-forward "^[ \t]*:" nil t)
805 (if opt 867 (if opt
806 (progn (goto-char (match-beginning 0)) 868 (progn (goto-char (match-beginning 0))
@@ -816,7 +878,6 @@ Regexps are those from `org-latex-special-string-regexps'."
816 (match-string 2)) t t) 878 (match-string 2)) t t)
817 (forward-line)))))) 879 (forward-line))))))
818 880
819;; FIXME Use org-export-highlight-first-table-line ?
820(defun org-export-latex-lists () 881(defun org-export-latex-lists ()
821 "Convert lists to LaTeX." 882 "Convert lists to LaTeX."
822 (goto-char (point-min)) 883 (goto-char (point-min))
@@ -883,52 +944,87 @@ Valid parameters are
883 ;; Add a trailing \n after list conversion 944 ;; Add a trailing \n after list conversion
884 "\n")) 945 "\n"))
885 946
886(defun org-export-latex-tables (opt) 947;; FIXME Use org-export-highlight-first-table-line ?
887 "When OPT is non-nil convert tables to LaTeX." 948(defun org-export-latex-tables (insert)
949 "Convert tables to LaTeX and INSERT it."
888 (goto-char (point-min)) 950 (goto-char (point-min))
889 (while (re-search-forward "^\\([ \t]*\\)|" nil t) 951 (while (re-search-forward "^\\([ \t]*\\)|" nil t)
890 ;; Re-align the table to update org-table-last-alignment 952 ;; FIXME really need to save-excursion?
891 ;; (save-excursion (save-match-data (org-table-align))) 953 (save-excursion (org-table-align))
892 (let (tbl-list 954 (let* ((beg (org-table-begin))
893 (beg (match-beginning 0)) 955 (end (org-table-end))
894 (end (save-excursion 956 (raw-table (buffer-substring-no-properties beg end))
895 (re-search-forward 957 fnum line lines olines gr colgropen line-fmt alignment)
896 (concat "^" (regexp-quote (match-string 1))
897 "[^|]\\|\\'") nil t) (match-beginning 0))))
898 (beginning-of-line)
899 (if org-export-latex-tables-verbatim 958 (if org-export-latex-tables-verbatim
900 (let* ((raw-table (buffer-substring beg end)) 959 (let* ((tbl (concat "\\begin{verbatim}\n" raw-table
901 (tbl (concat "\\begin{verbatim}\n" raw-table
902 "\\end{verbatim}\n"))) 960 "\\end{verbatim}\n")))
903 (apply 'delete-region (list beg end)) 961 (apply 'delete-region (list beg end))
904 (insert tbl)) 962 (insert tbl))
905 (progn 963 (progn
906 (while (not (eq end (point))) 964 (setq lines (split-string raw-table "\n" t))
907 (if (looking-at "[ \t]*|\\([^-|].+\\)|[ \t]*$")
908 (push (split-string (org-trim (match-string 1)) "|") tbl-list)
909 (push 'hline tbl-list))
910 (forward-line))
911 ;; comment region out instead of deleting it ?
912 (apply 'delete-region (list beg end)) 965 (apply 'delete-region (list beg end))
913 (when opt (insert (orgtbl-to-latex (nreverse tbl-list) 966 (when org-export-table-remove-special-lines
914 nil) "\n\n"))))))) 967 (setq lines (org-table-clean-before-export lines)))
968 ;; make a formatting string to reflect aligment
969 (setq olines lines)
970 (while (and (not line-fmt) (setq line (pop olines)))
971 (unless (string-match "^[ \t]*|-" line)
972 (setq fields (org-split-string line "[ \t]*|[ \t]*"))
973 (setq fnum (make-vector (length fields) 0))
974 (setq line-fmt
975 (mapconcat
976 (lambda (x)
977 (setq gr (pop org-table-colgroup-info))
978 (format "%s%%s%s"
979 (cond ((eq gr ':start)
980 (prog1 (if colgropen "|" "")
981 (setq colgropen t)))
982 ((eq gr ':startend)
983 (prog1 (if colgropen "|" "|")
984 (setq colgropen nil)))
985 (t ""))
986 (if (memq gr '(:end :startend))
987 (progn (setq colgropen nil) "|")
988 "")))
989 fnum ""))))
990 ;; maybe remove the first and last "|"
991 (when (string-match "^\\(|\\)?\\(.+\\)|$" line-fmt)
992 (setq line-fmt (match-string 2 line-fmt)))
993 ;; format alignment
994 (setq align (apply 'format
995 (cons line-fmt
996 (mapcar (lambda (x) (if x "r" "l"))
997 org-table-last-alignment))))
998 ;; prepare the table to send to orgtbl-to-latex
999 (setq lines
1000 (mapcar
1001 (lambda(elem)
1002 (or (and (string-match "[ \t]*|-+" elem) 'hline)
1003 (split-string (org-trim elem) "|" t)))
1004 lines))
1005 (when insert
1006 (insert (orgtbl-to-latex
1007 lines `(:tstart ,(concat "\\begin{tabular}{" align "}")))
1008 "\n\n")))))))
915 1009
916(defun org-export-latex-fontify () 1010(defun org-export-latex-fontify ()
917 "Convert fontification to LaTeX." 1011 "Convert fontification to LaTeX."
918 (goto-char (point-min)) 1012 (goto-char (point-min))
919 (while (re-search-forward org-emph-re nil t) 1013 (while (re-search-forward org-emph-re nil t)
920 ;; The match goes one char after the *string* 1014 ;; The match goes one char after the *string*
921 (unless (get-text-property (1- (point)) 'org-protected) 1015 (let ((emph (assoc (match-string 3)
922 (replace-match 1016 org-export-latex-emphasis-alist))
923 (concat (match-string 1) 1017 rpl)
924 (format 1018 (unless (get-text-property (1- (point)) 'org-protected)
925 (org-export-latex-protect-char-in-string 1019 (setq rpl (concat (match-string 1)
926 '("\\" "{" "}") 1020 (format (org-export-latex-protect-char-in-string
927 (cadr (assoc (match-string 3) 1021 '("\\" "{" "}") (cadr emph))
928 org-export-latex-emphasis-alist))) 1022 (match-string 4))
929 (match-string 4)) 1023 (match-string 5)))
930 (match-string 5)) t t) 1024 (if (caddr emph)
931 (backward-char)))) 1025 (setq rpl (org-export-latex-protect-string rpl)))
1026 (replace-match rpl t t)))
1027 (backward-char)))
932 1028
933(defun org-export-latex-links () 1029(defun org-export-latex-links ()
934 ;; Make sure to use the LaTeX hyperref and graphicx package 1030 ;; Make sure to use the LaTeX hyperref and graphicx package
@@ -982,12 +1078,6 @@ Valid parameters are
982 (&optional commentsp) 1078 (&optional commentsp)
983 "Clean stuff in the LaTeX export." 1079 "Clean stuff in the LaTeX export."
984 1080
985 ;; align all tables
986 (goto-char (point-min))
987 (while (re-search-forward "^\\([ \t]*\\)|" nil t)
988 ;; Re-align the table to update org-table-last-alignment
989 (org-table-align))
990
991 ;; Preserve line breaks 1081 ;; Preserve line breaks
992 (goto-char (point-min)) 1082 (goto-char (point-min))
993 (while (re-search-forward "\\\\\\\\" nil t) 1083 (while (re-search-forward "\\\\\\\\" nil t)
@@ -998,13 +1088,13 @@ Valid parameters are
998 (goto-char (point-min)) 1088 (goto-char (point-min))
999 (let ((case-fold-search nil) rpl) 1089 (let ((case-fold-search nil) rpl)
1000 (while (re-search-forward "\\([^+_]\\)LaTeX" nil t) 1090 (while (re-search-forward "\\([^+_]\\)LaTeX" nil t)
1001 (replace-match (org-latex-protect 1091 (replace-match (org-export-latex-protect-string
1002 (concat (match-string 1) "\\LaTeX{}")) t t))) 1092 (concat (match-string 1) "\\LaTeX{}")) t t)))
1003 1093
1004 ;; Convert horizontal rules 1094 ;; Convert horizontal rules
1005 (goto-char (point-min)) 1095 (goto-char (point-min))
1006 (while (re-search-forward "^----+.$" nil t) 1096 (while (re-search-forward "^----+.$" nil t)
1007 (replace-match (org-latex-protect "\\hrule") t t)) 1097 (replace-match (org-export-latex-protect-string "\\hrule") t t))
1008 1098
1009 ;; Protect LaTeX \commands{...} 1099 ;; Protect LaTeX \commands{...}
1010 (goto-char (point-min)) 1100 (goto-char (point-min))
@@ -1018,7 +1108,7 @@ Valid parameters are
1018 (concat "<<<?" org-latex-all-targets-regexp 1108 (concat "<<<?" org-latex-all-targets-regexp
1019 ">>>?\\((INVISIBLE)\\)?") nil t) 1109 ">>>?\\((INVISIBLE)\\)?") nil t)
1020 (replace-match 1110 (replace-match
1021 (org-latex-protect 1111 (org-export-latex-protect-string
1022 (format "\\label{%s}%s"(match-string 1) 1112 (format "\\label{%s}%s"(match-string 1)
1023 (if (match-string 2) "" (match-string 1)))) t t)) 1113 (if (match-string 2) "" (match-string 1)))) t t))
1024 1114
@@ -1035,7 +1125,7 @@ Valid parameters are
1035 (while (re-search-forward "\\[[0-9]+\\]" nil t) 1125 (while (re-search-forward "\\[[0-9]+\\]" nil t)
1036 (when (save-match-data 1126 (when (save-match-data
1037 (save-excursion (beginning-of-line) 1127 (save-excursion (beginning-of-line)
1038 (looking-at "[^:|]"))) 1128 (looking-at "[^:|#]")))
1039 (let ((foot-beg (match-beginning 0)) 1129 (let ((foot-beg (match-beginning 0))
1040 (foot-end (match-end 0)) 1130 (foot-end (match-end 0))
1041 (foot-prefix (match-string 0)) 1131 (foot-prefix (match-string 0))
diff --git a/lisp/textmodes/org-publish.el b/lisp/textmodes/org-publish.el
index a72b477d0b2..bc45a7d9941 100644
--- a/lisp/textmodes/org-publish.el
+++ b/lisp/textmodes/org-publish.el
@@ -426,7 +426,7 @@ nil if not found."
426(defun org-publish-get-plist-from-filename (filename) 426(defun org-publish-get-plist-from-filename (filename)
427 "Return publishing configuration plist for file FILENAME." 427 "Return publishing configuration plist for file FILENAME."
428 (let ((found nil)) 428 (let ((found nil))
429 (mapcar 429 (mapc
430 (lambda (plist) 430 (lambda (plist)
431 (let ((files (org-publish-get-base-files plist))) 431 (let ((files (org-publish-get-base-files plist)))
432 (if (member (expand-file-name filename) files) 432 (if (member (expand-file-name filename) files)
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index f4746b48f6b..6c48c47d3ad 100644
--- a/lisp/textmodes/org.el
+++ b/lisp/textmodes/org.el
@@ -5,7 +5,7 @@
5;; Author: Carsten Dominik <carsten at orgmode dot org> 5;; Author: Carsten Dominik <carsten at orgmode dot org>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://orgmode.org 7;; Homepage: http://orgmode.org
8;; Version: 5.08 8;; Version: 5.11b
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -83,7 +83,7 @@
83 83
84;;; Version 84;;; Version
85 85
86(defconst org-version "5.09" 86(defconst org-version "5.11"
87 "The version number of the file org.el.") 87 "The version number of the file org.el.")
88(defun org-version () 88(defun org-version ()
89 (interactive) 89 (interactive)
@@ -120,7 +120,16 @@
120 (unwind-protect 120 (unwind-protect
121 (progn ,@body) 121 (progn ,@body)
122 (goto-line _line) 122 (goto-line _line)
123 (move-to-column _col)))) 123 (move-to-column _col))))
124
125(defmacro org-without-partial-completion (&rest body)
126 `(let ((pc-mode (and (boundp 'partial-completion-mode)
127 partial-completion-mode)))
128 (unwind-protect
129 (progn
130 (if pc-mode (partial-completion-mode -1))
131 ,@body)
132 (if pc-mode (partial-completion-mode 1)))))
124 133
125;;; The custom variables 134;;; The custom variables
126 135
@@ -131,6 +140,13 @@
131 :group 'hypermedia 140 :group 'hypermedia
132 :group 'calendar) 141 :group 'calendar)
133 142
143;; FIXME: Needs a separate group...
144(defcustom org-completion-fallback-command 'hippie-expand
145 "The expansion command called by \\[org-complete] in normal context.
146Normal means, no org-mode-specific context."
147 :group 'org
148 :type 'function)
149
134(defgroup org-startup nil 150(defgroup org-startup nil
135 "Options concerning startup of Org-mode." 151 "Options concerning startup of Org-mode."
136 :tag "Org Startup" 152 :tag "Org Startup"
@@ -415,7 +431,7 @@ contexts. See `org-show-hierarchy-above' for valid contexts."
415 :tag "Org Cycle" 431 :tag "Org Cycle"
416 :group 'org-structure) 432 :group 'org-structure)
417 433
418(defcustom org-drawers '("PROPERTIES") 434(defcustom org-drawers '("PROPERTIES" "CLOCK")
419 "Names of drawers. Drawers are not opened by cycling on the headline above. 435 "Names of drawers. Drawers are not opened by cycling on the headline above.
420Drawers only open with a TAB on the drawer line itself. A drawer looks like 436Drawers only open with a TAB on the drawer line itself. A drawer looks like
421this: 437this:
@@ -714,7 +730,9 @@ use the first keyword in its list that means done."
714 (string :tag "Use this keyword"))) 730 (string :tag "Use this keyword")))
715 731
716(defcustom org-archive-stamp-time t 732(defcustom org-archive-stamp-time t
717 "Non-nil means, add a time stamp to entries moved to an archive file." 733 "Non-nil means, add a time stamp to entries moved to an archive file.
734This variable is obsolete and has no effect anymore, instead add ot remove
735`time' from the variablle `org-archive-save-context-info'."
718 :group 'org-archive 736 :group 'org-archive
719 :type 'boolean) 737 :type 'boolean)
720 738
@@ -736,7 +754,8 @@ For each symbol present in the list, a property will be created in
736the archived entry, with a prefix \"PRE_ARCHIVE_\", to remember this 754the archived entry, with a prefix \"PRE_ARCHIVE_\", to remember this
737information." 755information."
738 :group 'org-archive 756 :group 'org-archive
739 :type '(set 757 :type '(set :greedy t
758 (const :tag "Time" time)
740 (const :tag "File" file) 759 (const :tag "File" file)
741 (const :tag "Category" category) 760 (const :tag "Category" category)
742 (const :tag "TODO state" todo) 761 (const :tag "TODO state" todo)
@@ -1599,7 +1618,10 @@ the following lines anywhere in the buffer:
1599 #+STARTUP: nologging 1618 #+STARTUP: nologging
1600 #+STARTUP: lognotedone 1619 #+STARTUP: lognotedone
1601 #+STARTUP: lognotestate 1620 #+STARTUP: lognotestate
1602 #+STARTUP: lognoteclock-out" 1621 #+STARTUP: lognoteclock-out
1622
1623You can have local logging settings for a subtree by setting the LOGGING
1624property to one or more of these keywords."
1603 :group 'org-todo 1625 :group 'org-todo
1604 :group 'org-progress 1626 :group 'org-progress
1605 :type '(choice 1627 :type '(choice
@@ -1646,11 +1668,32 @@ When nil, the notes will be orderer according to time."
1646 1668
1647(defcustom org-log-repeat t 1669(defcustom org-log-repeat t
1648 "Non-nil means, prompt for a note when REPEAT is resetting a TODO entry. 1670 "Non-nil means, prompt for a note when REPEAT is resetting a TODO entry.
1649When nil, no note will be taken." 1671When nil, no note will be taken.
1672This option can also be set with on a per-file-basis with
1673
1674 #+STARTUP: logrepeat
1675 #+STARTUP: nologrepeat
1676
1677You can have local logging settings for a subtree by setting the LOGGING
1678property to one or more of these keywords."
1650 :group 'org-todo 1679 :group 'org-todo
1651 :group 'org-progress 1680 :group 'org-progress
1652 :type 'boolean) 1681 :type 'boolean)
1653 1682
1683(defcustom org-clock-into-drawer 2
1684 "Should clocking info be wrapped into a drawer?
1685When t, clocking info will always be inserted into a :CLOCK: drawer.
1686If necessary, the drawer will be created.
1687When nil, the drawer will not be created, but used when present.
1688When an integer and the number of clocking entries in an item
1689reaches or exceeds this number, a drawer will be created."
1690 :group 'org-todo
1691 :group 'org-progress
1692 :type '(choice
1693 (const :tag "Always" t)
1694 (const :tag "Only when drawer exists" nil)
1695 (integer :tag "When at least N clock entries")))
1696
1654(defcustom org-clock-out-when-done t 1697(defcustom org-clock-out-when-done t
1655 "When t, the clock will be stopped when the relevant entry is marked DONE. 1698 "When t, the clock will be stopped when the relevant entry is marked DONE.
1656Nil means, clock will keep running until stopped explicitly with 1699Nil means, clock will keep running until stopped explicitly with
@@ -1681,6 +1724,13 @@ This is the priority an item get if no explicit priority is given."
1681 :group 'org-priorities 1724 :group 'org-priorities
1682 :type 'character) 1725 :type 'character)
1683 1726
1727(defcustom org-priority-start-cycle-with-default t
1728 "Non-nil means, start with default priority when starting to cycle.
1729When this is nil, the first step in the cycle will be (depending on the
1730command used) one higher or lower that the default priority."
1731 :group 'org-priorities
1732 :type 'boolean)
1733
1684(defgroup org-time nil 1734(defgroup org-time nil
1685 "Options concerning time stamps and deadlines in Org-mode." 1735 "Options concerning time stamps and deadlines in Org-mode."
1686 :tag "Org Time" 1736 :tag "Org Time"
@@ -1694,15 +1744,6 @@ the time stamp will always be forced into the second line."
1694 :group 'org-time 1744 :group 'org-time
1695 :type 'boolean) 1745 :type 'boolean)
1696 1746
1697(defcustom org-insert-labeled-timestamps-before-properties-drawer t
1698 "Non-nil means, always insert planning info before property drawer.
1699When this is nil and there is a property drawer *directly* after
1700the headline, move the planning info into the drawer. If the property
1701drawer separated from the headline by at least one line, this variable
1702has no effect."
1703 :group 'org-time
1704 :type 'boolean)
1705
1706(defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>") 1747(defconst org-time-stamp-formats '("<%Y-%m-%d %a>" . "<%Y-%m-%d %a %H:%M>")
1707 "Formats for `format-time-string' which are used for time stamps. 1748 "Formats for `format-time-string' which are used for time stamps.
1708It is not recommended to change this constant.") 1749It is not recommended to change this constant.")
@@ -1824,11 +1865,11 @@ displaying the tags menu is not even shown, until you press C-c again."
1824 "Non-nil means, fast tags selection interface will also offer TODO states. 1865 "Non-nil means, fast tags selection interface will also offer TODO states.
1825This is an undocumented feature, you should not rely on it.") 1866This is an undocumented feature, you should not rely on it.")
1826 1867
1827(defcustom org-tags-column 48 1868(defcustom org-tags-column -80
1828 "The column to which tags should be indented in a headline. 1869 "The column to which tags should be indented in a headline.
1829If this number is positive, it specifies the column. If it is negative, 1870If this number is positive, it specifies the column. If it is negative,
1830it means that the tags should be flushright to that column. For example, 1871it means that the tags should be flushright to that column. For example,
1831-79 works well for a normal 80 character screen." 1872-80 works well for a normal 80 character screen."
1832 :group 'org-tags 1873 :group 'org-tags
1833 :type 'integer) 1874 :type 'integer)
1834 1875
@@ -1962,6 +2003,12 @@ forth between agenda and calendar."
1962 :group 'org-agenda 2003 :group 'org-agenda
1963 :type 'sexp) 2004 :type 'sexp)
1964 2005
2006(defcustom org-agenda-compact-blocks nil
2007 "Non-nil means, make the block agenda more compact.
2008This is done by leaving out unnecessary lines."
2009 :group 'org-agenda
2010 :type nil)
2011
1965(defgroup org-agenda-export nil 2012(defgroup org-agenda-export nil
1966 "Options concerning exporting agenda views in Org-mode." 2013 "Options concerning exporting agenda views in Org-mode."
1967 :tag "Org Agenda Export" 2014 :tag "Org Agenda Export"
@@ -2192,7 +2239,7 @@ The idea behind this is that such items will appear in the agenda anyway."
2192(defcustom org-agenda-skip-scheduled-if-done nil 2239(defcustom org-agenda-skip-scheduled-if-done nil
2193 "Non-nil means don't show scheduled items in agenda when they are done. 2240 "Non-nil means don't show scheduled items in agenda when they are done.
2194This is relevant for the daily/weekly agenda, not for the TODO list. And 2241This is relevant for the daily/weekly agenda, not for the TODO list. And
2195it applied only to the actualy date of the scheduling. Warnings about 2242it applies only to the actual date of the scheduling. Warnings about
2196an item with a past scheduling dates are always turned off when the item 2243an item with a past scheduling dates are always turned off when the item
2197is DONE." 2244is DONE."
2198 :group 'org-agenda-skip 2245 :group 'org-agenda-skip
@@ -2467,9 +2514,9 @@ agenda entries."
2467 :group 'org-agenda-sorting 2514 :group 'org-agenda-sorting
2468 :type 'boolean) 2515 :type 'boolean)
2469 2516
2470(defgroup org-agenda-prefix nil 2517(defgroup org-agenda-line-format nil
2471 "Options concerning the entry prefix in the Org-mode agenda display." 2518 "Options concerning the entry prefix in the Org-mode agenda display."
2472 :tag "Org Agenda Prefix" 2519 :tag "Org Agenda Line Format"
2473 :group 'org-agenda) 2520 :group 'org-agenda)
2474 2521
2475(defcustom org-agenda-prefix-format 2522(defcustom org-agenda-prefix-format
@@ -2532,7 +2579,7 @@ See also the variables `org-agenda-remove-times-when-in-prefix' and
2532 (cons (const timeline) (string :tag "Format")) 2579 (cons (const timeline) (string :tag "Format"))
2533 (cons (const todo) (string :tag "Format")) 2580 (cons (const todo) (string :tag "Format"))
2534 (cons (const tags) (string :tag "Format")))) 2581 (cons (const tags) (string :tag "Format"))))
2535 :group 'org-agenda-prefix) 2582 :group 'org-agenda-line-format)
2536 2583
2537(defvar org-prefix-format-compiled nil 2584(defvar org-prefix-format-compiled nil
2538 "The compiled version of the most recently used prefix format. 2585 "The compiled version of the most recently used prefix format.
@@ -2549,7 +2596,7 @@ cluttered.
2549The option can be t or nil. It may also be the symbol `beg', indicating 2596The option can be t or nil. It may also be the symbol `beg', indicating
2550that the time should only be removed what it is located at the beginning of 2597that the time should only be removed what it is located at the beginning of
2551the headline/diary entry." 2598the headline/diary entry."
2552 :group 'org-agenda-prefix 2599 :group 'org-agenda-line-format
2553 :type '(choice 2600 :type '(choice
2554 (const :tag "Always" t) 2601 (const :tag "Always" t)
2555 (const :tag "Never" nil) 2602 (const :tag "Never" nil)
@@ -2560,7 +2607,7 @@ the headline/diary entry."
2560 "Default duration for appointments that only have a starting time. 2607 "Default duration for appointments that only have a starting time.
2561When nil, no duration is specified in such cases. 2608When nil, no duration is specified in such cases.
2562When non-nil, this must be the number of minutes, e.g. 60 for one hour." 2609When non-nil, this must be the number of minutes, e.g. 60 for one hour."
2563 :group 'org-agenda-prefix 2610 :group 'org-agenda-line-format
2564 :type '(choice 2611 :type '(choice
2565 (integer :tag "Minutes") 2612 (integer :tag "Minutes")
2566 (const :tag "No default duration"))) 2613 (const :tag "No default duration")))
@@ -2570,7 +2617,7 @@ When non-nil, this must be the number of minutes, e.g. 60 for one hour."
2570 "Non-nil means, remove the tags from the headline copy in the agenda. 2617 "Non-nil means, remove the tags from the headline copy in the agenda.
2571When this is the symbol `prefix', only remove tags when 2618When this is the symbol `prefix', only remove tags when
2572`org-agenda-prefix-format' contains a `%T' specifier." 2619`org-agenda-prefix-format' contains a `%T' specifier."
2573 :group 'org-agenda-prefix 2620 :group 'org-agenda-line-format
2574 :type '(choice 2621 :type '(choice
2575 (const :tag "Always" t) 2622 (const :tag "Always" t)
2576 (const :tag "Never" nil) 2623 (const :tag "Never" nil)
@@ -2580,11 +2627,17 @@ When this is the symbol `prefix', only remove tags when
2580 (defvaralias 'org-agenda-remove-tags-when-in-prefix 2627 (defvaralias 'org-agenda-remove-tags-when-in-prefix
2581 'org-agenda-remove-tags)) 2628 'org-agenda-remove-tags))
2582 2629
2583(defcustom org-agenda-align-tags-to-column 65 2630(defcustom org-agenda-tags-column -80
2584 "Shift tags in agenda items to this column." 2631 "Shift tags in agenda items to this column.
2585 :group 'org-agenda-prefix 2632If this number is positive, it specifies the column. If it is negative,
2633it means that the tags should be flushright to that column. For example,
2634-80 works well for a normal 80 character screen."
2635 :group 'org-agenda-line-format
2586 :type 'integer) 2636 :type 'integer)
2587 2637
2638(if (fboundp 'defvaralias)
2639 (defvaralias 'org-agenda-align-tags-to-column 'org-agenda-tags-column))
2640
2588(defgroup org-latex nil 2641(defgroup org-latex nil
2589 "Options for embedding LaTeX code into Org-mode" 2642 "Options for embedding LaTeX code into Org-mode"
2590 :tag "Org LaTeX" 2643 :tag "Org LaTeX"
@@ -2610,7 +2663,7 @@ This is a property list with the following properties:
2610 \"$$\" find math expressions surrounded by $$....$$ 2663 \"$$\" find math expressions surrounded by $$....$$
2611 \"\\(\" find math expressions surrounded by \\(...\\) 2664 \"\\(\" find math expressions surrounded by \\(...\\)
2612 \"\\ [\" find math expressions surrounded by \\ [...\\]" 2665 \"\\ [\" find math expressions surrounded by \\ [...\\]"
2613 :group 'org-export-latex 2666 :group 'org-latex
2614 :type 'plist) 2667 :type 'plist)
2615 2668
2616(defcustom org-format-latex-header "\\documentclass{article} 2669(defcustom org-format-latex-header "\\documentclass{article}
@@ -2622,7 +2675,7 @@ This is a property list with the following properties:
2622\\usepackage[mathscr]{eucal} 2675\\usepackage[mathscr]{eucal}
2623\\pagestyle{empty} % do not remove" 2676\\pagestyle{empty} % do not remove"
2624 "The document header used for processing LaTeX fragments." 2677 "The document header used for processing LaTeX fragments."
2625 :group 'org-export-latex 2678 :group 'org-latex
2626 :type 'string) 2679 :type 'string)
2627 2680
2628(defgroup org-export nil 2681(defgroup org-export nil
@@ -2980,6 +3033,11 @@ Org-mode file."
2980 :group 'org-export-html 3033 :group 'org-export-html
2981 :type 'coding-system) 3034 :type 'coding-system)
2982 3035
3036(defcustom org-export-html-extension "html"
3037 "The extension for exported HTML files."
3038 :group 'org-export-html
3039 :type 'string)
3040
2983(defcustom org-export-html-style 3041(defcustom org-export-html-style
2984"<style type=\"text/css\"> 3042"<style type=\"text/css\">
2985 html { 3043 html {
@@ -3114,7 +3172,7 @@ to a file."
3114(defcustom org-combined-agenda-icalendar-file "~/org.ics" 3172(defcustom org-combined-agenda-icalendar-file "~/org.ics"
3115 "The file name for the iCalendar file covering all agenda files. 3173 "The file name for the iCalendar file covering all agenda files.
3116This file is created with the command \\[org-export-icalendar-all-agenda-files]. 3174This file is created with the command \\[org-export-icalendar-all-agenda-files].
3117The file name should be absolute." 3175The file name should be absolute, the file will be overwritten without warning."
3118 :group 'org-export-icalendar 3176 :group 'org-export-icalendar
3119 :type 'file) 3177 :type 'file)
3120 3178
@@ -3132,6 +3190,17 @@ These are entries like in the diary, but directly in an Org-mode file."
3132 :group 'org-export-icalendar 3190 :group 'org-export-icalendar
3133 :type 'boolean) 3191 :type 'boolean)
3134 3192
3193(defcustom org-icalendar-include-body 100
3194 "Amount of text below headline to be included in iCalendar export.
3195This is a number of characters that should maximally be included.
3196Properties, scheduling and clocking lines will always be removed.
3197The text will be inserted into the DESCRIPTION field."
3198 :group 'org-export-icalendar
3199 :type '(choice
3200 (const :tag "Nothing" nil)
3201 (const :tag "Everything" t)
3202 (integer :tag "Max characters")))
3203
3135(defcustom org-icalendar-combined-name "OrgMode" 3204(defcustom org-icalendar-combined-name "OrgMode"
3136 "Calendar name for the combined iCalendar representing all agenda files." 3205 "Calendar name for the combined iCalendar representing all agenda files."
3137 :group 'org-export-icalendar 3206 :group 'org-export-icalendar
@@ -3281,8 +3350,6 @@ Use customize to modify this, or restart Emacs after changing it."
3281 :tag "Org Faces" 3350 :tag "Org Faces"
3282 :group 'org-font-lock) 3351 :group 'org-font-lock)
3283 3352
3284;; FIXME: convert that into a macro? Not critical, because this
3285;; is only executed a few times at load time.
3286(defun org-compatible-face (inherits specs) 3353(defun org-compatible-face (inherits specs)
3287 "Make a compatible face specification. 3354 "Make a compatible face specification.
3288If INHERITS is an existing face and if the Emacs version supports it, 3355If INHERITS is an existing face and if the Emacs version supports it,
@@ -4117,7 +4184,6 @@ This is for getting out of special buffers like remember.")
4117(defvar org-org-menu) 4184(defvar org-org-menu)
4118(defvar org-tbl-menu) 4185(defvar org-tbl-menu)
4119(defvar org-agenda-keymap) 4186(defvar org-agenda-keymap)
4120(defvar org-category-table)
4121 4187
4122;;;; Emacs/XEmacs compatibility 4188;;;; Emacs/XEmacs compatibility
4123 4189
@@ -4163,7 +4229,6 @@ This is for getting out of special buffers like remember.")
4163 (overlay-get ovl prop))) 4229 (overlay-get ovl prop)))
4164(defun org-overlays-at (pos) 4230(defun org-overlays-at (pos)
4165 (if (featurep 'xemacs) (extents-at pos) (overlays-at pos))) 4231 (if (featurep 'xemacs) (extents-at pos) (overlays-at pos)))
4166;; FIXME: this is currently not used
4167(defun org-overlays-in (&optional start end) 4232(defun org-overlays-in (&optional start end)
4168 (if (featurep 'xemacs) 4233 (if (featurep 'xemacs)
4169 (extent-list nil start end) 4234 (extent-list nil start end)
@@ -4172,7 +4237,6 @@ This is for getting out of special buffers like remember.")
4172 (if (featurep 'xemacs) (extent-start-position o) (overlay-start o))) 4237 (if (featurep 'xemacs) (extent-start-position o) (overlay-start o)))
4173(defun org-overlay-end (o) 4238(defun org-overlay-end (o)
4174 (if (featurep 'xemacs) (extent-end-position o) (overlay-end o))) 4239 (if (featurep 'xemacs) (extent-end-position o) (overlay-end o)))
4175;; FIXME: this is currently not used
4176(defun org-find-overlays (prop &optional pos delete) 4240(defun org-find-overlays (prop &optional pos delete)
4177 "Find all overlays specifying PROP at POS or point. 4241 "Find all overlays specifying PROP at POS or point.
4178If DELETE is non-nil, delete all those overlays." 4242If DELETE is non-nil, delete all those overlays."
@@ -4226,7 +4290,6 @@ that can be added."
4226 (setq buffer-invisibility-spec 4290 (setq buffer-invisibility-spec
4227 (delete arg buffer-invisibility-spec))))) 4291 (delete arg buffer-invisibility-spec)))))
4228 4292
4229;; FIXME: this is currently not used
4230(defun org-in-invisibility-spec-p (arg) 4293(defun org-in-invisibility-spec-p (arg)
4231 "Is ARG a member of `buffer-invisibility-spec'?" 4294 "Is ARG a member of `buffer-invisibility-spec'?"
4232 (if (consp buffer-invisibility-spec) 4295 (if (consp buffer-invisibility-spec)
@@ -4483,9 +4546,9 @@ This should be called after the variable `org-link-types' has changed."
4483This one does not require the space after the date.") 4546This one does not require the space after the date.")
4484(defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) \\([^]0-9>\r\n]*\\)\\(\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" 4547(defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\) \\([^]0-9>\r\n]*\\)\\(\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
4485 "Regular expression matching time strings for analysis.") 4548 "Regular expression matching time strings for analysis.")
4486(defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,11\\}>") 4549(defconst org-ts-regexp2 (concat "<" org-ts-regexp1 "[^>\n]\\{0,16\\}>")
4487 "Regular expression matching time stamps, with groups.") 4550 "Regular expression matching time stamps, with groups.")
4488(defconst org-ts-regexp3 (concat "[[<]" org-ts-regexp1 "[^]>\n]\\{0,11\\}[]>]") 4551(defconst org-ts-regexp3 (concat "[[<]" org-ts-regexp1 "[^]>\n]\\{0,16\\}[]>]")
4489 "Regular expression matching time stamps (also [..]), with groups.") 4552 "Regular expression matching time stamps (also [..]), with groups.")
4490(defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp) 4553(defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp)
4491 "Regular expression matching a time stamp range.") 4554 "Regular expression matching a time stamp range.")
@@ -4570,6 +4633,9 @@ will be prompted for."
4570 (insert string) 4633 (insert string)
4571 (and move (backward-char 1)))) 4634 (and move (backward-char 1))))
4572 4635
4636(defconst org-nonsticky-props
4637 '(mouse-face highlight keymap invisible intangible help-echo org-linked-text))
4638
4573(defun org-activate-plain-links (limit) 4639(defun org-activate-plain-links (limit)
4574 "Run through the buffer and add overlays to links." 4640 "Run through the buffer and add overlays to links."
4575 (catch 'exit 4641 (catch 'exit
@@ -4581,7 +4647,7 @@ will be prompted for."
4581 nil 4647 nil
4582 (add-text-properties (match-beginning 0) (match-end 0) 4648 (add-text-properties (match-beginning 0) (match-end 0)
4583 (list 'mouse-face 'highlight 4649 (list 'mouse-face 'highlight
4584 'rear-nonsticky t 4650 'rear-nonsticky org-nonsticky-props
4585 'keymap org-mouse-map 4651 'keymap org-mouse-map
4586 )) 4652 ))
4587 (throw 'exit t)))))) 4653 (throw 'exit t))))))
@@ -4592,7 +4658,7 @@ will be prompted for."
4592 (progn 4658 (progn
4593 (add-text-properties (match-beginning 0) (match-end 0) 4659 (add-text-properties (match-beginning 0) (match-end 0)
4594 (list 'mouse-face 'highlight 4660 (list 'mouse-face 'highlight
4595 'rear-nonsticky t 4661 'rear-nonsticky org-nonsticky-props
4596 'keymap org-mouse-map 4662 'keymap org-mouse-map
4597 )) 4663 ))
4598 t))) 4664 t)))
@@ -4618,10 +4684,10 @@ We use a macro so that the test can happen at compilation time."
4618 ;; but that requires another match, protecting match data, 4684 ;; but that requires another match, protecting match data,
4619 ;; a lot of overhead for font-lock. 4685 ;; a lot of overhead for font-lock.
4620 (ip (org-maybe-intangible 4686 (ip (org-maybe-intangible
4621 (list 'invisible 'org-link 'rear-nonsticky t 4687 (list 'invisible 'org-link 'rear-nonsticky org-nonsticky-props
4622 'keymap org-mouse-map 'mouse-face 'highlight 4688 'keymap org-mouse-map 'mouse-face 'highlight
4623 'help-echo help))) 4689 'help-echo help)))
4624 (vp (list 'rear-nonsticky t 4690 (vp (list 'rear-nonsticky org-nonsticky-props
4625 'keymap org-mouse-map 'mouse-face 'highlight 4691 'keymap org-mouse-map 'mouse-face 'highlight
4626 'help-echo help))) 4692 'help-echo help)))
4627 ;; We need to remove the invisible property here. Table narrowing 4693 ;; We need to remove the invisible property here. Table narrowing
@@ -4644,7 +4710,7 @@ We use a macro so that the test can happen at compilation time."
4644 (progn 4710 (progn
4645 (add-text-properties (match-beginning 0) (match-end 0) 4711 (add-text-properties (match-beginning 0) (match-end 0)
4646 (list 'mouse-face 'highlight 4712 (list 'mouse-face 'highlight
4647 'rear-nonsticky t 4713 'rear-nonsticky org-nonsticky-props
4648 'keymap org-mouse-map)) 4714 'keymap org-mouse-map))
4649 (when org-display-custom-times 4715 (when org-display-custom-times
4650 (if (match-end 3) 4716 (if (match-end 3)
@@ -4669,7 +4735,7 @@ We use a macro so that the test can happen at compilation time."
4669 (progn 4735 (progn
4670 (add-text-properties (match-beginning 0) (match-end 0) 4736 (add-text-properties (match-beginning 0) (match-end 0)
4671 (list 'mouse-face 'highlight 4737 (list 'mouse-face 'highlight
4672 'rear-nonsticky t 4738 'rear-nonsticky org-nonsticky-props
4673 'keymap org-mouse-map 4739 'keymap org-mouse-map
4674 'help-echo "Radio target link" 4740 'help-echo "Radio target link"
4675 'org-linked-text t)) 4741 'org-linked-text t))
@@ -4696,7 +4762,6 @@ We use a macro so that the test can happen at compilation time."
4696(defun org-restart-font-lock () 4762(defun org-restart-font-lock ()
4697 "Restart font-lock-mode, to force refontification." 4763 "Restart font-lock-mode, to force refontification."
4698 (when (and (boundp 'font-lock-mode) font-lock-mode) 4764 (when (and (boundp 'font-lock-mode) font-lock-mode)
4699 ;; FIXME: Could font-lock-fontify-buffer be enough???
4700 (font-lock-mode -1) 4765 (font-lock-mode -1)
4701 (font-lock-mode 1))) 4766 (font-lock-mode 1)))
4702 4767
@@ -4732,7 +4797,7 @@ between words."
4732 (progn 4797 (progn
4733 (add-text-properties (match-beginning 1) (match-end 1) 4798 (add-text-properties (match-beginning 1) (match-end 1)
4734 (list 'mouse-face 'highlight 4799 (list 'mouse-face 'highlight
4735 'rear-nonsticky t 4800 'rear-nonsticky org-nonsticky-props
4736 'keymap org-mouse-map)) 4801 'keymap org-mouse-map))
4737 t))) 4802 t)))
4738 4803
@@ -4855,7 +4920,6 @@ If KWD is a number, get the corresponding match group."
4855 deactivate-mark buffer-file-name buffer-file-truename) 4920 deactivate-mark buffer-file-name buffer-file-truename)
4856 (remove-text-properties beg end 4921 (remove-text-properties beg end
4857 '(mouse-face t keymap t org-linked-text t 4922 '(mouse-face t keymap t org-linked-text t
4858 rear-nonsticky t
4859 invisible t intangible t)))) 4923 invisible t intangible t))))
4860 4924
4861;;;; Visibility cycling, including org-goto and indirect buffer 4925;;;; Visibility cycling, including org-goto and indirect buffer
@@ -5176,6 +5240,7 @@ Optional argument N means, put the headline into the Nth line of the window."
5176 (let ((cmds '(isearch-forward isearch-backward kill-ring-save set-mark-command mouse-drag-region universal-argument org-occur)) cmd) 5240 (let ((cmds '(isearch-forward isearch-backward kill-ring-save set-mark-command mouse-drag-region universal-argument org-occur)) cmd)
5177 (while (setq cmd (pop cmds)) 5241 (while (setq cmd (pop cmds))
5178 (substitute-key-definition cmd cmd map global-map))) 5242 (substitute-key-definition cmd cmd map global-map)))
5243 (suppress-keymap map)
5179 (org-defkey map "\C-m" 'org-goto-ret) 5244 (org-defkey map "\C-m" 'org-goto-ret)
5180 (org-defkey map [(left)] 'org-goto-left) 5245 (org-defkey map [(left)] 'org-goto-left)
5181 (org-defkey map [(right)] 'org-goto-right) 5246 (org-defkey map [(right)] 'org-goto-right)
@@ -5196,9 +5261,6 @@ Optional argument N means, put the headline into the Nth line of the window."
5196 (org-defkey map "\C-c\C-f" 'outline-forward-same-level) 5261 (org-defkey map "\C-c\C-f" 'outline-forward-same-level)
5197 (org-defkey map "\C-c\C-b" 'outline-backward-same-level) 5262 (org-defkey map "\C-c\C-b" 'outline-backward-same-level)
5198 (org-defkey map "\C-c\C-u" 'outline-up-heading) 5263 (org-defkey map "\C-c\C-u" 'outline-up-heading)
5199 ;; FIXME: Could we use suppress-keymap?
5200 (let ((l '(1 2 3 4 5 6 7 8 9 0)))
5201 (while l (org-defkey map (int-to-string (pop l)) 'digit-argument)))
5202 map)) 5264 map))
5203 5265
5204(defconst org-goto-help 5266(defconst org-goto-help
@@ -5440,6 +5502,14 @@ the current headline."
5440 (unless (= (point) pos) (just-one-space) (backward-delete-char 1)) 5502 (unless (= (point) pos) (just-one-space) (backward-delete-char 1))
5441 (run-hooks 'org-insert-heading-hook))))) 5503 (run-hooks 'org-insert-heading-hook)))))
5442 5504
5505(defun org-insert-heading-after-current ()
5506 "Insert a new heading with same level as current, after current subtree."
5507 (interactive)
5508 (org-back-to-heading)
5509 (org-insert-heading)
5510 (org-move-subtree-down)
5511 (end-of-line 1))
5512
5443(defun org-insert-todo-heading (arg) 5513(defun org-insert-todo-heading (arg)
5444 "Insert a new heading with the same level and TODO state as current heading. 5514 "Insert a new heading with the same level and TODO state as current heading.
5445If the heading has no TODO state, or if the state is DONE, use the first 5515If the heading has no TODO state, or if the state is DONE, use the first
@@ -6380,7 +6450,7 @@ doing the renumbering."
6380 (org-at-item-p)) 6450 (org-at-item-p))
6381 (if (match-beginning 3) 6451 (if (match-beginning 3)
6382 (org-renumber-ordered-list 1) 6452 (org-renumber-ordered-list 1)
6383 (org-fix-bullet-type 1)))) 6453 (org-fix-bullet-type))))
6384 6454
6385(defun org-maybe-renumber-ordered-list-safe () 6455(defun org-maybe-renumber-ordered-list-safe ()
6386 (condition-case nil 6456 (condition-case nil
@@ -6412,7 +6482,7 @@ If WHICH is a string, use that as the new bullet. If WHICH is an integer,
6412 ((string-match ")" current) "-") 6482 ((string-match ")" current) "-")
6413 (t (error "This should not happen")))) 6483 (t (error "This should not happen"))))
6414 (and (looking-at "\\([ \t]*\\)\\S-+") (replace-match (concat "\\1" new))) 6484 (and (looking-at "\\([ \t]*\\)\\S-+") (replace-match (concat "\\1" new)))
6415 (org-fix-bullet-type 1) 6485 (org-fix-bullet-type)
6416 (org-maybe-renumber-ordered-list)))) 6486 (org-maybe-renumber-ordered-list))))
6417 6487
6418(defun org-get-string-indentation (s) 6488(defun org-get-string-indentation (s)
@@ -6463,9 +6533,9 @@ with something like \"1.\" or \"2)\"."
6463 (goto-line line) 6533 (goto-line line)
6464 (move-to-column col))) 6534 (move-to-column col)))
6465 6535
6466(defun org-fix-bullet-type (arg) 6536(defun org-fix-bullet-type ()
6467 "Make sure all items in this list have the same bullet." 6537 "Make sure all items in this list have the same bullet as the firsst item."
6468 (interactive "p") 6538 (interactive)
6469 (unless (org-at-item-p) (error "This is not a list")) 6539 (unless (org-at-item-p) (error "This is not a list"))
6470 (let ((line (org-current-line)) 6540 (let ((line (org-current-line))
6471 (col (current-column)) 6541 (col (current-column))
@@ -6558,15 +6628,18 @@ I.e. to the first item in this list."
6558 (delete-region (point-at-bol) (point)) 6628 (delete-region (point-at-bol) (point))
6559 (or (eolp) (indent-to-column (+ ind1 delta))) 6629 (or (eolp) (indent-to-column (+ ind1 delta)))
6560 (beginning-of-line 2)))) 6630 (beginning-of-line 2))))
6631 (org-fix-bullet-type)
6561 (org-maybe-renumber-ordered-list-safe) 6632 (org-maybe-renumber-ordered-list-safe)
6562 (save-excursion 6633 (save-excursion
6563 (beginning-of-line 0) 6634 (beginning-of-line 0)
6564 (condition-case nil (org-beginning-of-item) (error nil)) 6635 (condition-case nil (org-beginning-of-item) (error nil))
6565 (org-maybe-renumber-ordered-list-safe))) 6636 (org-maybe-renumber-ordered-list-safe)))
6566 6637
6567
6568(defun org-item-indent-positions () 6638(defun org-item-indent-positions ()
6569 "Assumes cursor in item line. FIXME" 6639 "Return indentation for plain list items.
6640This returns a list with three values: The current indentation, the
6641parent indentation and the indentation a child should habe.
6642Assumes cursor in item line."
6570 (let* ((bolpos (point-at-bol)) 6643 (let* ((bolpos (point-at-bol))
6571 (ind (org-get-indentation)) 6644 (ind (org-get-indentation))
6572 ind-down ind-up pos) 6645 ind-down ind-up pos)
@@ -6617,6 +6690,9 @@ I.e. to the first item in this list."
6617(defvar orgstruct-mode-map (make-sparse-keymap) 6690(defvar orgstruct-mode-map (make-sparse-keymap)
6618 "Keymap for the minor `orgstruct-mode'.") 6691 "Keymap for the minor `orgstruct-mode'.")
6619 6692
6693(defvar org-local-vars nil
6694 "List of local variables, for use by `orgstruct-mode'")
6695
6620;;;###autoload 6696;;;###autoload
6621(define-minor-mode orgstruct-mode 6697(define-minor-mode orgstruct-mode
6622 "Toggle the minor more `orgstruct-mode'. 6698 "Toggle the minor more `orgstruct-mode'.
@@ -6648,14 +6724,28 @@ C-c C-c Set tags / toggle checkbox"
6648 "Unconditionally turn on `orgstruct-mode'." 6724 "Unconditionally turn on `orgstruct-mode'."
6649 (orgstruct-mode 1)) 6725 (orgstruct-mode 1))
6650 6726
6727;;;###autoload
6728(defun turn-on-orgstruct++ ()
6729 "Unconditionally turn on `orgstruct-mode', and force org-mode indentations.
6730In addition to setting orgstruct-mode, this also exports all indentation and
6731autofilling variables from org-mode into the buffer. Note that turning
6732off orgstruct-mode will *not* remove these additonal settings."
6733 (orgstruct-mode 1)
6734 (let (var val)
6735 (mapc
6736 (lambda (x)
6737 (when (string-match
6738 "^\\(paragraph-\\|auto-fill\\|fill-paragraph\\|adaptive-fill\\|indent-\\)"
6739 (symbol-name (car x)))
6740 (setq var (car x) val (nth 1 x))
6741 (org-set-local var (if (eq (car-safe val) 'quote) (nth 1 val) val))))
6742 org-local-vars)))
6743
6651(defun orgstruct-error () 6744(defun orgstruct-error ()
6652 "Error when there is no default binding for a structure key." 6745 "Error when there is no default binding for a structure key."
6653 (interactive) 6746 (interactive)
6654 (error "This key is has no function outside structure elements")) 6747 (error "This key is has no function outside structure elements"))
6655 6748
6656(defvar org-local-vars nil
6657 "List of local variables, for use by `orgstruct-mode'")
6658
6659(defun orgstruct-setup () 6749(defun orgstruct-setup ()
6660 "Setup orgstruct keymaps." 6750 "Setup orgstruct keymaps."
6661 (let ((nfunc 0) 6751 (let ((nfunc 0)
@@ -6731,7 +6821,8 @@ to execute outside of tables."
6731 '('orgstruct-error)))))))) 6821 '('orgstruct-error))))))))
6732 6822
6733(defun org-context-p (&rest contexts) 6823(defun org-context-p (&rest contexts)
6734 "FIXME:" 6824 "Check if local context is and of CONTEXTS.
6825Possible values in the list of contexts are `table', `headline', and `item'."
6735 (let ((pos (point))) 6826 (let ((pos (point)))
6736 (goto-char (point-at-bol)) 6827 (goto-char (point-at-bol))
6737 (prog1 (or (and (memq 'table contexts) 6828 (prog1 (or (and (memq 'table contexts)
@@ -6805,14 +6896,18 @@ this heading."
6805 (substring (cdr org-time-stamp-formats) 1 -1) 6896 (substring (cdr org-time-stamp-formats) 1 -1)
6806 (current-time))) 6897 (current-time)))
6807 afile heading buffer level newfile-p 6898 afile heading buffer level newfile-p
6808 category todo priority ltags itags) 6899 category todo priority ltags itags prop)
6809 6900
6810 ;; Try to find a local archive location 6901 ;; Try to find a local archive location
6811 (save-excursion 6902 (save-excursion
6812 (save-restriction 6903 (save-restriction
6813 (widen) 6904 (widen)
6814 (if (or (re-search-backward re nil t) (re-search-forward re nil t)) 6905 (setq prop (org-entry-get nil "ARCHIVE" 'inherit))
6815 (setq org-archive-location (match-string 1))))) 6906 (if (and prop (string-match "\\S-" prop))
6907 (setq org-archive-location prop)
6908 (if (or (re-search-backward re nil t)
6909 (re-search-forward re nil t))
6910 (setq org-archive-location (match-string 1))))))
6816 6911
6817 (if (string-match "\\(.*\\)::\\(.*\\)" org-archive-location) 6912 (if (string-match "\\(.*\\)::\\(.*\\)" org-archive-location)
6818 (progn 6913 (progn
@@ -6833,8 +6928,8 @@ this heading."
6833 (save-excursion 6928 (save-excursion
6834 (org-back-to-heading t) 6929 (org-back-to-heading t)
6835 ;; Get context information that will be lost by moving the tree 6930 ;; Get context information that will be lost by moving the tree
6836 (setq org-category-table (org-get-category-table) 6931 (org-refresh-category-properties)
6837 category (org-get-category) 6932 (setq category (org-get-category)
6838 todo (and (looking-at org-todo-line-regexp) 6933 todo (and (looking-at org-todo-line-regexp)
6839 (match-string 2)) 6934 (match-string 2))
6840 priority (org-get-priority (if (match-end 3) (match-string 3) "")) 6935 priority (org-get-priority (if (match-end 3) (match-string 3) ""))
@@ -6922,6 +7017,35 @@ this heading."
6922 (concat "under heading: " heading) 7017 (concat "under heading: " heading)
6923 (concat "in file: " (abbreviate-file-name afile))))))) 7018 (concat "in file: " (abbreviate-file-name afile)))))))
6924 7019
7020(defun org-refresh-category-properties ()
7021 "Refresh category text properties in teh buffer."
7022 (let ((def-cat (cond
7023 ((null org-category)
7024 (if buffer-file-name
7025 (file-name-sans-extension
7026 (file-name-nondirectory buffer-file-name))
7027 "???"))
7028 ((symbolp org-category) (symbol-name org-category))
7029 (t org-category)))
7030 beg end cat pos optionp)
7031 (org-unmodified
7032 (save-excursion
7033 (save-restriction
7034 (widen)
7035 (goto-char (point-min))
7036 (put-text-property (point) (point-max) 'org-category def-cat)
7037 (while (re-search-forward
7038 "^\\(#\\+CATEGORY:\\|[ \t]*:CATEGORY:\\)\\(.*\\)" nil t)
7039 (setq pos (match-end 0)
7040 optionp (equal (char-after (match-beginning 0)) ?#)
7041 cat (org-trim (match-string 2)))
7042 (if optionp
7043 (setq beg (point-at-bol) end (point-max))
7044 (org-back-to-heading t)
7045 (setq beg (point) end (org-end-of-subtree t t)))
7046 (put-text-property beg end 'org-category cat)
7047 (goto-char pos)))))))
7048
6925(defun org-archive-all-done (&optional tag) 7049(defun org-archive-all-done (&optional tag)
6926 "Archive sublevels of the current tree without open TODO items. 7050 "Archive sublevels of the current tree without open TODO items.
6927If the cursor is not on a headline, try all level 1 trees. If 7051If the cursor is not on a headline, try all level 1 trees. If
@@ -7161,7 +7285,9 @@ and table.el tables."
7161(defun org-table-create-or-convert-from-region (arg) 7285(defun org-table-create-or-convert-from-region (arg)
7162 "Convert region to table, or create an empty table. 7286 "Convert region to table, or create an empty table.
7163If there is an active region, convert it to a table, using the function 7287If there is an active region, convert it to a table, using the function
7164`org-table-convert-region'. 7288`org-table-convert-region'. See the documentation of that function
7289to learn how the prefix argument is interpreted to determine the field
7290separator.
7165If there is no such region, create an empty table with `org-table-create'." 7291If there is no such region, create an empty table with `org-table-create'."
7166 (interactive "P") 7292 (interactive "P")
7167 (if (org-region-active-p) 7293 (if (org-region-active-p)
@@ -7200,36 +7326,46 @@ SIZE is a string Columns x Rows like for example \"3x2\"."
7200 (goto-char pos))) 7326 (goto-char pos)))
7201 (org-table-align))) 7327 (org-table-align)))
7202 7328
7203(defun org-table-convert-region (beg0 end0 &optional nspace) 7329(defun org-table-convert-region (beg0 end0 &optional separator)
7204 "Convert region to a table. 7330 "Convert region to a table.
7205The region goes from BEG0 to END0, but these borders will be moved 7331The region goes from BEG0 to END0, but these borders will be moved
7206slightly, to make sure a beginning of line in the first line is included. 7332slightly, to make sure a beginning of line in the first line is included.
7207When NSPACE is non-nil, it indicates the minimum number of spaces that 7333
7208separate columns. By default, the function first checks if every line 7334SEPARATOR specifies the field separator in the lines. It can have the
7209contains at lease one TAB. If yes, it assumes that the material is TAB 7335following values:
7210separated. If not, it assumes a single space as separator." 7336
7337'(4) Use the comma as a field separator
7338'(16) Use a TAB as field separator
7339integer When a number, use that many spaces as field separator
7340nil When nil, the command tries to be smart and figure out the
7341 separator in the following way:
7342 - when each line contains a TAB, assume TAB-separated material
7343 - when each line contains a comme, assume CSV material
7344 - else, assume one or more SPACE charcters as separator."
7211 (interactive "rP") 7345 (interactive "rP")
7212 (let* ((beg (min beg0 end0)) 7346 (let* ((beg (min beg0 end0))
7213 (end (max beg0 end0)) 7347 (end (max beg0 end0))
7214 (tabsep t) 7348 sep-re re)
7215 re)
7216 (goto-char beg) 7349 (goto-char beg)
7217 (beginning-of-line 1) 7350 (beginning-of-line 1)
7218 (setq beg (move-marker (make-marker) (point))) 7351 (setq beg (move-marker (make-marker) (point)))
7219 (goto-char end) 7352 (goto-char end)
7220 (if (bolp) (backward-char 1) (end-of-line 1)) 7353 (if (bolp) (backward-char 1) (end-of-line 1))
7221 (setq end (move-marker (make-marker) (point))) 7354 (setq end (move-marker (make-marker) (point)))
7222 ;; Lets see if this is tab-separated material. If every nonempty line 7355 ;; Get the right field separator
7223 ;; contains a tab, we will assume that it is tab-separated material 7356 (unless separator
7224 (if nspace
7225 (setq tabsep nil)
7226 (goto-char beg) 7357 (goto-char beg)
7227 (and (re-search-forward "^[^\n\t]+$" end t) (setq tabsep nil))) 7358 (setq separator
7228 (if nspace (setq tabsep nil)) 7359 (cond
7229 (if tabsep 7360 ((not (re-search-forward "^[^\n\t]+$" end t)) '(16))
7230 (setq re "^\\|\t") 7361 ((not (re-search-forward "^[^\n,]+$" end t)) '(4))
7231 (setq re (format "^ *\\| *\t *\\| \\{%d,\\}" 7362 (t 1))))
7232 (max 1 (prefix-numeric-value nspace))))) 7363 (setq re (cond
7364 ((equal separator '(4)) "^\\|\"?[ \t]*,[ \t]*\"?")
7365 ((equal separator '(16)) "^\\|\t")
7366 ((integerp separator)
7367 (format "^ *\\| *\t *\\| \\{%d,\\}" separator))
7368 (t (error "This should not happen"))))
7233 (goto-char beg) 7369 (goto-char beg)
7234 (while (re-search-forward re end t) 7370 (while (re-search-forward re end t)
7235 (replace-match "| " t t)) 7371 (replace-match "| " t t))
@@ -8401,8 +8537,8 @@ the table and kill the editing buffer."
8401 8537
8402(defun org-trim (s) 8538(defun org-trim (s)
8403 "Remove whitespace at beginning and end of string." 8539 "Remove whitespace at beginning and end of string."
8404 (if (string-match "^[ \t\n\r]+" s) (setq s (replace-match "" t t s))) 8540 (if (string-match "\\`[ \t\n\r]+" s) (setq s (replace-match "" t t s)))
8405 (if (string-match "[ \t\n\r]+$" s) (setq s (replace-match "" t t s))) 8541 (if (string-match "[ \t\n\r]+\\'" s) (setq s (replace-match "" t t s)))
8406 s) 8542 s)
8407 8543
8408(defun org-wrap (string &optional width lines) 8544(defun org-wrap (string &optional width lines)
@@ -9295,8 +9431,6 @@ With prefix arg ALL, do this for all lines in the table."
9295 (goto-line (nth 1 a)) 9431 (goto-line (nth 1 a))
9296 (org-table-goto-column (nth 2 a)) 9432 (org-table-goto-column (nth 2 a))
9297 (push (append a (list (cdr eq))) eqlname1) 9433 (push (append a (list (cdr eq))) eqlname1)
9298;; FIXME (org-table-eval-formula nil (cdr eq) 'noalign 'nocst
9299;; FIXME 'nostore 'noanalysis)
9300 (org-table-put-field-property :org-untouchable t))) 9434 (org-table-put-field-property :org-untouchable t)))
9301 9435
9302 ;; Now evauluate the column formulas, but skip fields covered by 9436 ;; Now evauluate the column formulas, but skip fields covered by
@@ -9522,7 +9656,7 @@ full TBLFM line."
9522 ((and (> (match-beginning 0) 0) 9656 ((and (> (match-beginning 0) 0)
9523 (equal ?. (aref s (max (1- (match-beginning 0)) 0))) 9657 (equal ?. (aref s (max (1- (match-beginning 0)) 0)))
9524 (not (equal ?. (aref s (max (- (match-beginning 0) 2) 0))))) 9658 (not (equal ?. (aref s (max (- (match-beginning 0) 2) 0)))))
9525 ;; 3.e5 or something like this. FIXME: is this ok???? 9659 ;; 3.e5 or something like this.
9526 (setq start (match-end 0))) 9660 (setq start (match-end 0)))
9527 (t 9661 (t
9528 (setq start (match-beginning 0) 9662 (setq start (match-beginning 0)
@@ -11143,29 +11277,37 @@ according to FMT (default from `org-email-link-description-format')."
11143 ("=" . "%3D") 11277 ("=" . "%3D")
11144 ("+" . "%2B") 11278 ("+" . "%2B")
11145 ) 11279 )
11146 "Association list of escapes for some characters problematic in links.") 11280 "Association list of escapes for some characters problematic in links.
11281This is the list that is used for internal purposes.")
11282
11283(defconst org-link-escape-chars-browser
11284 '((" " . "%20"))
11285 "Association list of escapes for some characters problematic in links.
11286This is the list that is used before handing over to the browser.")
11147 11287
11148(defun org-link-escape (text) 11288(defun org-link-escape (text &optional table)
11149 "Escape charaters in TEXT that are problematic for links." 11289 "Escape charaters in TEXT that are problematic for links."
11290 (setq table (or table org-link-escape-chars))
11150 (when text 11291 (when text
11151 (let ((re (mapconcat (lambda (x) (regexp-quote (car x))) 11292 (let ((re (mapconcat (lambda (x) (regexp-quote (car x)))
11152 org-link-escape-chars "\\|"))) 11293 table "\\|")))
11153 (while (string-match re text) 11294 (while (string-match re text)
11154 (setq text 11295 (setq text
11155 (replace-match 11296 (replace-match
11156 (cdr (assoc (match-string 0 text) org-link-escape-chars)) 11297 (cdr (assoc (match-string 0 text) table))
11157 t t text))) 11298 t t text)))
11158 text))) 11299 text)))
11159 11300
11160(defun org-link-unescape (text) 11301(defun org-link-unescape (text &optional table)
11161 "Reverse the action of `org-link-escape'." 11302 "Reverse the action of `org-link-escape'."
11303 (setq table (or table org-link-escape-chars))
11162 (when text 11304 (when text
11163 (let ((re (mapconcat (lambda (x) (regexp-quote (cdr x))) 11305 (let ((re (mapconcat (lambda (x) (regexp-quote (cdr x)))
11164 org-link-escape-chars "\\|"))) 11306 table "\\|")))
11165 (while (string-match re text) 11307 (while (string-match re text)
11166 (setq text 11308 (setq text
11167 (replace-match 11309 (replace-match
11168 (car (rassoc (match-string 0 text) org-link-escape-chars)) 11310 (car (rassoc (match-string 0 text) table))
11169 t t text))) 11311 t t text)))
11170 text))) 11312 text)))
11171 11313
@@ -11240,12 +11382,13 @@ is in the current directory or below.
11240With three \\[universal-argument] prefixes, negate the meaning of 11382With three \\[universal-argument] prefixes, negate the meaning of
11241`org-keep-stored-link-after-insertion'." 11383`org-keep-stored-link-after-insertion'."
11242 (interactive "P") 11384 (interactive "P")
11243 (let ((wcf (current-window-configuration)) 11385 (let* ((wcf (current-window-configuration))
11244 (region (if (org-region-active-p) 11386 (region (if (org-region-active-p)
11245 (prog1 (buffer-substring (region-beginning) (region-end)) 11387 (buffer-substring (region-beginning) (region-end))))
11246 (delete-region (region-beginning) (region-end))))) 11388 (remove (and region (list (region-beginning) (region-end))))
11247 tmphist ; byte-compile incorrectly complains about this 11389 (desc region)
11248 link desc entry remove file) 11390 tmphist ; byte-compile incorrectly complains about this
11391 link entry file)
11249 (cond 11392 (cond
11250 ((org-in-regexp org-bracket-link-regexp 1) 11393 ((org-in-regexp org-bracket-link-regexp 1)
11251 ;; We do have a link at point, and we are going to edit it. 11394 ;; We do have a link at point, and we are going to edit it.
@@ -11283,7 +11426,7 @@ With three \\[universal-argument] prefixes, negate the meaning of
11283 (with-output-to-temp-buffer "*Org Links*" 11426 (with-output-to-temp-buffer "*Org Links*"
11284 (princ "Insert a link. Use TAB to complete valid link prefixes.\n") 11427 (princ "Insert a link. Use TAB to complete valid link prefixes.\n")
11285 (when org-stored-links 11428 (when org-stored-links
11286 (princ "\nStored links are available with <up>/<down> (most recent with RET):\n\n") 11429 (princ "\nStored links are available with <up>/<down> or M-p/n (most recent with RET):\n\n")
11287 (princ (mapconcat 11430 (princ (mapconcat
11288 (lambda (x) 11431 (lambda (x)
11289 (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x))) 11432 (if (nth 1 x) (concat (car x) " (" (nth 1 x) ")") (car x)))
@@ -11315,7 +11458,7 @@ With three \\[universal-argument] prefixes, negate the meaning of
11315 (not org-keep-stored-link-after-insertion)) 11458 (not org-keep-stored-link-after-insertion))
11316 (setq org-stored-links (delq (assoc link org-stored-links) 11459 (setq org-stored-links (delq (assoc link org-stored-links)
11317 org-stored-links))) 11460 org-stored-links)))
11318 (setq desc (or region desc (nth 1 entry))))) 11461 (setq desc (or desc (nth 1 entry)))))
11319 11462
11320 (if (string-match org-plain-link-re link) 11463 (if (string-match org-plain-link-re link)
11321 ;; URL-like link, normalize the use of angular brackets. 11464 ;; URL-like link, normalize the use of angular brackets.
@@ -11336,6 +11479,7 @@ With three \\[universal-argument] prefixes, negate the meaning of
11336 ;; Check if we can/should use a relative path. If yes, simplify the link 11479 ;; Check if we can/should use a relative path. If yes, simplify the link
11337 (when (string-match "\\<file:\\(.*\\)" link) 11480 (when (string-match "\\<file:\\(.*\\)" link)
11338 (let* ((path (match-string 1 link)) 11481 (let* ((path (match-string 1 link))
11482 (origpath path)
11339 (desc-is-link (equal link desc)) 11483 (desc-is-link (equal link desc))
11340 (case-fold-search nil)) 11484 (case-fold-search nil))
11341 (cond 11485 (cond
@@ -11355,7 +11499,8 @@ With three \\[universal-argument] prefixes, negate the meaning of
11355 (setq path (substring (expand-file-name path) 11499 (setq path (substring (expand-file-name path)
11356 (match-end 0))))))) 11500 (match-end 0)))))))
11357 (setq link (concat "file:" path)) 11501 (setq link (concat "file:" path))
11358 (if desc (setq desc link)))) 11502 (if (equal desc origpath)
11503 (setq desc path))))
11359 11504
11360 (setq desc (read-string "Description: " desc)) 11505 (setq desc (read-string "Description: " desc))
11361 (unless (string-match "\\S-" desc) (setq desc nil)) 11506 (unless (string-match "\\S-" desc) (setq desc nil))
@@ -11519,7 +11664,8 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
11519 (apply cmd (nreverse args1)))) 11664 (apply cmd (nreverse args1))))
11520 11665
11521 ((member type '("http" "https" "ftp" "news")) 11666 ((member type '("http" "https" "ftp" "news"))
11522 (browse-url (concat type ":" path))) 11667 (browse-url (concat type ":" (org-link-escape
11668 path org-link-escape-chars-browser))))
11523 11669
11524 ((string= type "tags") 11670 ((string= type "tags")
11525 (org-tags-view in-emacs path)) 11671 (org-tags-view in-emacs path))
@@ -11601,7 +11747,7 @@ optional argument IN-EMACS is non-nil, Emacs will visit the file."
11601 11747
11602 ((string= type "shell") 11748 ((string= type "shell")
11603 (let ((cmd path)) 11749 (let ((cmd path))
11604 ;; FIXME: the following is only for backward compatibility 11750 ;; The following is only for backward compatibility
11605 (while (string-match "@{" cmd) (setq cmd (replace-match "<" t t cmd))) 11751 (while (string-match "@{" cmd) (setq cmd (replace-match "<" t t cmd)))
11606 (while (string-match "@}" cmd) (setq cmd (replace-match ">" t t cmd))) 11752 (while (string-match "@}" cmd) (setq cmd (replace-match ">" t t cmd)))
11607 (if (or (not org-confirm-shell-link-function) 11753 (if (or (not org-confirm-shell-link-function)
@@ -12219,7 +12365,7 @@ If the file does not exist, an error is thrown."
12219 (setq cmd (replace-match "%s" t t cmd))) 12365 (setq cmd (replace-match "%s" t t cmd)))
12220 (setq cmd (format cmd (shell-quote-argument file))) 12366 (setq cmd (format cmd (shell-quote-argument file)))
12221 (save-window-excursion 12367 (save-window-excursion
12222 (shell-command (concat cmd " &")))) 12368 (start-process-shell-command cmd nil cmd)))
12223 ((or (stringp cmd) 12369 ((or (stringp cmd)
12224 (eq cmd 'emacs)) 12370 (eq cmd 'emacs))
12225 (funcall (cdr (assq 'file org-link-frame-setup)) file) 12371 (funcall (cdr (assq 'file org-link-frame-setup)) file)
@@ -12278,6 +12424,7 @@ RET at beg-of-buf -> Append to file as level 2 headline
12278<left>/<right> -> before/after current headline, same headings level") 12424<left>/<right> -> before/after current headline, same headings level")
12279 12425
12280(defvar org-remember-previous-location nil) 12426(defvar org-remember-previous-location nil)
12427(defvar org-force-remember-template-char) ;; dynamically scoped
12281 12428
12282;;;###autoload 12429;;;###autoload
12283(defun org-remember-apply-template (&optional use-char skip-interactive) 12430(defun org-remember-apply-template (&optional use-char skip-interactive)
@@ -12287,13 +12434,20 @@ to be run from that hook to fucntion properly."
12287 (if org-remember-templates 12434 (if org-remember-templates
12288 12435
12289 (let* ((char (or use-char 12436 (let* ((char (or use-char
12290 (if (= (length org-remember-templates) 1) 12437 (cond
12291 (caar org-remember-templates) 12438 ((= (length org-remember-templates) 1)
12439 (caar org-remember-templates))
12440 ((and (boundp 'org-force-remember-template-char)
12441 org-force-remember-template-char)
12442 (if (string-p org-force-remember-template-char)
12443 (string-to-char org-force-remember-template-char)
12444 org-force-remember-template-char))
12445 (t
12292 (message "Select template: %s" 12446 (message "Select template: %s"
12293 (mapconcat 12447 (mapconcat
12294 (lambda (x) (char-to-string (car x))) 12448 (lambda (x) (char-to-string (car x)))
12295 org-remember-templates " ")) 12449 org-remember-templates " "))
12296 (read-char-exclusive)))) 12450 (read-char-exclusive)))))
12297 (entry (cdr (assoc char org-remember-templates))) 12451 (entry (cdr (assoc char org-remember-templates)))
12298 (tpl (car entry)) 12452 (tpl (car entry))
12299 (plist-p (if org-store-link-plist t nil)) 12453 (plist-p (if org-store-link-plist t nil))
@@ -12402,7 +12556,7 @@ to be run from that hook to fucntion properly."
12402 (org-set-local 'org-finish-function 'remember-buffer))) 12556 (org-set-local 'org-finish-function 'remember-buffer)))
12403 12557
12404;;;###autoload 12558;;;###autoload
12405(defun org-remember () 12559(defun org-remember (&optional org-force-remember-template-char)
12406 "Call `remember'. If this is already a remember buffer, re-apply template. 12560 "Call `remember'. If this is already a remember buffer, re-apply template.
12407If there is an active region, make sure remember uses it as initial content 12561If there is an active region, make sure remember uses it as initial content
12408of the remember buffer." 12562of the remember buffer."
@@ -12459,6 +12613,8 @@ See also the variable `org-reverse-note-order'."
12459 (goto-char (point-min)) 12613 (goto-char (point-min))
12460 (while (looking-at "^[ \t]*\n\\|^##.*\n") 12614 (while (looking-at "^[ \t]*\n\\|^##.*\n")
12461 (replace-match "")) 12615 (replace-match ""))
12616 (goto-char (point-max))
12617 (unless (equal (char-before) ?\n) (insert "\n"))
12462 (catch 'quit 12618 (catch 'quit
12463 (let* ((txt (buffer-substring (point-min) (point-max))) 12619 (let* ((txt (buffer-substring (point-min) (point-max)))
12464 (fastp (org-xor (equal current-prefix-arg '(4)) 12620 (fastp (org-xor (equal current-prefix-arg '(4))
@@ -12501,7 +12657,7 @@ See also the variable `org-reverse-note-order'."
12501 (widen) 12657 (widen)
12502 (and (goto-char (point-min)) 12658 (and (goto-char (point-min))
12503 (not (re-search-forward "^\\* " nil t)) 12659 (not (re-search-forward "^\\* " nil t))
12504 (insert "\n* Notes\n")) 12660 (insert "\n* " (or heading "Notes") "\n"))
12505 (setq reversed (org-notes-order-reversed-p)) 12661 (setq reversed (org-notes-order-reversed-p))
12506 12662
12507 ;; Find the default location 12663 ;; Find the default location
@@ -12511,7 +12667,12 @@ See also the variable `org-reverse-note-order'."
12511 (concat "^\\*+[ \t]+" (regexp-quote heading) 12667 (concat "^\\*+[ \t]+" (regexp-quote heading)
12512 (org-re "\\([ \t]+:[[:alnum:]@_:]*\\)?[ \t]*$")) 12668 (org-re "\\([ \t]+:[[:alnum:]@_:]*\\)?[ \t]*$"))
12513 nil t) 12669 nil t)
12514 (setq org-goto-start-pos (match-beginning 0)))) 12670 (setq org-goto-start-pos (match-beginning 0))
12671 (when fastp
12672 (goto-char (point-max))
12673 (unless (bolp) (newline))
12674 (insert "* " heading "\n")
12675 (setq org-goto-start-pos (point-at-bol 0)))))
12515 12676
12516 ;; Ask the User for a location 12677 ;; Ask the User for a location
12517 (if fastp 12678 (if fastp
@@ -12639,7 +12800,7 @@ the property list including an extra property :name with the block name."
12639 (unless (looking-at org-dblock-start-re) 12800 (unless (looking-at org-dblock-start-re)
12640 (error "Not at a dynamic block")) 12801 (error "Not at a dynamic block"))
12641 (let* ((begdel (1+ (match-end 0))) 12802 (let* ((begdel (1+ (match-end 0)))
12642 (name (match-string 1)) 12803 (name (org-no-properties (match-string 1)))
12643 (params (append (list :name name) 12804 (params (append (list :name name)
12644 (read (concat "(" (match-string 3) ")"))))) 12805 (read (concat "(" (match-string 3) ")")))))
12645 (unless (re-search-forward org-dblock-end-re nil t) 12806 (unless (re-search-forward org-dblock-end-re nil t)
@@ -12680,12 +12841,16 @@ blocks in the buffer."
12680 "Update the dynamic block at point 12841 "Update the dynamic block at point
12681This means to empty the block, parse for parameters and then call 12842This means to empty the block, parse for parameters and then call
12682the correct writing function." 12843the correct writing function."
12683 (let* ((pos (point)) 12844 (save-window-excursion
12684 (params (org-prepare-dblock)) 12845 (let* ((pos (point))
12685 (name (plist-get params :name)) 12846 (line (org-current-line))
12686 (cmd (intern (concat "org-dblock-write:" name)))) 12847 (params (org-prepare-dblock))
12687 (funcall cmd params) 12848 (name (plist-get params :name))
12688 (goto-char pos))) 12849 (cmd (intern (concat "org-dblock-write:" name))))
12850 (message "Updating dynamic block `%s' at line %d..." name line)
12851 (funcall cmd params)
12852 (message "Updating dynamic block `%s' at line %d...done" name line)
12853 (goto-char pos))))
12689 12854
12690(defun org-beginning-of-dblock () 12855(defun org-beginning-of-dblock ()
12691 "Find the beginning of the dynamic block at point. 12856 "Find the beginning of the dynamic block at point.
@@ -12710,6 +12875,10 @@ This function can be used in a hook."
12710 12875
12711;;;; Completion 12876;;;; Completion
12712 12877
12878(defconst org-additional-option-like-keywords
12879 '("BEGIN_HTML" "BEGIN_LaTeX" "END_HTML" "END_LaTeX"
12880 "ORGTBL" "HTML:" "LaTeX:"))
12881
12713(defun org-complete (&optional arg) 12882(defun org-complete (&optional arg)
12714 "Perform completion on word at point. 12883 "Perform completion on word at point.
12715At the beginning of a headline, this completes TODO keywords as given in 12884At the beginning of a headline, this completes TODO keywords as given in
@@ -12719,99 +12888,108 @@ that are supported for HTML support.
12719If the current word is preceded by \"#+\", completes special words for 12888If the current word is preceded by \"#+\", completes special words for
12720setting file options. 12889setting file options.
12721In the line after \"#+STARTUP:, complete valid keywords.\" 12890In the line after \"#+STARTUP:, complete valid keywords.\"
12722At all other locations, this simply calls `ispell-complete-word'." 12891At all other locations, this simply calls the value of
12892`org-completion-fallback-command'."
12723 (interactive "P") 12893 (interactive "P")
12724 (catch 'exit 12894 (org-without-partial-completion
12725 (let* ((end (point)) 12895 (catch 'exit
12726 (beg1 (save-excursion 12896 (let* ((end (point))
12727 (skip-chars-backward (org-re "[:alnum:]_@")) 12897 (beg1 (save-excursion
12898 (skip-chars-backward (org-re "[:alnum:]_@"))
12899 (point)))
12900 (beg (save-excursion
12901 (skip-chars-backward "a-zA-Z0-9_:$")
12728 (point))) 12902 (point)))
12729 (beg (save-excursion 12903 (confirm (lambda (x) (stringp (car x))))
12730 (skip-chars-backward "a-zA-Z0-9_:$") 12904 (searchhead (equal (char-before beg) ?*))
12731 (point))) 12905 (tag (and (equal (char-before beg1) ?:)
12732 (confirm (lambda (x) (stringp (car x)))) 12906 (equal (char-after (point-at-bol)) ?*)))
12733 (searchhead (equal (char-before beg) ?*)) 12907 (prop (and (equal (char-before beg1) ?:)
12734 (tag (and (equal (char-before beg1) ?:) 12908 (not (equal (char-after (point-at-bol)) ?*))))
12735 (equal (char-after (point-at-bol)) ?*))) 12909 (texp (equal (char-before beg) ?\\))
12736 (prop (and (equal (char-before beg1) ?:) 12910 (link (equal (char-before beg) ?\[))
12737 (not (equal (char-after (point-at-bol)) ?*)))) 12911 (opt (equal (buffer-substring (max (point-at-bol) (- beg 2))
12738 (texp (equal (char-before beg) ?\\)) 12912 beg)
12739 (link (equal (char-before beg) ?\[)) 12913 "#+"))
12740 (opt (equal (buffer-substring (max (point-at-bol) (- beg 2)) 12914 (startup (string-match "^#\\+STARTUP:.*"
12741 beg) 12915 (buffer-substring (point-at-bol) (point))))
12742 "#+")) 12916 (completion-ignore-case opt)
12743 (startup (string-match "^#\\+STARTUP:.*" 12917 (type nil)
12744 (buffer-substring (point-at-bol) (point)))) 12918 (tbl nil)
12745 (completion-ignore-case opt) 12919 (table (cond
12746 (type nil) 12920 (opt
12747 (tbl nil) 12921 (setq type :opt)
12748 (table (cond 12922 (append
12749 (opt 12923 (mapcar
12750 (setq type :opt) 12924 (lambda (x)
12751 (mapcar (lambda (x) 12925 (string-match "^#\\+\\(\\([A-Z_]+:?\\).*\\)" x)
12752 (string-match "^#\\+\\(\\([A-Z_]+:?\\).*\\)" x) 12926 (cons (match-string 2 x) (match-string 1 x)))
12753 (cons (match-string 2 x) (match-string 1 x))) 12927 (org-split-string (org-get-current-options) "\n"))
12754 (org-split-string (org-get-current-options) "\n"))) 12928 (mapcar 'list org-additional-option-like-keywords)))
12755 (startup 12929 (startup
12756 (setq type :startup) 12930 (setq type :startup)
12757 org-startup-options) 12931 org-startup-options)
12758 (link (append org-link-abbrev-alist-local 12932 (link (append org-link-abbrev-alist-local
12759 org-link-abbrev-alist)) 12933 org-link-abbrev-alist))
12760 (texp 12934 (texp
12761 (setq type :tex) 12935 (setq type :tex)
12762 org-html-entities) 12936 org-html-entities)
12763 ((string-match "\\`\\*+[ \t]+\\'" 12937 ((string-match "\\`\\*+[ \t]+\\'"
12764 (buffer-substring (point-at-bol) beg)) 12938 (buffer-substring (point-at-bol) beg))
12765 (setq type :todo) 12939 (setq type :todo)
12766 (mapcar 'list org-todo-keywords-1)) 12940 (mapcar 'list org-todo-keywords-1))
12767 (searchhead 12941 (searchhead
12768 (setq type :searchhead) 12942 (setq type :searchhead)
12769 (save-excursion 12943 (save-excursion
12770 (goto-char (point-min)) 12944 (goto-char (point-min))
12771 (while (re-search-forward org-todo-line-regexp nil t) 12945 (while (re-search-forward org-todo-line-regexp nil t)
12772 (push (list 12946 (push (list
12773 (org-make-org-heading-search-string 12947 (org-make-org-heading-search-string
12774 (match-string 3) t)) 12948 (match-string 3) t))
12775 tbl))) 12949 tbl)))
12776 tbl) 12950 tbl)
12777 (tag (setq type :tag beg beg1) 12951 (tag (setq type :tag beg beg1)
12778 (or org-tag-alist (org-get-buffer-tags))) 12952 (or org-tag-alist (org-get-buffer-tags)))
12779 (prop (setq type :prop beg beg1) 12953 (prop (setq type :prop beg beg1)
12780 (mapcar 'list (org-buffer-property-keys))) 12954 (mapcar 'list (org-buffer-property-keys)))
12781 (t (progn (ispell-complete-word arg) (throw 'exit nil))))) 12955 (t (progn
12782 (pattern (buffer-substring-no-properties beg end)) 12956 (call-interactively org-completion-fallback-command)
12783 (completion (try-completion pattern table confirm))) 12957 (throw 'exit nil)))))
12784 (cond ((eq completion t) 12958 (pattern (buffer-substring-no-properties beg end))
12785 (if (equal type :opt) 12959 (completion (try-completion pattern table confirm)))
12786 (insert (substring (cdr (assoc (upcase pattern) table)) 12960 (cond ((eq completion t)
12787 (length pattern))) 12961 (if (not (assoc (upcase pattern) table))
12788 (if (memq type '(:tag :prop)) (insert ":")))) 12962 (message "Already complete")
12789 ((null completion) 12963 (if (equal type :opt)
12790 (message "Can't find completion for \"%s\"" pattern) 12964 (insert (substring (cdr (assoc (upcase pattern) table))
12791 (ding)) 12965 (length pattern)))
12792 ((not (string= pattern completion)) 12966 (if (memq type '(:tag :prop)) (insert ":")))))
12793 (delete-region beg end) 12967 ((null completion)
12794 (if (string-match " +$" completion) 12968 (message "Can't find completion for \"%s\"" pattern)
12795 (setq completion (replace-match "" t t completion))) 12969 (ding))
12796 (insert completion) 12970 ((not (string= pattern completion))
12797 (if (get-buffer-window "*Completions*") 12971 (delete-region beg end)
12798 (delete-window (get-buffer-window "*Completions*"))) 12972 (if (string-match " +$" completion)
12799 (if (assoc completion table) 12973 (setq completion (replace-match "" t t completion)))
12800 (if (eq type :todo) (insert " ") 12974 (insert completion)
12801 (if (memq type '(:tag :prop)) (insert ":")))) 12975 (if (get-buffer-window "*Completions*")
12802 (if (and (equal type :opt) (assoc completion table)) 12976 (delete-window (get-buffer-window "*Completions*")))
12803 (message "%s" (substitute-command-keys 12977 (if (assoc completion table)
12804 "Press \\[org-complete] again to insert example settings")))) 12978 (if (eq type :todo) (insert " ")
12805 (t 12979 (if (memq type '(:tag :prop)) (insert ":"))))
12806 (message "Making completion list...") 12980 (if (and (equal type :opt) (assoc completion table))
12807 (let ((list (sort (all-completions pattern table confirm) 12981 (message "%s" (substitute-command-keys
12808 'string<))) 12982 "Press \\[org-complete] again to insert example settings"))))
12809 (with-output-to-temp-buffer "*Completions*" 12983 (t
12810 (condition-case nil 12984 (message "Making completion list...")
12811 ;; Protection needed for XEmacs and emacs 21 12985 (let ((list (sort (all-completions pattern table confirm)
12812 (display-completion-list list pattern) 12986 'string<)))
12813 (error (display-completion-list list))))) 12987 (with-output-to-temp-buffer "*Completions*"
12814 (message "Making completion list...%s" "done")))))) 12988 (condition-case nil
12989 ;; Protection needed for XEmacs and emacs 21
12990 (display-completion-list list pattern)
12991 (error (display-completion-list list)))))
12992 (message "Making completion list...%s" "done")))))))
12815 12993
12816;;;; TODO, DEADLINE, Comments 12994;;;; TODO, DEADLINE, Comments
12817 12995
@@ -12835,6 +13013,15 @@ this is nil.")
12835 13013
12836(defvar org-setting-tags nil) ; dynamically skiped 13014(defvar org-setting-tags nil) ; dynamically skiped
12837 13015
13016;; FIXME: better place
13017(defun org-property-or-variable-value (var &optional inherit)
13018 "Check if there is a property fixing the value of VAR.
13019If yes, return this value. If not, return the current value of the variable."
13020 (let ((prop (org-entry-get nil (symbol-name var) inherit)))
13021 (if (and prop (stringp prop) (string-match "\\S-" prop))
13022 (read prop)
13023 (symbol-value var))))
13024
12838(defun org-todo (&optional arg) 13025(defun org-todo (&optional arg)
12839 "Change the TODO state of an item. 13026 "Change the TODO state of an item.
12840The state of an item is given by a keyword at the start of the heading, 13027The state of an item is given by a keyword at the start of the heading,
@@ -12865,7 +13052,11 @@ For calling through lisp, arg is also interpreted in the following way:
12865 (if (looking-at outline-regexp) (goto-char (1- (match-end 0)))) 13052 (if (looking-at outline-regexp) (goto-char (1- (match-end 0))))
12866 (or (looking-at (concat " +" org-todo-regexp " *")) 13053 (or (looking-at (concat " +" org-todo-regexp " *"))
12867 (looking-at " *")) 13054 (looking-at " *"))
12868 (let* ((this (match-string 1)) 13055 (let* ((logging (save-match-data (org-entry-get nil "LOGGING" t)))
13056 (org-log-done (org-parse-local-options logging 'org-log-done))
13057 (org-log-repeat (org-parse-local-options logging 'org-log-repeat))
13058 (this (match-string 1))
13059 (hl-pos (match-beginning 0))
12869 (head (org-get-todo-sequence-head this)) 13060 (head (org-get-todo-sequence-head this))
12870 (ass (assoc head org-todo-kwd-alist)) 13061 (ass (assoc head org-todo-kwd-alist))
12871 (interpret (nth 1 ass)) 13062 (interpret (nth 1 ass))
@@ -12882,7 +13073,9 @@ For calling through lisp, arg is also interpreted in the following way:
12882 (not (eq org-use-fast-todo-selection 'prefix))))) 13073 (not (eq org-use-fast-todo-selection 'prefix)))))
12883 ;; Use fast selection 13074 ;; Use fast selection
12884 (org-fast-todo-selection)) 13075 (org-fast-todo-selection))
12885 ((and (equal arg '(4)) (eq org-use-fast-todo-selection nil)) 13076 ((and (equal arg '(4))
13077 (or (not org-use-fast-todo-selection)
13078 (not org-todo-key-trigger)))
12886 ;; Read a state with completion 13079 ;; Read a state with completion
12887 (completing-read "State: " (mapcar (lambda(x) (list x)) 13080 (completing-read "State: " (mapcar (lambda(x) (list x))
12888 org-todo-keywords-1) 13081 org-todo-keywords-1)
@@ -12931,6 +13124,8 @@ For calling through lisp, arg is also interpreted in the following way:
12931 (next (if state (concat " " state " ") " ")) 13124 (next (if state (concat " " state " ") " "))
12932 dostates) 13125 dostates)
12933 (replace-match next t t) 13126 (replace-match next t t)
13127 (unless (pos-visible-in-window-p hl-pos)
13128 (message "TODO state changed to %s" (org-trim next)))
12934 (unless head 13129 (unless head
12935 (setq head (org-get-todo-sequence-head state) 13130 (setq head (org-get-todo-sequence-head state)
12936 ass (assoc head org-todo-kwd-alist) 13131 ass (assoc head org-todo-kwd-alist)
@@ -12963,9 +13158,6 @@ For calling through lisp, arg is also interpreted in the following way:
12963 ((and (member state org-done-keywords) 13158 ((and (member state org-done-keywords)
12964 (not (member this org-done-keywords))) 13159 (not (member this org-done-keywords)))
12965 ;; It is now done, and it was not done before 13160 ;; It is now done, and it was not done before
12966 ;; FIXME: We used to remove scheduling info....
12967; (org-add-planning-info 'closed (org-current-time)
12968; (if (org-get-repeat) nil 'scheduled))
12969 (org-add-planning-info 'closed (org-current-time)) 13161 (org-add-planning-info 'closed (org-current-time))
12970 (org-add-log-maybe 'done state 'findpos)))) 13162 (org-add-log-maybe 'done state 'findpos))))
12971 ;; Fixup tag positioning 13163 ;; Fixup tag positioning
@@ -13058,7 +13250,7 @@ Returns the new TODO keyword, or nil if no state change should occur."
13058 ((or (= c ?\C-g) 13250 ((or (= c ?\C-g)
13059 (and (= c ?q) (not (rassoc c fulltable)))) 13251 (and (= c ?q) (not (rassoc c fulltable))))
13060 (setq quit-flag t)) 13252 (setq quit-flag t))
13061 ((= c ?\ ) 'none) 13253 ((= c ?\ ) nil)
13062 ((setq e (rassoc c fulltable) tg (car e)) 13254 ((setq e (rassoc c fulltable) tg (car e))
13063 tg) 13255 tg)
13064 (t (setq quit-flag t)))))) 13256 (t (setq quit-flag t))))))
@@ -13139,19 +13331,25 @@ of `org-todo-keywords-1'."
13139 (message "%d TODO entries found" 13331 (message "%d TODO entries found"
13140 (org-occur (concat "^" outline-regexp " *" kwd-re ))))) 13332 (org-occur (concat "^" outline-regexp " *" kwd-re )))))
13141 13333
13142(defun org-deadline () 13334(defun org-deadline (&optional remove)
13143 "Insert the DEADLINE: string to make a deadline. 13335 "Insert the \"DEADLINE:\" string with a timestamp to make a deadline.
13144A timestamp is also inserted - use \\[org-timestamp-up] and \\[org-timestamp-down] 13336With argument REMOVE, remove any deadline from the item."
13145to modify it to the correct date." 13337 (interactive "P")
13146 (interactive) 13338 (if remove
13147 (org-add-planning-info 'deadline nil 'closed)) 13339 (progn
13340 (org-add-planning-info nil nil 'deadline)
13341 (message "Item no longer has a deadline."))
13342 (org-add-planning-info 'deadline nil 'closed)))
13148 13343
13149(defun org-schedule () 13344(defun org-schedule (&optional remove)
13150 "Insert the SCHEDULED: string to schedule a TODO item. 13345 "Insert the SCHEDULED: string with a timestamp to schedule a TODO item.
13151A timestamp is also inserted - use \\[org-timestamp-up] and \\[org-timestamp-down] 13346With argument REMOVE, remove any scheduling date from the item."
13152to modify it to the correct date." 13347 (interactive "P")
13153 (interactive) 13348 (if remove
13154 (org-add-planning-info 'scheduled nil 'closed)) 13349 (progn
13350 (org-add-planning-info nil nil 'scheduled)
13351 (message "Item is no longer scheduled."))
13352 (org-add-planning-info 'scheduled nil 'closed)))
13155 13353
13156(defun org-add-planning-info (what &optional time &rest remove) 13354(defun org-add-planning-info (what &optional time &rest remove)
13157 "Insert new timestamp with keyword in the line directly after the headline. 13355 "Insert new timestamp with keyword in the line directly after the headline.
@@ -13179,11 +13377,6 @@ be removed."
13179 (goto-char (match-end 0)) 13377 (goto-char (match-end 0))
13180 (if (eobp) (insert "\n")) 13378 (if (eobp) (insert "\n"))
13181 (forward-char 1) 13379 (forward-char 1)
13182 (when (and (not org-insert-labeled-timestamps-before-properties-drawer)
13183 (looking-at "[ \t]*:PROPERTIES:[ \t]*$"))
13184 (goto-char (match-end 0))
13185 (if (eobp) (insert "\n"))
13186 (forward-char 1))
13187 (if (and (not (looking-at outline-regexp)) 13380 (if (and (not (looking-at outline-regexp))
13188 (looking-at (concat "[^\r\n]*?" org-keyword-time-regexp 13381 (looking-at (concat "[^\r\n]*?" org-keyword-time-regexp
13189 "[^\r\n]*")) 13382 "[^\r\n]*"))
@@ -13215,12 +13408,12 @@ be removed."
13215 ((eq what 'deadline) org-deadline-string) 13408 ((eq what 'deadline) org-deadline-string)
13216 ((eq what 'closed) org-closed-string)) 13409 ((eq what 'closed) org-closed-string))
13217 " ") 13410 " ")
13218 (org-insert-time-stamp 13411 (setq ts (org-insert-time-stamp
13219 time 13412 time
13220 (or org-time-was-given 13413 (or org-time-was-given
13221 (and (eq what 'closed) org-log-done-with-time)) 13414 (and (eq what 'closed) org-log-done-with-time))
13222 (eq what 'closed) 13415 (eq what 'closed)
13223 nil nil (list org-end-time-was-given)) 13416 nil nil (list org-end-time-was-given)))
13224 (end-of-line 1)) 13417 (end-of-line 1))
13225 (goto-char (point-min)) 13418 (goto-char (point-min))
13226 (widen) 13419 (widen)
@@ -13477,9 +13670,15 @@ ACTION can be `set', `up', `down', or a character."
13477 (error "Priority must be between `%c' and `%c'" 13670 (error "Priority must be between `%c' and `%c'"
13478 org-highest-priority org-lowest-priority)))) 13671 org-highest-priority org-lowest-priority))))
13479 ((eq action 'up) 13672 ((eq action 'up)
13480 (setq new (1- current))) 13673 (if (and (not have) (eq last-command this-command))
13674 (setq new org-lowest-priority)
13675 (setq new (if (and org-priority-start-cycle-with-default (not have))
13676 org-default-priority (1- current)))))
13481 ((eq action 'down) 13677 ((eq action 'down)
13482 (setq new (1+ current))) 13678 (if (and (not have) (eq last-command this-command))
13679 (setq new org-highest-priority)
13680 (setq new (if (and org-priority-start-cycle-with-default (not have))
13681 org-default-priority (1+ current)))))
13483 (t (error "Invalid action"))) 13682 (t (error "Invalid action")))
13484 (if (or (< (upcase new) org-highest-priority) 13683 (if (or (< (upcase new) org-highest-priority)
13485 (> (upcase new) org-lowest-priority)) 13684 (> (upcase new) org-lowest-priority))
@@ -13792,8 +13991,9 @@ With prefix ARG, realign all tags in headings in the current buffer."
13792 (if org-fast-tag-selection-include-todo org-todo-key-alist)) 13991 (if org-fast-tag-selection-include-todo org-todo-key-alist))
13793 (let ((org-add-colon-after-tag-completion t)) 13992 (let ((org-add-colon-after-tag-completion t))
13794 (org-trim 13993 (org-trim
13795 (completing-read "Tags: " 'org-tags-completion-function 13994 (org-without-partial-completion
13796 nil nil current 'org-tags-history)))))) 13995 (completing-read "Tags: " 'org-tags-completion-function
13996 nil nil current 'org-tags-history)))))))
13797 (while (string-match "[-+&]+" tags) 13997 (while (string-match "[-+&]+" tags)
13798 ;; No boolean logic, just a list 13998 ;; No boolean logic, just a list
13799 (setq tags (replace-match ":" t t tags)))) 13999 (setq tags (replace-match ":" t t tags))))
@@ -14069,9 +14269,9 @@ Returns the new tags string, or nil to not change the current settings."
14069 (setq current (delete tg current)) 14269 (setq current (delete tg current))
14070 (loop for g in groups do 14270 (loop for g in groups do
14071 (if (member tg g) 14271 (if (member tg g)
14072 (mapcar (lambda (x) 14272 (mapc (lambda (x)
14073 (setq current (delete x current))) 14273 (setq current (delete x current)))
14074 g))) 14274 g)))
14075 (push tg current)) 14275 (push tg current))
14076 (if exit-after-next (setq exit-after-next 'now)))) 14276 (if exit-after-next (setq exit-after-next 'now))))
14077 14277
@@ -14134,8 +14334,7 @@ Returns the new tags string, or nil to not change the current settings."
14134;;; Setting and retrieving properties 14334;;; Setting and retrieving properties
14135 14335
14136(defconst org-special-properties 14336(defconst org-special-properties
14137 '("TODO" "TAGS" "ALLTAGS" "DEADLINE" "SCHEDULED" 14337 '("TODO" "TAGS" "ALLTAGS" "DEADLINE" "SCHEDULED" "CLOCK" "PRIORITY")
14138 "CLOCK" "PRIORITY")
14139 "The special properties valid in Org-mode. 14338 "The special properties valid in Org-mode.
14140 14339
14141These are properties that are not defined in the property drawer, 14340These are properties that are not defined in the property drawer,
@@ -14364,23 +14563,28 @@ If the property is not present at all, nil is returned."
14364 (error "The %s property can not yet be set with `org-entry-put'" 14563 (error "The %s property can not yet be set with `org-entry-put'"
14365 property)) 14564 property))
14366 (t ; a non-special property 14565 (t ; a non-special property
14367 (setq range (org-get-property-block beg end 'force)) 14566 (let ((buffer-invisibility-spec (org-inhibit-invisibility))) ; Emacs 21
14368 (goto-char (car range)) 14567 (setq range (org-get-property-block beg end 'force))
14369 (if (re-search-forward 14568 (goto-char (car range))
14370 (concat "^[ \t]*:" property ":\\(.*\\)") (cdr range) t) 14569 (if (re-search-forward
14371 (progn 14570 (concat "^[ \t]*:" property ":\\(.*\\)") (cdr range) t)
14372 (delete-region (match-beginning 1) (match-end 1)) 14571 (progn
14373 (goto-char (match-beginning 1))) 14572 (delete-region (match-beginning 1) (match-end 1))
14374 (goto-char (cdr range)) 14573 (goto-char (match-beginning 1)))
14375 (insert "\n") 14574 (goto-char (cdr range))
14376 (backward-char 1) 14575 (insert "\n")
14377 (org-indent-line-function) 14576 (backward-char 1)
14378 (insert ":" property ":")) 14577 (org-indent-line-function)
14379 (and value (insert " " value)) 14578 (insert ":" property ":"))
14380 (org-indent-line-function)))))) 14579 (and value (insert " " value))
14381 14580 (org-indent-line-function)))))))
14382(defun org-buffer-property-keys (&optional include-specials) 14581
14383 "Get all property keys in the current buffer." 14582(defun org-buffer-property-keys (&optional include-specials include-defaults)
14583 "Get all property keys in the current buffer.
14584With INCLUDE-SPECIALS, also list the special properties that relect things
14585like tags and TODO state.
14586With INCLUDE-DEFAULTS, also include properties that has special meaning
14587internally: ARCHIVE, CATEGORY, SUMMARY, DESCRIPTION, LOCATION, and LOGGING."
14384 (let (rtn range) 14588 (let (rtn range)
14385 (save-excursion 14589 (save-excursion
14386 (save-restriction 14590 (save-restriction
@@ -14396,6 +14600,9 @@ If the property is not present at all, nil is returned."
14396 (outline-next-heading)))) 14600 (outline-next-heading))))
14397 (when include-specials 14601 (when include-specials
14398 (setq rtn (append org-special-properties rtn))) 14602 (setq rtn (append org-special-properties rtn)))
14603 (when include-defaults
14604 (add-to-list rtn "CATEGORY")
14605 (add-to-list rtn "ARCHIVE"))
14399 (sort rtn (lambda (a b) (string< (upcase a) (upcase b)))))) 14606 (sort rtn (lambda (a b) (string< (upcase a) (upcase b))))))
14400 14607
14401(defun org-insert-property-drawer () 14608(defun org-insert-property-drawer ()
@@ -14477,7 +14684,9 @@ If the property is not present at all, nil is returned."
14477(defvar org-columns-current-fmt-compiled) ; defined below 14684(defvar org-columns-current-fmt-compiled) ; defined below
14478 14685
14479(defun org-compute-property-at-point () 14686(defun org-compute-property-at-point ()
14480 "FIXME:" 14687 "Compute the property at point.
14688This looks for an enclosing column format, extracts the operator and
14689then applies it to the proerty in the column format's scope."
14481 (interactive) 14690 (interactive)
14482 (unless (org-at-property-p) 14691 (unless (org-at-property-p)
14483 (error "Not at a property")) 14692 (error "Not at a property"))
@@ -14745,16 +14954,24 @@ This is the compiled version of the format.")
14745 (org-unmodified 14954 (org-unmodified
14746 (org-columns-remove-overlays) 14955 (org-columns-remove-overlays)
14747 (let ((inhibit-read-only t)) 14956 (let ((inhibit-read-only t))
14748 ;; FIXME: is this safe???
14749 ;; or are there other reasons why there may be a read-only property????
14750 (remove-text-properties (point-min) (point-max) '(read-only t)))) 14957 (remove-text-properties (point-min) (point-max) '(read-only t))))
14751 (when (eq major-mode 'org-agenda-mode) 14958 (when (eq major-mode 'org-agenda-mode)
14752 (message "Modification not yet reflected in Agenda buffer, use `r' to refresh"))) 14959 (message
14960 "Modification not yet reflected in Agenda buffer, use `r' to refresh")))
14961
14962(defun org-columns-check-computed ()
14963 "Check if this column value is computed.
14964If yes, throw an error indicating that changing it does not make sense."
14965 (let ((val (get-char-property (point) 'org-columns-value)))
14966 (when (and (stringp val)
14967 (get-char-property 0 'org-computed val))
14968 (error "This value is computed from the entry's children"))))
14753 14969
14754(defun org-columns-edit-value () 14970(defun org-columns-edit-value ()
14755 "Edit the value of the property at point in column view. 14971 "Edit the value of the property at point in column view.
14756Where possible, use the standard interface for changing this line." 14972Where possible, use the standard interface for changing this line."
14757 (interactive) 14973 (interactive)
14974 (org-columns-check-computed)
14758 (let* ((col (current-column)) 14975 (let* ((col (current-column))
14759 (key (get-char-property (point) 'org-columns-key)) 14976 (key (get-char-property (point) 'org-columns-key))
14760 (value (get-char-property (point) 'org-columns-value)) 14977 (value (get-char-property (point) 'org-columns-value))
@@ -14847,6 +15064,7 @@ Where possible, use the standard interface for changing this line."
14847(defun org-columns-next-allowed-value (&optional previous) 15064(defun org-columns-next-allowed-value (&optional previous)
14848 "Switch to the next allowed value for this column." 15065 "Switch to the next allowed value for this column."
14849 (interactive) 15066 (interactive)
15067 (org-columns-check-computed)
14850 (let* ((col (current-column)) 15068 (let* ((col (current-column))
14851 (key (get-char-property (point) 'org-columns-key)) 15069 (key (get-char-property (point) 'org-columns-key))
14852 (value (get-char-property (point) 'org-columns-value)) 15070 (value (get-char-property (point) 'org-columns-value))
@@ -15130,8 +15348,10 @@ display, or in the #+COLUMNS line of the current buffer."
15130 (setq pos (org-overlay-start ov)) 15348 (setq pos (org-overlay-start ov))
15131 (goto-char pos) 15349 (goto-char pos)
15132 (when (setq val (cdr (assoc property 15350 (when (setq val (cdr (assoc property
15133 (get-text-property (point-at-bol) 'org-summaries)))) 15351 (get-text-property
15352 (point-at-bol) 'org-summaries))))
15134 (setq fmt (org-overlay-get ov 'org-columns-format)) 15353 (setq fmt (org-overlay-get ov 'org-columns-format))
15354 (org-overlay-put ov 'org-columns-value val)
15135 (org-overlay-put ov 'display (format fmt val))))) 15355 (org-overlay-put ov 'display (format fmt val)))))
15136 org-columns-overlays)))) 15356 org-columns-overlays))))
15137 15357
@@ -15141,11 +15361,12 @@ display, or in the #+COLUMNS line of the current buffer."
15141 (let* ((re (concat "^" outline-regexp)) 15361 (let* ((re (concat "^" outline-regexp))
15142 (lmax 30) ; Does anyone use deeper levels??? 15362 (lmax 30) ; Does anyone use deeper levels???
15143 (lsum (make-vector lmax 0)) 15363 (lsum (make-vector lmax 0))
15364 (lflag (make-vector lmax nil))
15144 (level 0) 15365 (level 0)
15145 (ass (assoc property org-columns-current-fmt-compiled)) 15366 (ass (assoc property org-columns-current-fmt-compiled))
15146 (format (nth 4 ass)) 15367 (format (nth 4 ass))
15147 (beg org-columns-top-level-marker) 15368 (beg org-columns-top-level-marker)
15148 last-level val end sumpos sum-alist sum str) 15369 last-level val valflag flag end sumpos sum-alist sum str str1 useval)
15149 (save-excursion 15370 (save-excursion
15150 ;; Find the region to compute 15371 ;; Find the region to compute
15151 (goto-char beg) 15372 (goto-char beg)
@@ -15156,29 +15377,41 @@ display, or in the #+COLUMNS line of the current buffer."
15156 (setq sumpos (match-beginning 0) 15377 (setq sumpos (match-beginning 0)
15157 last-level level 15378 last-level level
15158 level (org-outline-level) 15379 level (org-outline-level)
15159 val (org-entry-get nil property)) 15380 val (org-entry-get nil property)
15381 valflag (and val (string-match "\\S-" val)))
15160 (cond 15382 (cond
15161 ((< level last-level) 15383 ((< level last-level)
15162 ;; put the sum of lower levels here as a property 15384 ;; put the sum of lower levels here as a property
15163 (setq sum (aref lsum last-level) 15385 (setq sum (aref lsum last-level) ; current sum
15386 flag (aref lflag last-level) ; any valid entries from children?
15164 str (org-column-number-to-string sum format) 15387 str (org-column-number-to-string sum format)
15388 str1 (org-add-props (copy-sequence str) nil 'org-computed t 'face 'bold)
15389 useval (if flag str1 (if valflag val ""))
15165 sum-alist (get-text-property sumpos 'org-summaries)) 15390 sum-alist (get-text-property sumpos 'org-summaries))
15166 (if (assoc property sum-alist) 15391 (if (assoc property sum-alist)
15167 (setcdr (assoc property sum-alist) str) 15392 (setcdr (assoc property sum-alist) useval)
15168 (push (cons property str) sum-alist) 15393 (push (cons property useval) sum-alist)
15169 (org-unmodified 15394 (org-unmodified
15170 (add-text-properties sumpos (1+ sumpos) 15395 (add-text-properties sumpos (1+ sumpos)
15171 (list 'org-summaries sum-alist)))) 15396 (list 'org-summaries sum-alist))))
15172 (when val ;?????????????????????????????????? and force????? 15397 (when val
15173 (org-entry-put nil property str)) 15398 (org-entry-put nil property (if flag str val)))
15174 ;; add current to current level accumulator 15399 ;; add current to current level accumulator
15175 (aset lsum level (+ (aref lsum level) sum)) 15400 (when (or flag valflag)
15401 ;; FIXME: is this ok?????????
15402 (aset lsum level (+ (aref lsum level)
15403 (if flag sum (org-column-string-to-number
15404 (if flag str val) format))))
15405 (aset lflag level t))
15176 ;; clear accumulators for deeper levels 15406 ;; clear accumulators for deeper levels
15177 (loop for l from (1+ level) to (1- lmax) do (aset lsum l 0))) 15407 (loop for l from (1+ level) to (1- lmax) do
15408 (aset lsum l 0)
15409 (aset lflag l nil)))
15178 ((>= level last-level) 15410 ((>= level last-level)
15179 ;; add what we have here to the accumulator for this level 15411 ;; add what we have here to the accumulator for this level
15180 (aset lsum level (+ (aref lsum level) 15412 (aset lsum level (+ (aref lsum level)
15181 (org-column-string-to-number (or val "0") format)))) 15413 (org-column-string-to-number (or val "0") format)))
15414 (and valflag (aset lflag level t)))
15182 (t (error "This should not happen"))))))) 15415 (t (error "This should not happen")))))))
15183 15416
15184(defun org-columns-redo () 15417(defun org-columns-redo ()
@@ -15254,7 +15487,14 @@ display, or in the #+COLUMNS line of the current buffer."
15254 (org-trim rtn))) 15487 (org-trim rtn)))
15255 15488
15256(defun org-columns-compile-format (fmt) 15489(defun org-columns-compile-format (fmt)
15257 "FIXME" 15490 "Turn a column format string into an alist of specifications.
15491The alist has one entry for each column in the format. The elements of
15492that list are:
15493property the property
15494title the title field for the columns
15495width the column width in characters, can be nil for automatic
15496operator the operator if any
15497format the output format for computed results, derived from operator"
15258 (let ((start 0) width prop title op f) 15498 (let ((start 0) width prop title op f)
15259 (setq org-columns-current-fmt-compiled nil) 15499 (setq org-columns-current-fmt-compiled nil)
15260 (while (string-match 15500 (while (string-match
@@ -15292,18 +15532,28 @@ So if you press just return without typing anything, the time stamp
15292will represent the current date/time. If there is already a timestamp 15532will represent the current date/time. If there is already a timestamp
15293at the cursor, it will be modified." 15533at the cursor, it will be modified."
15294 (interactive "P") 15534 (interactive "P")
15295 (let (org-time-was-given org-end-time-was-given time) 15535 (let ((default-time
15536 ;; Default time is either today, or, when entering a range,
15537 ;; the range start.
15538 (if (or (org-at-timestamp-p t)
15539 (save-excursion
15540 (re-search-backward
15541 (concat org-ts-regexp "--?-?\\=") ; 1-3 minuses
15542 (- (point) 20) t)))
15543 (apply 'encode-time (org-parse-time-string (match-string 1)))
15544 (current-time)))
15545 org-time-was-given org-end-time-was-given time)
15296 (cond 15546 (cond
15297 ((and (org-at-timestamp-p) 15547 ((and (org-at-timestamp-p)
15298 (eq last-command 'org-time-stamp) 15548 (eq last-command 'org-time-stamp)
15299 (eq this-command 'org-time-stamp)) 15549 (eq this-command 'org-time-stamp))
15300 (insert "--") 15550 (insert "--")
15301 (setq time (let ((this-command this-command)) 15551 (setq time (let ((this-command this-command))
15302 (org-read-date arg 'totime))) 15552 (org-read-date arg 'totime nil nil default-time)))
15303 (org-insert-time-stamp time (or org-time-was-given arg))) 15553 (org-insert-time-stamp time (or org-time-was-given arg)))
15304 ((org-at-timestamp-p) 15554 ((org-at-timestamp-p)
15305 (setq time (let ((this-command this-command)) 15555 (setq time (let ((this-command this-command))
15306 (org-read-date arg 'totime))) 15556 (org-read-date arg 'totime nil nil default-time)))
15307 (when (org-at-timestamp-p) ; just to get the match data 15557 (when (org-at-timestamp-p) ; just to get the match data
15308 (replace-match "") 15558 (replace-match "")
15309 (setq org-last-changed-timestamp 15559 (setq org-last-changed-timestamp
@@ -15313,9 +15563,9 @@ at the cursor, it will be modified."
15313 (message "Timestamp updated")) 15563 (message "Timestamp updated"))
15314 (t 15564 (t
15315 (setq time (let ((this-command this-command)) 15565 (setq time (let ((this-command this-command))
15316 (org-read-date arg 'totime))) 15566 (org-read-date arg 'totime nil nil default-time)))
15317 (org-insert-time-stamp time (or org-time-was-given arg) 15567 (org-insert-time-stamp time (or org-time-was-given arg)
15318 nil nil nil (list org-end-time-was-given)))))) 15568 nil nil nil (list org-end-time-was-given))))))
15319 15569
15320(defun org-time-stamp-inactive (&optional arg) 15570(defun org-time-stamp-inactive (&optional arg)
15321 "Insert an inactive time stamp. 15571 "Insert an inactive time stamp.
@@ -15337,12 +15587,15 @@ So these are more for recording a certain time/date."
15337(defvar org-ans2) ; dynamically scoped parameter 15587(defvar org-ans2) ; dynamically scoped parameter
15338 15588
15339(defvar org-plain-time-of-day-regexp) ; defined below 15589(defvar org-plain-time-of-day-regexp) ; defined below
15340(defun org-read-date (&optional with-time to-time from-string prompt) 15590(defun org-read-date (&optional with-time to-time from-string prompt
15591 default-time)
15341 "Read a date and make things smooth for the user. 15592 "Read a date and make things smooth for the user.
15342The prompt will suggest to enter an ISO date, but you can also enter anything 15593The prompt will suggest to enter an ISO date, but you can also enter anything
15343which will at least partially be understood by `parse-time-string'. 15594which will at least partially be understood by `parse-time-string'.
15344Unrecognized parts of the date will default to the current day, month, year, 15595Unrecognized parts of the date will default to the current day, month, year,
15345hour and minute. For example, 15596hour and minute. If this command is called to replace a timestamp at point,
15597of to enter the second timestamp of a range, the default time is taken from the
15598existing stamp. For example,
15346 3-2-5 --> 2003-02-05 15599 3-2-5 --> 2003-02-05
15347 feb 15 --> currentyear-02-15 15600 feb 15 --> currentyear-02-15
15348 sep 12 9 --> 2009-09-12 15601 sep 12 9 --> 2009-09-12
@@ -15368,32 +15621,25 @@ With an optional argument WITH-TIME, the prompt will suggest to also
15368insert a time. Note that when WITH-TIME is not set, you can still 15621insert a time. Note that when WITH-TIME is not set, you can still
15369enter a time, and this function will inform the calling routine about 15622enter a time, and this function will inform the calling routine about
15370this change. The calling routine may then choose to change the format 15623this change. The calling routine may then choose to change the format
15371used to insert the time stamp into the buffer to include the time." 15624used to insert the time stamp into the buffer to include the time.
15625With optional argument FROM-STRING, read fomr this string instead from
15626the user. PROMPT can overwrite the default prompt. DEFAULT-TIME is
15627the time/date that is used for everything that is not specified by the
15628user."
15372 (require 'parse-time) 15629 (require 'parse-time)
15373 (let* ((org-time-stamp-rounding-minutes 15630 (let* ((org-time-stamp-rounding-minutes
15374 (if (equal with-time '(16)) 0 org-time-stamp-rounding-minutes)) 15631 (if (equal with-time '(16)) 0 org-time-stamp-rounding-minutes))
15375 (ct (org-current-time)) 15632 (ct (org-current-time))
15376 (default-time 15633 (def (or default-time ct))
15377 ;; Default time is either today, or, when entering a range,
15378 ;; the range start.
15379 (if (save-excursion
15380 (re-search-backward
15381 (concat org-ts-regexp "--?-?\\=") ; 1-3 minuses
15382 (- (point) 20) t))
15383 (apply
15384 'encode-time
15385 (mapcar (lambda(x) (or x 0))
15386 (parse-time-string (match-string 1))))
15387 ct))
15388 (calendar-move-hook nil) 15634 (calendar-move-hook nil)
15389 (view-diary-entries-initially nil) 15635 (view-diary-entries-initially nil)
15390 (view-calendar-holidays-initially nil) 15636 (view-calendar-holidays-initially nil)
15391 (timestr (format-time-string 15637 (timestr (format-time-string
15392 (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") default-time)) 15638 (if with-time "%Y-%m-%d %H:%M" "%Y-%m-%d") def))
15393 (prompt (concat (if prompt (concat prompt " ") "") 15639 (prompt (concat (if prompt (concat prompt " ") "")
15394 (format "Date and/or time (default [%s]): " timestr))) 15640 (format "Date and/or time (default [%s]): " timestr)))
15395 ans (org-ans0 "") org-ans1 org-ans2 (deltadays 0) 15641 ans (org-ans0 "") org-ans1 org-ans2 (deltadays 0)
15396 second minute hour day month year tl wday wday1 pm) 15642 second minute hour day month year tl wday wday1 pm h2 m2)
15397 15643
15398 (cond 15644 (cond
15399 (from-string (setq ans from-string)) 15645 (from-string (setq ans from-string))
@@ -15401,7 +15647,7 @@ used to insert the time stamp into the buffer to include the time."
15401 (save-excursion 15647 (save-excursion
15402 (save-window-excursion 15648 (save-window-excursion
15403 (calendar) 15649 (calendar)
15404 (calendar-forward-day (- (time-to-days default-time) 15650 (calendar-forward-day (- (time-to-days def)
15405 (calendar-absolute-from-gregorian 15651 (calendar-absolute-from-gregorian
15406 (calendar-current-date)))) 15652 (calendar-current-date))))
15407 (org-eval-in-calendar nil t) 15653 (org-eval-in-calendar nil t)
@@ -15467,16 +15713,28 @@ used to insert the time stamp into the buffer to include the time."
15467 ;; Help matching am/pm times, because `parse-time-string' does not do that. 15713 ;; Help matching am/pm times, because `parse-time-string' does not do that.
15468 ;; If there is a time with am/pm, and *no* time without it, we convert 15714 ;; If there is a time with am/pm, and *no* time without it, we convert
15469 ;; so that matching will be successful. 15715 ;; so that matching will be successful.
15470 ;; FIXME: make this replace twice, so that we catch the end time. 15716 (loop for i from 1 to 2 do ; twice, for end time as well
15471 (when (and (not (string-match "[012]?[0-9]:[0-9][0-9]\\([ \t\n]\\|$\\)" ans)) 15717 (when (and (not (string-match "\\(\\`\\|[^+]\\)[012]?[0-9]:[0-9][0-9]\\([ \t\n]\\|$\\)" ans))
15472 (string-match "\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\(am\\|AM\\|pm\\|PM\\)\\>" ans)) 15718 (string-match "\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?\\(am\\|AM\\|pm\\|PM\\)\\>" ans))
15719 (setq hour (string-to-number (match-string 1 ans))
15720 minute (if (match-end 3)
15721 (string-to-number (match-string 3 ans))
15722 0)
15723 pm (equal ?p
15724 (string-to-char (downcase (match-string 4 ans)))))
15725 (if (and (= hour 12) (not pm))
15726 (setq hour 0)
15727 (if (and pm (< hour 12)) (setq hour (+ 12 hour))))
15728 (setq ans (replace-match (format "%02d:%02d" hour minute)
15729 t t ans))))
15730
15731 ;; Check if a time range is given as a duration
15732 (when (string-match "\\([012]?[0-9]\\):\\([0-6][0-9]\\)\\+\\([012]?[0-9]\\)\\(:\\([0-5][0-9]\\)\\)?" ans)
15473 (setq hour (string-to-number (match-string 1 ans)) 15733 (setq hour (string-to-number (match-string 1 ans))
15474 minute (if (match-end 3) (string-to-number (match-string 3 ans)) 0) 15734 h2 (+ hour (string-to-number (match-string 3 ans)))
15475 pm (equal ?p (string-to-char (downcase (match-string 4 ans))))) 15735 minute (string-to-number (match-string 2 ans))
15476 (if (and (= hour 12) (not pm)) 15736 m2 (+ minute (if (match-end 5) (string-to-number (match-string 5 ans))0)))
15477 (setq hour 0) 15737 (setq ans (replace-match (format "%02d:%02d-%02d:%02d" hour minute h2 m2) t t ans)))
15478 (if (and pm (< hour 12)) (setq hour (+ 12 hour))))
15479 (setq ans (replace-match (format "%02d:%02d" hour minute) t t ans)))
15480 15738
15481 ;; Check if there is a time range 15739 ;; Check if there is a time range
15482 (when (and (boundp 'org-end-time-was-given) 15740 (when (and (boundp 'org-end-time-was-given)
@@ -15487,11 +15745,11 @@ used to insert the time stamp into the buffer to include the time."
15487 (substring ans (match-end 7))))) 15745 (substring ans (match-end 7)))))
15488 15746
15489 (setq tl (parse-time-string ans) 15747 (setq tl (parse-time-string ans)
15490 year (or (nth 5 tl) (string-to-number (format-time-string "%Y" ct))) 15748 year (or (nth 5 tl) (string-to-number (format-time-string "%Y" def)))
15491 month (or (nth 4 tl) (string-to-number (format-time-string "%m" ct))) 15749 month (or (nth 4 tl) (string-to-number (format-time-string "%m" def)))
15492 day (or (nth 3 tl) (string-to-number (format-time-string "%d" ct))) 15750 day (or (nth 3 tl) (string-to-number (format-time-string "%d" def)))
15493 hour (or (nth 2 tl) (string-to-number (format-time-string "%H" ct))) 15751 hour (or (nth 2 tl) (string-to-number (format-time-string "%H" def)))
15494 minute (or (nth 1 tl) (string-to-number (format-time-string "%M" ct))) 15752 minute (or (nth 1 tl) (string-to-number (format-time-string "%M" def)))
15495 second (or (nth 0 tl) 0) 15753 second (or (nth 0 tl) 0)
15496 wday (nth 6 tl)) 15754 wday (nth 6 tl))
15497 (setq day (+ day deltadays)) 15755 (setq day (+ day deltadays))
@@ -15723,10 +15981,10 @@ days in order to avoid rounding problems."
15723 (or 15981 (or
15724 (org-clock-update-time-maybe) 15982 (org-clock-update-time-maybe)
15725 (save-excursion 15983 (save-excursion
15726 (unless (org-at-date-range-p) 15984 (unless (org-at-date-range-p t)
15727 (goto-char (point-at-bol)) 15985 (goto-char (point-at-bol))
15728 (re-search-forward org-tr-regexp (point-at-eol) t)) 15986 (re-search-forward org-tr-regexp-both (point-at-eol) t))
15729 (if (not (org-at-date-range-p)) 15987 (if (not (org-at-date-range-p t))
15730 (error "Not at a time-stamp range, and none found in current line"))) 15988 (error "Not at a time-stamp range, and none found in current line")))
15731 (let* ((ts1 (match-string 1)) 15989 (let* ((ts1 (match-string 1))
15732 (ts2 (match-string 2)) 15990 (ts2 (match-string 2))
@@ -15835,7 +16093,8 @@ D may be an absolute day number, or a calendar-type list (month day year)."
15835 (t nil)))) 16093 (t nil))))
15836 16094
15837(defun org-diary-to-ical-string (frombuf) 16095(defun org-diary-to-ical-string (frombuf)
15838 "FIXME" 16096 "Get iCalendar entreis from diary entries in buffer FROMBUF.
16097This uses the icalendar.el library."
15839 (let* ((tmpdir (if (featurep 'xemacs) 16098 (let* ((tmpdir (if (featurep 'xemacs)
15840 (temp-directory) 16099 (temp-directory)
15841 temporary-file-directory)) 16100 temporary-file-directory))
@@ -15992,7 +16251,7 @@ With prefix ARG, change that many days."
15992 (ans (or (looking-at tsr) 16251 (ans (or (looking-at tsr)
15993 (save-excursion 16252 (save-excursion
15994 (skip-chars-backward "^[<\n\r\t") 16253 (skip-chars-backward "^[<\n\r\t")
15995 (if (> (point) 1) (backward-char 1)) 16254 (if (> (point) (point-min)) (backward-char 1))
15996 (and (looking-at tsr) 16255 (and (looking-at tsr)
15997 (> (- (match-end 0) pos) -1)))))) 16256 (> (- (match-end 0) pos) -1))))))
15998 (and (boundp 'org-ts-what) 16257 (and (boundp 'org-ts-what)
@@ -16073,8 +16332,9 @@ in the timestamp determines what will be changed."
16073 (memq org-ts-what '(day month year))) 16332 (memq org-ts-what '(day month year)))
16074 (org-recenter-calendar (time-to-days time))))) 16333 (org-recenter-calendar (time-to-days time)))))
16075 16334
16335;; FIXME: does not yet work for lead times
16076(defun org-modify-ts-extra (s pos n) 16336(defun org-modify-ts-extra (s pos n)
16077 "FIXME" 16337 "Change the different parts of the lead-time and repeat fields in timestamp."
16078 (let ((idx '(("d" . 0) ("w" . 1) ("m" . 2) ("y" . 3) ("d" . -1) ("y" . 4))) 16338 (let ((idx '(("d" . 0) ("w" . 1) ("m" . 2) ("y" . 3) ("d" . -1) ("y" . 4)))
16079 ng h m new) 16339 ng h m new)
16080 (when (string-match "\\(-\\([012][0-9]\\):\\([0-5][0-9]\\)\\)?\\( \\+\\([0-9]+\\)\\([dmwy]\\)\\)?" s) 16340 (when (string-match "\\(-\\([012][0-9]\\):\\([0-5][0-9]\\)\\)?\\( \\+\\([0-9]+\\)\\([dmwy]\\)\\)?" s)
@@ -16140,6 +16400,55 @@ If there is already a time stamp at the cursor position, update it."
16140 (interactive) 16400 (interactive)
16141 (org-timestamp-change 0 'calendar)) 16401 (org-timestamp-change 0 'calendar))
16142 16402
16403;; Make appt aware of appointments from the agenda
16404(defun org-agenda-to-appt (&optional filter)
16405 "Activate appointments found in `org-agenda-files'.
16406When prefixed, prompt for a regular expression and use it as a
16407filter: only add entries if they match this regular expression.
16408
16409FILTER can be a string. In this case, use this string as a
16410regular expression to filter results.
16411
16412FILTER can also be an alist, with the car of each cell being
16413either 'headline or 'category. For example:
16414
16415 '((headline \"IMPORTANT\")
16416 (category \"Work\"))
16417
16418will only add headlines containing IMPORTANT or headlines
16419belonging to the category \"Work\"."
16420 (interactive "P")
16421 (require 'org)
16422 (if (equal filter '(4))
16423 (setq filter (read-from-minibuffer "Regexp filter: ")))
16424 (let* ((today (org-date-to-gregorian
16425 (time-to-days (current-time))))
16426 (files org-agenda-files) entries file)
16427 (while (setq file (pop files))
16428 (setq entries (append entries (org-agenda-get-day-entries
16429 file today :timestamp))))
16430 (setq entries (delq nil entries))
16431 (mapc
16432 (lambda(x)
16433 (let* ((evt (org-trim (get-text-property 1 'txt x)))
16434 (cat (get-text-property 1 'org-category x))
16435 (tod (get-text-property 1 'time-of-day x))
16436 (ok (or (and (stringp filter) (string-match filter evt))
16437 (and (not (null filter)) (listp filter)
16438 (or (string-match
16439 (cadr (assoc 'category filter)) cat)
16440 (string-match
16441 (cadr (assoc 'headline filter)) evt))))))
16442 ;; (setq evt (set-text-properties 0 (length event) nil evt))
16443 (when (and ok tod)
16444 (setq tod (number-to-string tod)
16445 tod (when (string-match
16446 "\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)" tod)
16447 (concat (match-string 1 tod) ":"
16448 (match-string 2 tod))))
16449 (appt-add tod evt)))) entries)
16450 nil))
16451
16143;;; The clock for measuring work time. 16452;;; The clock for measuring work time.
16144 16453
16145(defvar org-mode-line-string "") 16454(defvar org-mode-line-string "")
@@ -16176,15 +16485,8 @@ If necessary, clock-out of the currently active clock."
16176 (setq org-clock-heading (match-string 3)) 16485 (setq org-clock-heading (match-string 3))
16177 (setq org-clock-heading "???")) 16486 (setq org-clock-heading "???"))
16178 (setq org-clock-heading (propertize org-clock-heading 'face nil)) 16487 (setq org-clock-heading (propertize org-clock-heading 'face nil))
16179 (beginning-of-line 2) 16488 (org-clock-find-position)
16180 (while 16489
16181 (or (and (looking-at (concat "[ \t]*" org-keyword-time-regexp))
16182 (not (equal (match-string 1) org-clock-string)))
16183 (and (looking-at "[ \t]*:PROPERTIES:")
16184 (not org-insert-labeled-timestamps-before-properties-drawer)))
16185 ;; Scheduling info, or properties drawer, move one line further
16186 (beginning-of-line 2)
16187 (or (bolp) (newline)))
16188 (insert "\n") (backward-char 1) 16490 (insert "\n") (backward-char 1)
16189 (indent-relative) 16491 (indent-relative)
16190 (insert org-clock-string " ") 16492 (insert org-clock-string " ")
@@ -16199,6 +16501,57 @@ If necessary, clock-out of the currently active clock."
16199 (setq org-mode-line-timer (run-with-timer 60 60 'org-update-mode-line)) 16501 (setq org-mode-line-timer (run-with-timer 60 60 'org-update-mode-line))
16200 (message "Clock started at %s" ts)))) 16502 (message "Clock started at %s" ts))))
16201 16503
16504(defun org-clock-find-position ()
16505 "Find the location where the next clock line should be inserted."
16506 (org-back-to-heading t)
16507 (catch 'exit
16508 (let ((beg (point-at-bol 2)) (end (progn (outline-next-heading) (point)))
16509 (re (concat "^[ \t]*" org-clock-string))
16510 (cnt 0)
16511 first last)
16512 (goto-char beg)
16513 (when (eobp) (newline) (setq end (max (point) end)))
16514 (when (re-search-forward "^[ \t]*:CLOCK:" end t)
16515 ;; we seem to have a CLOCK drawer, so go there.
16516 (beginning-of-line 2)
16517 (throw 'exit t))
16518 ;; Lets count the CLOCK lines
16519 (goto-char beg)
16520 (while (re-search-forward re end t)
16521 (setq first (or first (match-beginning 0))
16522 last (match-beginning 0)
16523 cnt (1+ cnt)))
16524 (when (and (integerp org-clock-into-drawer)
16525 (>= (1+ cnt) org-clock-into-drawer))
16526 ;; Wrap current entries into a new drawer
16527 (goto-char last)
16528 (beginning-of-line 2)
16529 (if (org-at-item-p) (org-end-of-item))
16530 (insert ":END:\n")
16531 (beginning-of-line 0)
16532 (org-indent-line-function)
16533 (goto-char first)
16534 (insert ":CLOCK:\n")
16535 (beginning-of-line 0)
16536 (org-indent-line-function)
16537 (org-flag-drawer t)
16538 (beginning-of-line 2)
16539 (throw 'exit nil))
16540
16541 (goto-char beg)
16542 (while (and (looking-at (concat "[ \t]*" org-keyword-time-regexp))
16543 (not (equal (match-string 1) org-clock-string)))
16544 ;; Planning info, skip to after it
16545 (beginning-of-line 2)
16546 (or (bolp) (newline)))
16547 (when (eq t org-clock-into-drawer)
16548 (insert ":CLOCK:\n:END:\n")
16549 (beginning-of-line -1)
16550 (org-indent-line-function)
16551 (org-flag-drawer t)
16552 (beginning-of-line 2)
16553 (org-indent-line-function)))))
16554
16202(defun org-clock-out (&optional fail-quietly) 16555(defun org-clock-out (&optional fail-quietly)
16203 "Stop the currently running clock. 16556 "Stop the currently running clock.
16204If there is no running clock, throw an error, unless FAIL-QUIETLY is set." 16557If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
@@ -16227,7 +16580,10 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
16227 s (- s (* 60 s))) 16580 s (- s (* 60 s)))
16228 (insert " => " (format "%2d:%02d" h m)) 16581 (insert " => " (format "%2d:%02d" h m))
16229 (move-marker org-clock-marker nil) 16582 (move-marker org-clock-marker nil)
16230 (org-add-log-maybe 'clock-out) 16583 (let* ((logging (save-match-data (org-entry-get nil "LOGGING" t)))
16584 (org-log-done (org-parse-local-options logging 'org-log-done))
16585 (org-log-repeat (org-parse-local-options logging 'org-log-repeat)))
16586 (org-add-log-maybe 'clock-out))
16231 (when org-mode-line-timer 16587 (when org-mode-line-timer
16232 (cancel-timer org-mode-line-timer) 16588 (cancel-timer org-mode-line-timer)
16233 (setq org-mode-line-timer nil)) 16589 (setq org-mode-line-timer nil))
@@ -16247,6 +16603,19 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
16247 (delete-region (1- (point-at-bol)) (point-at-eol))) 16603 (delete-region (1- (point-at-bol)) (point-at-eol)))
16248 (message "Clock canceled")) 16604 (message "Clock canceled"))
16249 16605
16606(defun org-clock-goto (&optional delete-windows)
16607 "Go to the currently clocked-in entry."
16608 (interactive "P")
16609 (if (not (marker-buffer org-clock-marker))
16610 (error "No active clock"))
16611 (switch-to-buffer-other-window
16612 (marker-buffer org-clock-marker))
16613 (if delete-windows (delete-other-windows))
16614 (goto-char org-clock-marker)
16615 (org-show-entry)
16616 (org-back-to-heading)
16617 (recenter))
16618
16250(defvar org-clock-file-total-minutes nil 16619(defvar org-clock-file-total-minutes nil
16251 "Holds the file total time in minutes, after a call to `org-clock-sum'.") 16620 "Holds the file total time in minutes, after a call to `org-clock-sum'.")
16252 (make-variable-buffer-local 'org-clock-file-total-minutes) 16621 (make-variable-buffer-local 'org-clock-file-total-minutes)
@@ -16310,7 +16679,10 @@ in the echo area."
16310 (unless total-only 16679 (unless total-only
16311 (save-excursion 16680 (save-excursion
16312 (goto-char (point-min)) 16681 (goto-char (point-min))
16313 (while (setq p (next-single-property-change (point) :org-clock-minutes)) 16682 (while (or (and (equal (setq p (point)) (point-min))
16683 (get-text-property p :org-clock-minutes))
16684 (setq p (next-single-property-change
16685 (point) :org-clock-minutes)))
16314 (goto-char p) 16686 (goto-char p)
16315 (when (setq time (get-text-property p :org-clock-minutes)) 16687 (when (setq time (get-text-property p :org-clock-minutes))
16316 (org-put-clock-overlay time (funcall outline-level)))) 16688 (org-put-clock-overlay time (funcall outline-level))))
@@ -16393,25 +16765,32 @@ If yes, offer to stop it and to save the buffer with the changes."
16393 (when (y-or-n-p "Save changed buffer?") 16765 (when (y-or-n-p "Save changed buffer?")
16394 (save-buffer)))) 16766 (save-buffer))))
16395 16767
16396(defun org-clock-report () 16768(defun org-clock-report (&optional arg)
16397 "Create a table containing a report about clocked time. 16769 "Create a table containing a report about clocked time.
16398If the buffer contains lines 16770If the cursor is inside an existing clocktable block, then the table
16399#+BEGIN: clocktable :maxlevel 3 :emphasize nil 16771will be updated. If not, a new clocktable will be inserted.
16400 16772When called with a prefix argument, move to the first clock table in the
16401#+END: clocktable 16773buffer and update it."
16402then the table will be inserted between these lines, replacing whatever 16774 (interactive "P")
16403is was there before. If these lines are not in the buffer, the table
16404is inserted at point, surrounded by the special lines.
16405The BEGIN line can contain parameters. Allowed are:
16406:maxlevel The maximum level to be included in the table. Default is 3.
16407:emphasize t/nil, if levell 1 and level 2 should be bold/italic in the table."
16408 (interactive)
16409 (org-remove-clock-overlays) 16775 (org-remove-clock-overlays)
16410 (unless (org-find-dblock "clocktable") 16776 (when arg (org-find-dblock "clocktable"))
16777 (if (org-in-clocktable-p)
16778 (goto-char (org-in-clocktable-p))
16411 (org-create-dblock (list :name "clocktable" 16779 (org-create-dblock (list :name "clocktable"
16412 :maxlevel 2 :emphasize nil))) 16780 :maxlevel 2 :scope 'file)))
16413 (org-update-dblock)) 16781 (org-update-dblock))
16414 16782
16783(defun org-in-clocktable-p ()
16784 "Check if the cursor is in a clocktable."
16785 (let ((pos (point)) start)
16786 (save-excursion
16787 (end-of-line 1)
16788 (and (re-search-backward "^#\\+BEGIN:[ \t]+clocktable" nil t)
16789 (setq start (match-beginning 0))
16790 (re-search-forward "^#\\+END:.*" nil t)
16791 (>= (match-end 0) pos)
16792 start))))
16793
16415(defun org-clock-update-time-maybe () 16794(defun org-clock-update-time-maybe ()
16416 "If this is a CLOCK line, update it and return t. 16795 "If this is a CLOCK line, update it and return t.
16417Otherwise, return nil." 16796Otherwise, return nil."
@@ -16485,12 +16864,16 @@ the returned times will be formatted strings."
16485 16864
16486(defun org-dblock-write:clocktable (params) 16865(defun org-dblock-write:clocktable (params)
16487 "Write the standard clocktable." 16866 "Write the standard clocktable."
16488 (let ((hlchars '((1 . "*") (2 . ?/))) 16867 (let ((hlchars '((1 . "*") (2 . "/")))
16489 (emph nil) 16868 (emph nil)
16490 (ins (make-marker)) 16869 (ins (make-marker))
16870 (total-time nil)
16491 ipos time h m p level hlc hdl maxlevel 16871 ipos time h m p level hlc hdl maxlevel
16492 ts te cc block) 16872 ts te cc block beg end pos scope tbl tostring multifile)
16493 (setq maxlevel (or (plist-get params :maxlevel) 3) 16873 (setq scope (plist-get params :scope)
16874 tostring (plist-get params :tostring)
16875 multifile (plist-get params :multifile)
16876 maxlevel (or (plist-get params :maxlevel) 3)
16494 emph (plist-get params :emphasize) 16877 emph (plist-get params :emphasize)
16495 ts (plist-get params :tstart) 16878 ts (plist-get params :tstart)
16496 te (plist-get params :tend) 16879 te (plist-get params :tend)
@@ -16504,48 +16887,114 @@ the returned times will be formatted strings."
16504 (apply 'encode-time (org-parse-time-string te))))) 16887 (apply 'encode-time (org-parse-time-string te)))))
16505 (move-marker ins (point)) 16888 (move-marker ins (point))
16506 (setq ipos (point)) 16889 (setq ipos (point))
16507 (insert-before-markers "Clock summary at [" 16890
16508 (substring 16891 ;; Get the right scope
16509 (format-time-string (cdr org-time-stamp-formats)) 16892 (setq pos (point))
16510 1 -1) 16893 (save-restriction
16511 "]." 16894 (cond
16512 (if block 16895 ((not scope))
16513 (format " Considered range is /%s/." block) 16896 ((eq scope 'file) (widen))
16514 "") 16897 ((eq scope 'subtree) (org-narrow-to-subtree))
16515 "\n\n|L|Headline|Time|\n") 16898 ((eq scope 'tree)
16516 (org-clock-sum ts te) 16899 (while (org-up-heading-safe))
16517 (setq h (/ org-clock-file-total-minutes 60) 16900 (org-narrow-to-subtree))
16518 m (- org-clock-file-total-minutes (* 60 h))) 16901 ((and (symbolp scope) (string-match "^tree\\([0-9]+\\)$"
16519 (insert-before-markers "|-\n|0|" "*Total file time*| " 16902 (symbol-name scope)))
16520 (format "*%d:%02d*" h m) 16903 (setq level (string-to-number (match-string 1 (symbol-name scope))))
16521 "|\n") 16904 (catch 'exit
16522 (goto-char (point-min)) 16905 (while (org-up-heading-safe)
16523 (while (setq p (next-single-property-change (point) :org-clock-minutes)) 16906 (looking-at outline-regexp)
16524 (goto-char p) 16907 (if (<= (org-reduced-level (funcall outline-level)) level)
16525 (when (setq time (get-text-property p :org-clock-minutes)) 16908 (throw 'exit nil))))
16526 (save-excursion 16909 (org-narrow-to-subtree))
16527 (beginning-of-line 1) 16910 ((or (listp scope) (eq scope 'agenda))
16528 (when (and (looking-at (org-re "\\(\\*+\\)[ \t]+\\(.*?\\)\\([ \t]+:[[:alnum:]_@:]+:\\)?[ \t]*$")) 16911 (let* ((files (if (listp scope) scope (org-agenda-files)))
16529 (setq level (- (match-end 1) (match-beginning 1))) 16912 (scope 'agenda)
16530 (<= level maxlevel)) 16913 (p1 (copy-sequence params))
16531 (setq hlc (if emph (or (cdr (assoc level hlchars)) "") "") 16914 file)
16532 hdl (match-string 2) 16915 (plist-put p1 :tostring t)
16533 h (/ time 60) 16916 (plist-put p1 :multifile t)
16534 m (- time (* 60 h))) 16917 (plist-put p1 :scope 'file)
16535 (goto-char ins) 16918 (org-prepare-agenda-buffers files)
16536 (if (= level 1) (insert-before-markers "|-\n")) 16919 (while (setq file (pop files))
16537 (insert-before-markers 16920 (with-current-buffer (find-buffer-visiting file)
16538 "| " (int-to-string level) "|" hlc hdl hlc " |" 16921 (push (org-clocktable-add-file
16539 (make-string (1- level) ?|) 16922 file (org-dblock-write:clocktable p1)) tbl)
16540 hlc 16923 (setq total-time (+ (or total-time 0)
16541 (format "%d:%02d" h m) 16924 org-clock-file-total-minutes)))))))
16542 hlc 16925 (goto-char pos)
16543 " |\n"))))) 16926
16544 (goto-char ins) 16927 (unless (eq scope 'agenda)
16545 (backward-delete-char 1) 16928 (org-clock-sum ts te)
16546 (goto-char ipos) 16929 (goto-char (point-min))
16547 (skip-chars-forward "^|") 16930 (while (setq p (next-single-property-change (point) :org-clock-minutes))
16548 (org-table-align))) 16931 (goto-char p)
16932 (when (setq time (get-text-property p :org-clock-minutes))
16933 (save-excursion
16934 (beginning-of-line 1)
16935 (when (and (looking-at (org-re "\\(\\*+\\)[ \t]+\\(.*?\\)\\([ \t]+:[[:alnum:]_@:]+:\\)?[ \t]*$"))
16936 (setq level (org-reduced-level
16937 (- (match-end 1) (match-beginning 1))))
16938 (<= level maxlevel))
16939 (setq hlc (if emph (or (cdr (assoc level hlchars)) "") "")
16940 hdl (match-string 2)
16941 h (/ time 60)
16942 m (- time (* 60 h)))
16943 (if (and (not multifile) (= level 1)) (push "|-" tbl))
16944 (push (concat
16945 "| " (int-to-string level) "|" hlc hdl hlc " |"
16946 (make-string (1- level) ?|)
16947 hlc (format "%d:%02d" h m) hlc
16948 " |") tbl))))))
16949 (setq tbl (nreverse tbl))
16950 (if tostring
16951 (if tbl (mapconcat 'identity tbl "\n") nil)
16952 (goto-char ins)
16953 (insert-before-markers
16954 "Clock summary at ["
16955 (substring
16956 (format-time-string (cdr org-time-stamp-formats))
16957 1 -1)
16958 "]."
16959 (if block
16960 (format " Considered range is /%s/." block)
16961 "")
16962 "\n\n"
16963 (if (eq scope 'agenda) "|File" "")
16964 "|L|Headline|Time|\n")
16965 (setq total-time (or total-time org-clock-file-total-minutes)
16966 h (/ total-time 60)
16967 m (- total-time (* 60 h)))
16968 (insert-before-markers
16969 "|-\n|"
16970 (if (eq scope 'agenda) "|" "")
16971 "|"
16972 "*Total time*| "
16973 (format "*%d:%02d*" h m)
16974 "|\n|-\n")
16975 (setq tbl (delq nil tbl))
16976 (if (and (stringp (car tbl)) (> (length (car tbl)) 1)
16977 (equal (substring (car tbl) 0 2) "|-"))
16978 (pop tbl))
16979 (insert-before-markers (mapconcat
16980 'identity (delq nil tbl)
16981 (if (eq scope 'agenda) "\n|-\n" "\n")))
16982 (backward-delete-char 1)
16983 (goto-char ipos)
16984 (skip-chars-forward "^|")
16985 (org-table-align)))))
16986
16987(defun org-clocktable-add-file (file table)
16988 (if table
16989 (let ((lines (org-split-string table "\n"))
16990 (ff (file-name-nondirectory file)))
16991 (mapconcat 'identity
16992 (mapcar (lambda (x)
16993 (if (string-match org-table-dataline-regexp x)
16994 (concat "|" ff x)
16995 x))
16996 lines)
16997 "\n"))))
16549 16998
16550;; FIXME: I don't think anybody uses this, ask David 16999;; FIXME: I don't think anybody uses this, ask David
16551(defun org-collect-clock-time-entries () 17000(defun org-collect-clock-time-entries ()
@@ -16694,12 +17143,13 @@ The following commands are available:
16694(org-defkey org-agenda-mode-map "x" 'org-agenda-exit) 17143(org-defkey org-agenda-mode-map "x" 'org-agenda-exit)
16695(org-defkey org-agenda-mode-map "\C-x\C-w" 'org-write-agenda) 17144(org-defkey org-agenda-mode-map "\C-x\C-w" 'org-write-agenda)
16696(org-defkey org-agenda-mode-map "s" 'org-save-all-org-buffers) 17145(org-defkey org-agenda-mode-map "s" 'org-save-all-org-buffers)
17146(org-defkey org-agenda-mode-map "\C-x\C-s" 'org-save-all-org-buffers)
16697(org-defkey org-agenda-mode-map "P" 'org-agenda-show-priority) 17147(org-defkey org-agenda-mode-map "P" 'org-agenda-show-priority)
16698(org-defkey org-agenda-mode-map "T" 'org-agenda-show-tags) 17148(org-defkey org-agenda-mode-map "T" 'org-agenda-show-tags)
16699(org-defkey org-agenda-mode-map "n" 'next-line) 17149(org-defkey org-agenda-mode-map "n" 'next-line)
16700(org-defkey org-agenda-mode-map "p" 'previous-line) 17150(org-defkey org-agenda-mode-map "p" 'previous-line)
16701(org-defkey org-agenda-mode-map "\C-n" 'org-agenda-next-date-line) 17151(org-defkey org-agenda-mode-map "\C-c\C-n" 'org-agenda-next-date-line)
16702(org-defkey org-agenda-mode-map "\C-p" 'org-agenda-previous-date-line) 17152(org-defkey org-agenda-mode-map "\C-c\C-p" 'org-agenda-previous-date-line)
16703(org-defkey org-agenda-mode-map "," 'org-agenda-priority) 17153(org-defkey org-agenda-mode-map "," 'org-agenda-priority)
16704(org-defkey org-agenda-mode-map "\C-c," 'org-agenda-priority) 17154(org-defkey org-agenda-mode-map "\C-c," 'org-agenda-priority)
16705(org-defkey org-agenda-mode-map "i" 'org-agenda-diary-entry) 17155(org-defkey org-agenda-mode-map "i" 'org-agenda-diary-entry)
@@ -16712,9 +17162,14 @@ The following commands are available:
16712(org-defkey org-agenda-mode-map "S" 'org-agenda-sunrise-sunset) 17162(org-defkey org-agenda-mode-map "S" 'org-agenda-sunrise-sunset)
16713(org-defkey org-agenda-mode-map "h" 'org-agenda-holidays) 17163(org-defkey org-agenda-mode-map "h" 'org-agenda-holidays)
16714(org-defkey org-agenda-mode-map "H" 'org-agenda-holidays) 17164(org-defkey org-agenda-mode-map "H" 'org-agenda-holidays)
17165(org-defkey org-agenda-mode-map "\C-c\C-x\C-i" 'org-agenda-clock-in)
16715(org-defkey org-agenda-mode-map "I" 'org-agenda-clock-in) 17166(org-defkey org-agenda-mode-map "I" 'org-agenda-clock-in)
17167(org-defkey org-agenda-mode-map "\C-c\C-x\C-o" 'org-agenda-clock-out)
16716(org-defkey org-agenda-mode-map "O" 'org-agenda-clock-out) 17168(org-defkey org-agenda-mode-map "O" 'org-agenda-clock-out)
17169(org-defkey org-agenda-mode-map "\C-c\C-x\C-x" 'org-agenda-clock-cancel)
16717(org-defkey org-agenda-mode-map "X" 'org-agenda-clock-cancel) 17170(org-defkey org-agenda-mode-map "X" 'org-agenda-clock-cancel)
17171(org-defkey org-agenda-mode-map "\C-c\C-x\C-j" 'org-clock-goto)
17172(org-defkey org-agenda-mode-map "J" 'org-clock-goto)
16718(org-defkey org-agenda-mode-map "+" 'org-agenda-priority-up) 17173(org-defkey org-agenda-mode-map "+" 'org-agenda-priority-up)
16719(org-defkey org-agenda-mode-map "-" 'org-agenda-priority-down) 17174(org-defkey org-agenda-mode-map "-" 'org-agenda-priority-down)
16720(org-defkey org-agenda-mode-map [(shift up)] 'org-agenda-priority-up) 17175(org-defkey org-agenda-mode-map [(shift up)] 'org-agenda-priority-up)
@@ -16767,6 +17222,11 @@ The following commands are available:
16767 ["Change Date +1 day" org-agenda-date-later (org-agenda-check-type nil 'agenda 'timeline)] 17222 ["Change Date +1 day" org-agenda-date-later (org-agenda-check-type nil 'agenda 'timeline)]
16768 ["Change Date -1 day" org-agenda-date-earlier (org-agenda-check-type nil 'agenda 'timeline)] 17223 ["Change Date -1 day" org-agenda-date-earlier (org-agenda-check-type nil 'agenda 'timeline)]
16769 ["Change Date to ..." org-agenda-date-prompt (org-agenda-check-type nil 'agenda 'timeline)]) 17224 ["Change Date to ..." org-agenda-date-prompt (org-agenda-check-type nil 'agenda 'timeline)])
17225 ("Clock"
17226 ["Clock in" org-agenda-clock-in t]
17227 ["Clock out" org-agenda-clock-out t]
17228 ["Clock cancel" org-agenda-clock-cancel t]
17229 ["Goto running clock" org-clock-goto t])
16770 ("Priority" 17230 ("Priority"
16771 ["Set Priority" org-agenda-priority t] 17231 ["Set Priority" org-agenda-priority t]
16772 ["Increase Priority" org-agenda-priority-up t] 17232 ["Increase Priority" org-agenda-priority-up t]
@@ -16901,7 +17361,7 @@ that have been changed along."
16901 "Dispatch agenda commands to collect entries to the agenda buffer. 17361 "Dispatch agenda commands to collect entries to the agenda buffer.
16902Prompts for a character to select a command. Any prefix arg will be passed 17362Prompts for a character to select a command. Any prefix arg will be passed
16903on to the selected command. The default selections are: 17363on to the selected command. The default selections are:
16904g 17364
16905a Call `org-agenda-list' to display the agenda for current day or week. 17365a Call `org-agenda-list' to display the agenda for current day or week.
16906t Call `org-todo-list' to display the global todo list. 17366t Call `org-todo-list' to display the global todo list.
16907T Call `org-todo-list' to display the global todo list, select only 17367T Call `org-todo-list' to display the global todo list, select only
@@ -17188,7 +17648,8 @@ agenda-day The day in the agenda where this is listed"
17188 (princ "\n")))))) 17648 (princ "\n"))))))
17189 17649
17190(defun org-fix-agenda-info (props) 17650(defun org-fix-agenda-info (props)
17191 "FIXME" 17651 "Make sure all properties on an agenda item have a canonical form,
17652so the the export commands caneasily use it."
17192 (let (tmp re) 17653 (let (tmp re)
17193 (when (setq tmp (plist-get props 'tags)) 17654 (when (setq tmp (plist-get props 'tags))
17194 (setq props (plist-put props 'tags (mapconcat 'identity tmp ":")))) 17655 (setq props (plist-put props 'tags (mapconcat 'identity tmp ":"))))
@@ -17479,7 +17940,7 @@ Optional argument FILE means, use this file instead of the current."
17479 (progn 17940 (progn
17480 (setq buffer-read-only nil) 17941 (setq buffer-read-only nil)
17481 (goto-char (point-max)) 17942 (goto-char (point-max))
17482 (unless (bobp) 17943 (unless (or (bobp) org-agenda-compact-blocks)
17483 (insert "\n" (make-string (window-width) ?=) "\n")) 17944 (insert "\n" (make-string (window-width) ?=) "\n"))
17484 (narrow-to-region (point) (point-max))) 17945 (narrow-to-region (point) (point-max)))
17485 (org-agenda-maybe-reset-markers 'force) 17946 (org-agenda-maybe-reset-markers 'force)
@@ -17547,6 +18008,7 @@ Optional argument FILE means, use this file instead of the current."
17547 (set-buffer (org-get-agenda-file-buffer file)) 18008 (set-buffer (org-get-agenda-file-buffer file))
17548 (widen) 18009 (widen)
17549 (setq bmp (buffer-modified-p)) 18010 (setq bmp (buffer-modified-p))
18011 (org-refresh-category-properties)
17550 (setq org-todo-keywords-for-agenda 18012 (setq org-todo-keywords-for-agenda
17551 (append org-todo-keywords-for-agenda org-todo-keywords-1)) 18013 (append org-todo-keywords-for-agenda org-todo-keywords-1))
17552 (setq org-done-keywords-for-agenda 18014 (setq org-done-keywords-for-agenda
@@ -17649,38 +18111,10 @@ When a buffer is unmodified, it is just killed. When modified, it is saved
17649 (with-current-buffer buf (save-buffer))) 18111 (with-current-buffer buf (save-buffer)))
17650 (kill-buffer buf)))) 18112 (kill-buffer buf))))
17651 18113
17652(defvar org-category-table nil)
17653(defun org-get-category-table ()
17654 "Get the table of categories and positions in current buffer."
17655 (let (tbl)
17656 (save-excursion
17657 (save-restriction
17658 (widen)
17659 (goto-char (point-min))
17660 (while (re-search-forward "^#\\+CATEGORY:[ \t]*\\(.*\\)"
17661 nil t)
17662 (push (cons (match-beginning 1)
17663 (org-trim (match-string 1))) tbl))))
17664 tbl))
17665
17666(defun org-get-category (&optional pos) 18114(defun org-get-category (&optional pos)
17667 "Get the category applying to position POS." 18115 "Get the category applying to position POS."
17668 (if (not org-category-table) 18116 (get-text-property (or pos (point)) 'org-category))
17669 (cond 18117
17670 ((null org-category)
17671 (setq org-category
17672 (if buffer-file-name
17673 (file-name-sans-extension
17674 (file-name-nondirectory buffer-file-name))
17675 "???")))
17676 ((symbolp org-category) (symbol-name org-category))
17677 (t org-category))
17678 (let ((tbl org-category-table)
17679 (pos (or pos (point))))
17680 (while (and tbl (> (caar tbl) pos))
17681 (pop tbl))
17682 (or (cdar tbl) (cdr (nth (1- (length org-category-table))
17683 org-category-table))))))
17684;;; Agenda timeline 18118;;; Agenda timeline
17685 18119
17686(defun org-timeline (&optional include-all) 18120(defun org-timeline (&optional include-all)
@@ -17739,8 +18173,8 @@ dates."
17739 (setq date (calendar-gregorian-from-absolute d)) 18173 (setq date (calendar-gregorian-from-absolute d))
17740 (setq s (point)) 18174 (setq s (point))
17741 (setq rtn (and (not emptyp) 18175 (setq rtn (and (not emptyp)
17742 (apply 'org-agenda-get-day-entries 18176 (apply 'org-agenda-get-day-entries entry
17743 entry date args))) 18177 date args)))
17744 (if (or rtn (equal d today) org-timeline-show-empty-dates) 18178 (if (or rtn (equal d today) org-timeline-show-empty-dates)
17745 (progn 18179 (progn
17746 (insert 18180 (insert
@@ -17888,11 +18322,12 @@ NDAYS defaults to `org-agenda-ndays'."
17888 (add-text-properties (point-min) (1- (point)) 18322 (add-text-properties (point-min) (1- (point))
17889 (list 'face 'org-agenda-structure)) 18323 (list 'face 'org-agenda-structure))
17890 (insert (org-finalize-agenda-entries rtnall) "\n"))) 18324 (insert (org-finalize-agenda-entries rtnall) "\n")))
17891 (setq s (point)) 18325 (unless org-agenda-compact-blocks
17892 (insert (capitalize (symbol-name (org-agenda-ndays-to-span nd))) 18326 (setq s (point))
17893 "-agenda:\n") 18327 (insert (capitalize (symbol-name (org-agenda-ndays-to-span nd)))
17894 (add-text-properties s (1- (point)) (list 'face 'org-agenda-structure 18328 "-agenda:\n")
17895 'org-date-line t)) 18329 (add-text-properties s (1- (point)) (list 'face 'org-agenda-structure
18330 'org-date-line t)))
17896 (while (setq d (pop day-numbers)) 18331 (while (setq d (pop day-numbers))
17897 (setq date (calendar-gregorian-from-absolute d) 18332 (setq date (calendar-gregorian-from-absolute d)
17898 s (point)) 18333 s (point))
@@ -18061,7 +18496,6 @@ The prefix arg TODO-ONLY limits the search to TODO entries."
18061 (with-current-buffer buffer 18496 (with-current-buffer buffer
18062 (unless (org-mode-p) 18497 (unless (org-mode-p)
18063 (error "Agenda file %s is not in `org-mode'" file)) 18498 (error "Agenda file %s is not in `org-mode'" file))
18064 (setq org-category-table (org-get-category-table))
18065 (save-excursion 18499 (save-excursion
18066 (save-restriction 18500 (save-restriction
18067 (if org-agenda-restrict 18501 (if org-agenda-restrict
@@ -18113,11 +18547,11 @@ to skip this subtree. This is a function that can be put into
18113 (and skip end))) 18547 (and skip end)))
18114 18548
18115(defun org-agenda-skip-entry-if (&rest conditions) 18549(defun org-agenda-skip-entry-if (&rest conditions)
18116 "Skip entry is any of CONDITIONS is true. 18550 "Skip entry if any of CONDITIONS is true.
18117See `org-agenda-skip-if for details." 18551See `org-agenda-skip-if for details."
18118 (org-agenda-skip-if nil conditions)) 18552 (org-agenda-skip-if nil conditions))
18119(defun org-agenda-skip-subtree-if (&rest conditions) 18553(defun org-agenda-skip-subtree-if (&rest conditions)
18120 "Skip entry is any of CONDITIONS is true. 18554 "Skip entry if any of CONDITIONS is true.
18121See `org-agenda-skip-if for details." 18555See `org-agenda-skip-if for details."
18122 (org-agenda-skip-if t conditions)) 18556 (org-agenda-skip-if t conditions))
18123 18557
@@ -18230,7 +18664,9 @@ MATCH is being ignored."
18230 (org-disable-agenda-to-diary t)) 18664 (org-disable-agenda-to-diary t))
18231 (save-excursion 18665 (save-excursion
18232 (save-window-excursion 18666 (save-window-excursion
18233 (list-diary-entries date 1))) ;; Keep this name for now, compatibility 18667 (funcall (if (fboundp 'diary-list-entries)
18668 'diary-list-entries 'list-diary-entries)
18669 date 1)))
18234 (if (not (get-buffer fancy-diary-buffer)) 18670 (if (not (get-buffer fancy-diary-buffer))
18235 (setq entries nil) 18671 (setq entries nil)
18236 (with-current-buffer fancy-diary-buffer 18672 (with-current-buffer fancy-diary-buffer
@@ -18325,7 +18761,7 @@ items should be listed. The following arguments are allowed:
18325 date range matching the selected date. Deadlines will 18761 date range matching the selected date. Deadlines will
18326 also be listed, on the expiration day. 18762 also be listed, on the expiration day.
18327 18763
18328 :sexp FIXME 18764 :sexp List entries resulting from diary-like sexps.
18329 18765
18330 :deadline List any deadlines past due, or due within 18766 :deadline List any deadlines past due, or due within
18331 `org-deadline-warning-days'. The listing occurs only 18767 `org-deadline-warning-days'. The listing occurs only
@@ -18398,7 +18834,6 @@ the documentation of `org-diary'."
18398 (with-current-buffer buffer 18834 (with-current-buffer buffer
18399 (unless (org-mode-p) 18835 (unless (org-mode-p)
18400 (error "Agenda file %s is not in `org-mode'" file)) 18836 (error "Agenda file %s is not in `org-mode'" file))
18401 (setq org-category-table (org-get-category-table))
18402 (let ((case-fold-search nil)) 18837 (let ((case-fold-search nil))
18403 (save-excursion 18838 (save-excursion
18404 (save-restriction 18839 (save-restriction
@@ -18432,7 +18867,7 @@ the documentation of `org-diary'."
18432 (setq results (append results rtn)))))))) 18867 (setq results (append results rtn))))))))
18433 results)))) 18868 results))))
18434 18869
18435;; FIXME: this works only if the cursor is not at the 18870;; FIXME: this works only if the cursor is *not* at the
18436;; beginning of the entry 18871;; beginning of the entry
18437(defun org-entry-is-done-p () 18872(defun org-entry-is-done-p ()
18438 "Is the current entry marked DONE?" 18873 "Is the current entry marked DONE?"
@@ -18832,7 +19267,7 @@ FRACTION is what fraction of the head-warning time has passed."
18832 'org-hd-marker (org-agenda-new-marker pos1) 19267 'org-hd-marker (org-agenda-new-marker pos1)
18833 'type (if pastschedp "past-scheduled" "scheduled") 19268 'type (if pastschedp "past-scheduled" "scheduled")
18834 'date (if pastschedp d2 date) 19269 'date (if pastschedp d2 date)
18835 'priority (+ (- 5 diff) (org-get-priority txt)) 19270 'priority (+ 94 (- 5 diff) (org-get-priority txt))
18836 'org-category category) 19271 'org-category category)
18837 (push txt ee)))))) 19272 (push txt ee))))))
18838 (nreverse ee))) 19273 (nreverse ee)))
@@ -18904,6 +19339,18 @@ groups carry important information:
189041 the first time, range or not 193391 the first time, range or not
189058 the second time, if it is a range.") 193408 the second time, if it is a range.")
18906 19341
19342(defconst org-plain-time-extension-regexp
19343 (concat
19344 "\\(\\<[012]?[0-9]"
19345 "\\(\\(:\\([0-5][0-9]\\([AaPp][Mm]\\)?\\)\\)\\|\\([AaPp][Mm]\\)\\)\\>\\)"
19346 "\\+\\([0-9]+\\)\\(:\\([0-5][0-9]\\)\\)?")
19347 "Regular expression to match a time range like 13:30+2:10 = 13:30-15:40.
19348Examples: 11:45 or 8am-13:15 or 2:45-2:45pm. After a match, the following
19349groups carry important information:
193500 the full match
193517 hours of duration
193529 minutes of duration")
19353
18907(defconst org-stamp-time-of-day-regexp 19354(defconst org-stamp-time-of-day-regexp
18908 (concat 19355 (concat
18909 "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +\\sw+ +\\)" 19356 "<\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\} +\\sw+ +\\)"
@@ -19396,7 +19843,7 @@ so that the date SD will be in that range."
19396 sd)))) 19843 sd))))
19397 (cons sd nd))) 19844 (cons sd nd)))
19398 19845
19399;; FIXME: this no longer works if user make date format that starts with a blank 19846;; FIXME: does not work if user makes date format that starts with a blank
19400(defun org-agenda-next-date-line (&optional arg) 19847(defun org-agenda-next-date-line (&optional arg)
19401 "Jump to the next line indicating a date in agenda buffer." 19848 "Jump to the next line indicating a date in agenda buffer."
19402 (interactive "p") 19849 (interactive "p")
@@ -19434,7 +19881,6 @@ so that the date SD will be in that range."
19434(defun org-highlight-until-next-command (beg end &optional buffer) 19881(defun org-highlight-until-next-command (beg end &optional buffer)
19435 (org-highlight beg end buffer) 19882 (org-highlight beg end buffer)
19436 (add-hook 'pre-command-hook 'org-unhighlight-once)) 19883 (add-hook 'pre-command-hook 'org-unhighlight-once))
19437
19438(defun org-unhighlight-once () 19884(defun org-unhighlight-once ()
19439 (remove-hook 'pre-command-hook 'org-unhighlight-once) 19885 (remove-hook 'pre-command-hook 'org-unhighlight-once)
19440 (org-unhighlight)) 19886 (org-unhighlight))
@@ -19784,20 +20230,25 @@ the new TODO state."
19784 (beginning-of-line 0))) 20230 (beginning-of-line 0)))
19785 (org-finalize-agenda))) 20231 (org-finalize-agenda)))
19786 20232
19787;; FIXME: allow negative value for org-agenda-align-tags-to-column
19788;; See the code in set-tags for the way to do this.
19789(defun org-agenda-align-tags (&optional line) 20233(defun org-agenda-align-tags (&optional line)
19790 "Align all tags in agenda items to `org-agenda-align-tags-to-column'." 20234 "Align all tags in agenda items to `org-agenda-tags-column'."
19791 (let ((inhibit-read-only t)) 20235 (let ((inhibit-read-only t) l c)
19792 (save-excursion 20236 (save-excursion
19793 (goto-char (if line (point-at-bol) (point-min))) 20237 (goto-char (if line (point-at-bol) (point-min)))
19794 (while (re-search-forward (org-re "\\([ \t]+\\):[[:alnum:]_@:]+:[ \t]*$") 20238 (while (re-search-forward (org-re "\\([ \t]+\\)\\(:[[:alnum:]_@:]+:\\)[ \t]*$")
19795 (if line (point-at-eol) nil) t) 20239 (if line (point-at-eol) nil) t)
20240 (add-text-properties
20241 (match-beginning 2) (match-end 2)
20242 (list 'face (list 'org-tag (get-text-property
20243 (match-beginning 2) 'face))))
20244 (setq l (- (match-end 2) (match-beginning 2))
20245 c (if (< org-agenda-tags-column 0)
20246 (- (abs org-agenda-tags-column) l)
20247 org-agenda-tags-column))
19796 (delete-region (match-beginning 1) (match-end 1)) 20248 (delete-region (match-beginning 1) (match-end 1))
19797 (goto-char (match-beginning 1)) 20249 (goto-char (match-beginning 1))
19798 (insert (org-add-props 20250 (insert (org-add-props
19799 (make-string (max 1 (- org-agenda-align-tags-to-column 20251 (make-string (max 1 (- c (current-column))) ?\ )
19800 (current-column))) ?\ )
19801 (text-properties-at (point)))))))) 20252 (text-properties-at (point))))))))
19802 20253
19803(defun org-agenda-priority-up () 20254(defun org-agenda-priority-up ()
@@ -19941,11 +20392,11 @@ the tags of the current headline come last."
19941 (interactive "p") 20392 (interactive "p")
19942 (org-agenda-date-later (- arg) what)) 20393 (org-agenda-date-later (- arg) what))
19943 20394
19944(defun org-agenda-show-new-time (marker stamp) 20395(defun org-agenda-show-new-time (marker stamp &optional prefix)
19945 "Show new date stamp via text properties." 20396 "Show new date stamp via text properties."
19946 ;; We use text properties to make this undoable 20397 ;; We use text properties to make this undoable
19947 (let ((inhibit-read-only t)) 20398 (let ((inhibit-read-only t))
19948 (setq stamp (concat " => " stamp)) 20399 (setq stamp (concat " " prefix " => " stamp))
19949 (save-excursion 20400 (save-excursion
19950 (goto-char (point-max)) 20401 (goto-char (point-max))
19951 (while (not (bobp)) 20402 (while (not (bobp))
@@ -20001,8 +20452,9 @@ be used to request time specification in the time stamp."
20001 (with-current-buffer buffer 20452 (with-current-buffer buffer
20002 (widen) 20453 (widen)
20003 (goto-char pos) 20454 (goto-char pos)
20004 (setq ts (org-schedule)) 20455 (setq ts (org-schedule arg)))
20005 (message "Item scheduled for %s" ts))))) 20456 (org-agenda-show-new-time marker ts "S"))
20457 (message "Item scheduled for %s" ts)))
20006 20458
20007(defun org-agenda-deadline (arg) 20459(defun org-agenda-deadline (arg)
20008 "Schedule the item at point." 20460 "Schedule the item at point."
@@ -20019,8 +20471,9 @@ be used to request time specification in the time stamp."
20019 (with-current-buffer buffer 20471 (with-current-buffer buffer
20020 (widen) 20472 (widen)
20021 (goto-char pos) 20473 (goto-char pos)
20022 (setq ts (org-deadline)) 20474 (setq ts (org-deadline arg)))
20023 (message "Deadline for this item set to %s" ts))))) 20475 (org-agenda-show-new-time marker ts "S"))
20476 (message "Deadline for this item set to %s" ts)))
20024 20477
20025(defun org-get-heading (&optional no-tags) 20478(defun org-get-heading (&optional no-tags)
20026 "Return the heading of the current entry, without the stars." 20479 "Return the heading of the current entry, without the stars."
@@ -20542,6 +20995,7 @@ The images can be removed again with \\[org-ctrl-c-ctrl-c]."
20542 (:agenda-style . org-agenda-export-html-style) ;; FIXME: Does this work???? 20995 (:agenda-style . org-agenda-export-html-style) ;; FIXME: Does this work????
20543 (:convert-org-links . org-export-html-link-org-files-as-html) 20996 (:convert-org-links . org-export-html-link-org-files-as-html)
20544 (:inline-images . org-export-html-inline-images) 20997 (:inline-images . org-export-html-inline-images)
20998 (:html-extension . org-export-html-extension)
20545 (:expand-quoted-html . org-export-html-expand) 20999 (:expand-quoted-html . org-export-html-expand)
20546 (:timestamp . org-export-html-with-timestamp) 21000 (:timestamp . org-export-html-with-timestamp)
20547 (:publishing-directory . org-export-publishing-directory) 21001 (:publishing-directory . org-export-publishing-directory)
@@ -21373,7 +21827,7 @@ underlined headlines. The default is 3."
21373 :archived-trees 21827 :archived-trees
21374 (plist-get opt-plist :archived-trees) 21828 (plist-get opt-plist :archived-trees)
21375 :add-text (plist-get opt-plist :text)) 21829 :add-text (plist-get opt-plist :text))
21376 "[\r\n]")) ;; FIXME: why \r here???/ 21830 "\n"))
21377 thetoc have-headings first-heading-pos 21831 thetoc have-headings first-heading-pos
21378 table-open table-buffer) 21832 table-open table-buffer)
21379 21833
@@ -21395,10 +21849,10 @@ underlined headlines. The default is 3."
21395 (fundamental-mode) 21849 (fundamental-mode)
21396 ;; create local variables for all options, to make sure all called 21850 ;; create local variables for all options, to make sure all called
21397 ;; functions get the correct information 21851 ;; functions get the correct information
21398 (mapcar (lambda (x) 21852 (mapc (lambda (x)
21399 (set (make-local-variable (cdr x)) 21853 (set (make-local-variable (cdr x))
21400 (plist-get opt-plist (car x)))) 21854 (plist-get opt-plist (car x))))
21401 org-export-plist-vars) 21855 org-export-plist-vars)
21402 (org-set-local 'org-odd-levels-only odd) 21856 (org-set-local 'org-odd-levels-only odd)
21403 (setq umax (if arg (prefix-numeric-value arg) 21857 (setq umax (if arg (prefix-numeric-value arg)
21404 org-export-headline-levels)) 21858 org-export-headline-levels))
@@ -21430,49 +21884,49 @@ underlined headlines. The default is 3."
21430 (progn 21884 (progn
21431 (push (concat (nth 3 lang-words) "\n") thetoc) 21885 (push (concat (nth 3 lang-words) "\n") thetoc)
21432 (push (concat (make-string (length (nth 3 lang-words)) ?=) "\n") thetoc) 21886 (push (concat (make-string (length (nth 3 lang-words)) ?=) "\n") thetoc)
21433 (mapcar '(lambda (line) 21887 (mapc '(lambda (line)
21434 (if (string-match org-todo-line-regexp 21888 (if (string-match org-todo-line-regexp
21435 line) 21889 line)
21436 ;; This is a headline 21890 ;; This is a headline
21437 (progn 21891 (progn
21438 (setq have-headings t) 21892 (setq have-headings t)
21439 (setq level (- (match-end 1) (match-beginning 1)) 21893 (setq level (- (match-end 1) (match-beginning 1))
21440 level (org-tr-level level) 21894 level (org-tr-level level)
21441 txt (match-string 3 line) 21895 txt (match-string 3 line)
21442 todo 21896 todo
21443 (or (and org-export-mark-todo-in-toc 21897 (or (and org-export-mark-todo-in-toc
21444 (match-beginning 2) 21898 (match-beginning 2)
21445 (not (member (match-string 2 line) 21899 (not (member (match-string 2 line)
21446 org-done-keywords))) 21900 org-done-keywords)))
21447 ; TODO, not DONE 21901 ; TODO, not DONE
21448 (and org-export-mark-todo-in-toc 21902 (and org-export-mark-todo-in-toc
21449 (= level umax-toc) 21903 (= level umax-toc)
21450 (org-search-todo-below 21904 (org-search-todo-below
21451 line lines level)))) 21905 line lines level))))
21452 (setq txt (org-html-expand-for-ascii txt)) 21906 (setq txt (org-html-expand-for-ascii txt))
21453 21907
21454 (if (and (memq org-export-with-tags '(not-in-toc nil)) 21908 (if (and (memq org-export-with-tags '(not-in-toc nil))
21455 (string-match 21909 (string-match
21456 (org-re "[ \t]+:[[:alnum:]_@:]+:[ \t]*$") 21910 (org-re "[ \t]+:[[:alnum:]_@:]+:[ \t]*$")
21457 txt)) 21911 txt))
21458 (setq txt (replace-match "" t t txt))) 21912 (setq txt (replace-match "" t t txt)))
21459 (if (string-match quote-re0 txt) 21913 (if (string-match quote-re0 txt)
21460 (setq txt (replace-match "" t t txt))) 21914 (setq txt (replace-match "" t t txt)))
21461 21915
21462 (if org-export-with-section-numbers 21916 (if org-export-with-section-numbers
21463 (setq txt (concat (org-section-number level) 21917 (setq txt (concat (org-section-number level)
21464 " " txt))) 21918 " " txt)))
21465 (if (<= level umax-toc) 21919 (if (<= level umax-toc)
21466 (progn 21920 (progn
21467 (push 21921 (push
21468 (concat 21922 (concat
21469 (make-string 21923 (make-string
21470 (* (max 0 (- level org-min-level)) 4) ?\ ) 21924 (* (max 0 (- level org-min-level)) 4) ?\ )
21471 (format (if todo "%s (*)\n" "%s\n") txt)) 21925 (format (if todo "%s (*)\n" "%s\n") txt))
21472 thetoc) 21926 thetoc)
21473 (setq org-last-level level)) 21927 (setq org-last-level level))
21474 )))) 21928 ))))
21475 lines) 21929 lines)
21476 (setq thetoc (if have-headings (nreverse thetoc) nil)))) 21930 (setq thetoc (if have-headings (nreverse thetoc) nil))))
21477 21931
21478 (org-init-section-numbers) 21932 (org-init-section-numbers)
@@ -21941,7 +22395,7 @@ the body tags themselves."
21941 (org-entry-get (region-beginning) 22395 (org-entry-get (region-beginning)
21942 "EXPORT_FILE_NAME" t)) 22396 "EXPORT_FILE_NAME" t))
21943 (file-name-nondirectory buffer-file-name))) 22397 (file-name-nondirectory buffer-file-name)))
21944 ".html"))) 22398 "." org-export-html-extension)))
21945 (current-dir (if buffer-file-name 22399 (current-dir (if buffer-file-name
21946 (file-name-directory buffer-file-name) 22400 (file-name-directory buffer-file-name)
21947 default-directory)) 22401 default-directory))
@@ -22044,10 +22498,10 @@ the body tags themselves."
22044 (org-odd-levels-only odd)) 22498 (org-odd-levels-only odd))
22045 ;; create local variables for all options, to make sure all called 22499 ;; create local variables for all options, to make sure all called
22046 ;; functions get the correct information 22500 ;; functions get the correct information
22047 (mapcar (lambda (x) 22501 (mapc (lambda (x)
22048 (set (make-local-variable (cdr x)) 22502 (set (make-local-variable (cdr x))
22049 (plist-get opt-plist (car x)))) 22503 (plist-get opt-plist (car x))))
22050 org-export-plist-vars) 22504 org-export-plist-vars)
22051 (setq umax (if arg (prefix-numeric-value arg) 22505 (setq umax (if arg (prefix-numeric-value arg)
22052 org-export-headline-levels)) 22506 org-export-headline-levels))
22053 (setq umax-toc (if (integerp org-export-with-toc) 22507 (setq umax-toc (if (integerp org-export-with-toc)
@@ -22262,7 +22716,7 @@ lang=\"%s\" xml:lang=\"%s\">
22262 (org-solidify-link-text 22716 (org-solidify-link-text
22263 (save-match-data (org-link-unescape path)) target-alist) 22717 (save-match-data (org-link-unescape path)) target-alist)
22264 "\">" desc "</a>"))) 22718 "\">" desc "</a>")))
22265 ((member type '("http" "https")) ; FIXME: need to test this. 22719 ((member type '("http" "https"))
22266 ;; standard URL, just check if we need to inline an image 22720 ;; standard URL, just check if we need to inline an image
22267 (if (and (or (eq t org-export-html-inline-images) 22721 (if (and (or (eq t org-export-html-inline-images)
22268 (and org-export-html-inline-images (not descp))) 22722 (and org-export-html-inline-images (not descp)))
@@ -22293,7 +22747,7 @@ lang=\"%s\" xml:lang=\"%s\">
22293 (string-match "\\.org$" thefile)) 22747 (string-match "\\.org$" thefile))
22294 (setq thefile (concat (substring thefile 0 22748 (setq thefile (concat (substring thefile 0
22295 (match-beginning 0)) 22749 (match-beginning 0))
22296 ".html")) 22750 "." org-export-html-extension))
22297 (if (and search 22751 (if (and search
22298 ;; make sure this is can be used as target search 22752 ;; make sure this is can be used as target search
22299 (not (string-match "^[0-9]*$" search)) 22753 (not (string-match "^[0-9]*$" search))
@@ -22528,7 +22982,7 @@ lang=\"%s\" xml:lang=\"%s\">
22528 (kill-buffer (current-buffer))) 22982 (kill-buffer (current-buffer)))
22529 (current-buffer))))) 22983 (current-buffer)))))
22530 22984
22531(defvar org-table-colgroup-info nil) ;; FIXME: mode to a better place 22985(defvar org-table-colgroup-info nil)
22532(defun org-format-table-ascii (lines) 22986(defun org-format-table-ascii (lines)
22533 "Format a table for ascii export." 22987 "Format a table for ascii export."
22534 (if (stringp lines) 22988 (if (stringp lines)
@@ -22569,8 +23023,9 @@ lang=\"%s\" xml:lang=\"%s\">
22569 (memq new '(:start :startend))) 23023 (memq new '(:start :startend)))
22570 (push t vl) 23024 (push t vl)
22571 (push nil vl))) 23025 (push nil vl)))
22572 (setq vl (cons nil (nreverse vl))))) 23026 (setq vl (nreverse vl))
22573 23027 (and vl (setcar vl nil))
23028 vl))
22574 23029
22575(defun org-format-table-html (lines olines) 23030(defun org-format-table-html (lines olines)
22576 "Find out which HTML converter to use and return the HTML code." 23031 "Find out which HTML converter to use and return the HTML code."
@@ -23086,13 +23541,13 @@ the iCalendar file.")
23086When COMBINE is non nil, add the category to each line." 23541When COMBINE is non nil, add the category to each line."
23087 (let ((re1 (concat org-ts-regexp "\\|<%%([^>\n]+>")) 23542 (let ((re1 (concat org-ts-regexp "\\|<%%([^>\n]+>"))
23088 (re2 (concat "--?-?\\(" org-ts-regexp "\\)")) 23543 (re2 (concat "--?-?\\(" org-ts-regexp "\\)"))
23089 (org-category-table (org-get-category-table))
23090 (dts (org-ical-ts-to-string 23544 (dts (org-ical-ts-to-string
23091 (format-time-string (cdr org-time-stamp-formats) (current-time)) 23545 (format-time-string (cdr org-time-stamp-formats) (current-time))
23092 "DTSTART")) 23546 "DTSTART"))
23093 hd ts ts2 state status (inc t) pos b sexp rrule 23547 hd ts ts2 state status (inc t) pos b sexp rrule
23094 scheduledp deadlinep tmp pri category 23548 scheduledp deadlinep tmp pri category entry location summary desc
23095 (sexp-buffer (get-buffer-create "*ical-tmp*"))) 23549 (sexp-buffer (get-buffer-create "*ical-tmp*")))
23550 (org-refresh-category-properties)
23096 (save-excursion 23551 (save-excursion
23097 (goto-char (point-min)) 23552 (goto-char (point-min))
23098 (while (re-search-forward re1 nil t) 23553 (while (re-search-forward re1 nil t)
@@ -23102,6 +23557,10 @@ When COMBINE is non nil, add the category to each line."
23102 ts (match-string 0) 23557 ts (match-string 0)
23103 inc t 23558 inc t
23104 hd (org-get-heading) 23559 hd (org-get-heading)
23560 summary (org-entry-get nil "SUMMARY")
23561 desc (or (org-entry-get nil "DESCRIPTION")
23562 (org-get-cleaned-entry org-icalendar-include-body))
23563 location (org-entry-get nil "LOCATION")
23105 category (org-get-category)) 23564 category (org-get-category))
23106 (if (looking-at re2) 23565 (if (looking-at re2)
23107 (progn 23566 (progn
@@ -23131,24 +23590,32 @@ When COMBINE is non nil, add the category to each line."
23131 ("m" . "MONTHLY")("y" . "YEARLY")))) 23590 ("m" . "MONTHLY")("y" . "YEARLY"))))
23132 ";INTERVAL=" (match-string 1 ts))) 23591 ";INTERVAL=" (match-string 1 ts)))
23133 (setq rrule "")) 23592 (setq rrule ""))
23134 (if (string-match org-bracket-link-regexp hd) 23593 (setq summary (or summary hd))
23135 (setq hd (replace-match (if (match-end 3) (match-string 3 hd) 23594 (if (string-match org-bracket-link-regexp summary)
23136 (match-string 1 hd)) 23595 (setq summary
23137 t t hd))) 23596 (replace-match (if (match-end 3)
23138 (if deadlinep (setq hd (concat "DL: " hd))) 23597 (match-string 3 summary)
23139 (if scheduledp (setq hd (concat "S: " hd))) 23598 (match-string 1 summary))
23599 t t summary)))
23600 (if deadlinep (setq summary (concat "DL: " summary)))
23601 (if scheduledp (setq summary (concat "S: " summary)))
23140 (if (string-match "\\`<%%" ts) 23602 (if (string-match "\\`<%%" ts)
23141 (with-current-buffer sexp-buffer 23603 (with-current-buffer sexp-buffer
23142 (insert (substring ts 1 -1) " " hd "\n")) 23604 (insert (substring ts 1 -1) " " summary "\n"))
23143 (princ (format "BEGIN:VEVENT 23605 (princ (format "BEGIN:VEVENT
23144%s 23606%s
23145%s%s 23607%s%s
23146SUMMARY:%s 23608SUMMARY:%s%s%s
23147CATEGORIES:%s 23609CATEGORIES:%s
23148END:VEVENT\n" 23610END:VEVENT\n"
23149 (org-ical-ts-to-string ts "DTSTART") 23611 (org-ical-ts-to-string ts "DTSTART")
23150 (org-ical-ts-to-string ts2 "DTEND" inc) 23612 (org-ical-ts-to-string ts2 "DTEND" inc)
23151 rrule hd category))))) 23613 rrule summary
23614 (if (and desc (string-match "\\S-" desc))
23615 (concat "\nDESCRIPTION: " desc) "")
23616 (if (and location (string-match "\\S-" location))
23617 (concat "\nLOCATION: " location) "")
23618 category)))))
23152 23619
23153 (when (and org-icalendar-include-sexps 23620 (when (and org-icalendar-include-sexps
23154 (condition-case nil (require 'icalendar) (error nil)) 23621 (condition-case nil (require 'icalendar) (error nil))
@@ -23180,7 +23647,11 @@ END:VEVENT\n"
23180 (eq org-icalendar-include-todo 'all)) 23647 (eq org-icalendar-include-todo 'all))
23181 (not (member org-archive-tag (org-get-tags-at))) 23648 (not (member org-archive-tag (org-get-tags-at)))
23182 ) 23649 )
23183 (setq hd (match-string 3)) 23650 (setq hd (match-string 3)
23651 summary (org-entry-get nil "SUMMARY")
23652 desc (or (org-entry-get nil "DESCRIPTION")
23653 (org-get-cleaned-entry org-icalendar-include-body))
23654 location (org-entry-get nil "LOCATION"))
23184 (if (string-match org-bracket-link-regexp hd) 23655 (if (string-match org-bracket-link-regexp hd)
23185 (setq hd (replace-match (if (match-end 3) (match-string 3 hd) 23656 (setq hd (replace-match (if (match-end 3) (match-string 3 hd)
23186 (match-string 1 hd)) 23657 (match-string 1 hd))
@@ -23195,13 +23666,38 @@ END:VEVENT\n"
23195 23666
23196 (princ (format "BEGIN:VTODO 23667 (princ (format "BEGIN:VTODO
23197%s 23668%s
23198SUMMARY:%s 23669SUMMARY:%s%s%s
23199CATEGORIES:%s 23670CATEGORIES:%s
23200SEQUENCE:1 23671SEQUENCE:1
23201PRIORITY:%d 23672PRIORITY:%d
23202STATUS:%s 23673STATUS:%s
23203END:VTODO\n" 23674END:VTODO\n"
23204 dts hd category pri status))))))))) 23675 dts
23676 (or summary hd)
23677 (if (and location (string-match "\\S-" location))
23678 (concat "\nLOCATION: " location) "")
23679 (if (and desc (string-match "\\S-" desc))
23680 (concat "\nDESCRIPTION: " desc) "")
23681 category pri status)))))))))
23682
23683(defun org-get-cleaned-entry (what)
23684 "Clean-up description string."
23685 (when what
23686 (save-excursion
23687 (org-back-to-heading t)
23688 (let ((s (buffer-substring (point-at-bol 2) (org-end-of-subtree t)))
23689 (re (concat org-drawer-regexp "[^\000]*?:END:.*\n?"))
23690 (re2 (concat "^[ \t]*" org-keyword-time-regexp ".*\n?")))
23691 (while (string-match re s) (setq s (replace-match "" t t s)))
23692 (while (string-match re2 s) (setq s (replace-match "" t t s)))
23693 (if (string-match "[ \t\r\n]+\\'" s) (setq s (replace-match "" t t s)))
23694 (while (string-match "[ \t]*\n[ \t]*" s)
23695 (setq s (replace-match "\\n" t t s)))
23696 (setq s (org-trim s))
23697 (if (and (numberp what)
23698 (> (length s) what))
23699 (substring s 0 what)
23700 s)))))
23205 23701
23206(defun org-start-icalendar-file (name) 23702(defun org-start-icalendar-file (name)
23207 "Start an iCalendar file by inserting the header." 23703 "Start an iCalendar file by inserting the header."
@@ -23415,9 +23911,11 @@ The XOXO buffer is named *xoxo-<source buffer name>*"
23415(org-defkey org-mode-map "\C-c\C-v" 'org-show-todo-tree) 23911(org-defkey org-mode-map "\C-c\C-v" 'org-show-todo-tree)
23416(org-defkey org-mode-map "\C-c\C-w" 'org-check-deadlines) 23912(org-defkey org-mode-map "\C-c\C-w" 'org-check-deadlines)
23417(org-defkey org-mode-map "\C-c/" 'org-occur) ; Minor-mode reserved 23913(org-defkey org-mode-map "\C-c/" 'org-occur) ; Minor-mode reserved
23914(org-defkey org-mode-map "\C-c\C-x/" 'org-occur-in-agenda-files)
23418(org-defkey org-mode-map "\C-c\\" 'org-tags-sparse-tree) ; Minor-mode res. 23915(org-defkey org-mode-map "\C-c\\" 'org-tags-sparse-tree) ; Minor-mode res.
23419(org-defkey org-mode-map "\C-c\C-m" 'org-ctrl-c-ret) 23916(org-defkey org-mode-map "\C-c\C-m" 'org-ctrl-c-ret)
23420(org-defkey org-mode-map "\M-\C-m" 'org-insert-heading) 23917(org-defkey org-mode-map "\M-\C-m" 'org-insert-heading)
23918(org-defkey org-mode-map [(control return)] 'org-insert-heading-after-current)
23421(org-defkey org-mode-map "\C-c\C-x\C-n" 'org-next-link) 23919(org-defkey org-mode-map "\C-c\C-x\C-n" 'org-next-link)
23422(org-defkey org-mode-map "\C-c\C-x\C-p" 'org-previous-link) 23920(org-defkey org-mode-map "\C-c\C-x\C-p" 'org-previous-link)
23423(org-defkey org-mode-map "\C-c\C-l" 'org-insert-link) 23921(org-defkey org-mode-map "\C-c\C-l" 'org-insert-link)
@@ -23465,6 +23963,7 @@ The XOXO buffer is named *xoxo-<source buffer name>*"
23465(org-defkey org-mode-map "\C-c\C-x\C-t" 'org-toggle-time-stamp-overlays) 23963(org-defkey org-mode-map "\C-c\C-x\C-t" 'org-toggle-time-stamp-overlays)
23466(org-defkey org-mode-map "\C-c\C-x\C-i" 'org-clock-in) 23964(org-defkey org-mode-map "\C-c\C-x\C-i" 'org-clock-in)
23467(org-defkey org-mode-map "\C-c\C-x\C-o" 'org-clock-out) 23965(org-defkey org-mode-map "\C-c\C-x\C-o" 'org-clock-out)
23966(org-defkey org-mode-map "\C-c\C-x\C-j" 'org-clock-goto)
23468(org-defkey org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel) 23967(org-defkey org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel)
23469(org-defkey org-mode-map "\C-c\C-x\C-d" 'org-clock-display) 23968(org-defkey org-mode-map "\C-c\C-x\C-d" 'org-clock-display)
23470(org-defkey org-mode-map "\C-c\C-x\C-r" 'org-clock-report) 23969(org-defkey org-mode-map "\C-c\C-x\C-r" 'org-clock-report)
@@ -23574,6 +24073,13 @@ because, in this case the deletion might narrow the column."
23574(put 'org-delete-char 'flyspell-delayed t) 24073(put 'org-delete-char 'flyspell-delayed t)
23575(put 'org-delete-backward-char 'flyspell-delayed t) 24074(put 'org-delete-backward-char 'flyspell-delayed t)
23576 24075
24076(eval-after-load "pabbrev"
24077 '(progn
24078 (add-to-list 'pabbrev-expand-after-command-list
24079 'orgtbl-self-insert-command t)
24080 (add-to-list 'pabbrev-expand-after-command-list
24081 'org-self-insert-command t)))
24082
23577;; How to do this: Measure non-white length of current string 24083;; How to do this: Measure non-white length of current string
23578;; If equal to column width, we should realign. 24084;; If equal to column width, we should realign.
23579 24085
@@ -23819,6 +24325,8 @@ This command does many different things, depending on context:
23819- If the cursor is on a #+TBLFM line, re-apply the formulas to 24325- If the cursor is on a #+TBLFM line, re-apply the formulas to
23820 the entire table. 24326 the entire table.
23821 24327
24328- If the cursor is a the beginning of a dynamic block, update it.
24329
23822- If the cursor is inside a table created by the table.el package, 24330- If the cursor is inside a table created by the table.el package,
23823 activate that table. 24331 activate that table.
23824 24332
@@ -23863,6 +24371,10 @@ This command does many different things, depending on context:
23863 (call-interactively 'org-toggle-checkbox)) 24371 (call-interactively 'org-toggle-checkbox))
23864 ((org-at-item-p) 24372 ((org-at-item-p)
23865 (call-interactively 'org-maybe-renumber-ordered-list)) 24373 (call-interactively 'org-maybe-renumber-ordered-list))
24374 ((save-excursion (beginning-of-line 1) (looking-at "#\\+BEGIN:"))
24375 ;; Dynamic block
24376 (beginning-of-line 1)
24377 (org-update-dblock))
23866 ((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)")) 24378 ((save-excursion (beginning-of-line 1) (looking-at "#\\+\\([A-Z]+\\)"))
23867 (cond 24379 (cond
23868 ((equal (match-string 1) "TBLFM") 24380 ((equal (match-string 1) "TBLFM")
@@ -24054,7 +24566,7 @@ See the individual commands for more information."
24054 ["Priority Down" org-shiftdown t]) 24566 ["Priority Down" org-shiftdown t])
24055 ("TAGS and Properties" 24567 ("TAGS and Properties"
24056 ["Set Tags" 'org-ctrl-c-ctrl-c (org-at-heading-p)] 24568 ["Set Tags" 'org-ctrl-c-ctrl-c (org-at-heading-p)]
24057 ["Change tag in region" 'org-change-tag-in-region (org-region-active-p)] ;FIXME 24569 ["Change tag in region" 'org-change-tag-in-region (org-region-active-p)]
24058 ["Column view of properties" org-columns t]) 24570 ["Column view of properties" org-columns t])
24059 ("Dates and Scheduling" 24571 ("Dates and Scheduling"
24060 ["Timestamp" org-time-stamp t] 24572 ["Timestamp" org-time-stamp t]
@@ -24077,6 +24589,7 @@ See the individual commands for more information."
24077 ["Clock in" org-clock-in t] 24589 ["Clock in" org-clock-in t]
24078 ["Clock out" org-clock-out t] 24590 ["Clock out" org-clock-out t]
24079 ["Clock cancel" org-clock-cancel t] 24591 ["Clock cancel" org-clock-cancel t]
24592 ["Goto running clock" org-clock-goto t]
24080 ["Display times" org-clock-display t] 24593 ["Display times" org-clock-display t]
24081 ["Create clock table" org-clock-report t] 24594 ["Create clock table" org-clock-report t]
24082 "--" 24595 "--"
@@ -24157,6 +24670,7 @@ With optional NODE, go directly to that node."
24157 ["Add/Move Current File to Front of List" org-agenda-file-to-front t] 24670 ["Add/Move Current File to Front of List" org-agenda-file-to-front t]
24158 ["Remove Current File from List" org-remove-file t] 24671 ["Remove Current File from List" org-remove-file t]
24159 ["Cycle through agenda files" org-cycle-agenda-files t] 24672 ["Cycle through agenda files" org-cycle-agenda-files t]
24673 ["Occur in all agenda files" org-occur-in-agenda-files t]
24160 "--") 24674 "--")
24161 (mapcar 'org-file-menu-entry (org-agenda-files t)))))))) 24675 (mapcar 'org-file-menu-entry (org-agenda-files t))))))))
24162 24676
@@ -24288,7 +24802,7 @@ and :keyword."
24288 (setq clist (nreverse (delq nil clist))) 24802 (setq clist (nreverse (delq nil clist)))
24289 clist)) 24803 clist))
24290 24804
24291;; FIXME Compare with at-regexp-p 24805;; FIXME: Compare with at-regexp-p Do we need both?
24292(defun org-in-regexp (re &optional nlines visually) 24806(defun org-in-regexp (re &optional nlines visually)
24293 "Check if point is inside a match of regexp. 24807 "Check if point is inside a match of regexp.
24294Normally only the current line is checked, but you can include NLINES extra 24808Normally only the current line is checked, but you can include NLINES extra
@@ -24318,6 +24832,15 @@ really on, so that the block visually is on the match."
24318 (throw 'exit t))) 24832 (throw 'exit t)))
24319 nil)))) 24833 nil))))
24320 24834
24835(defun org-occur-in-agenda-files (regexp)
24836 "Call `multi-occur' with buffers for all agenda files."
24837 (interactive "sList all lines matching: ")
24838 (multi-occur
24839 (mapcar
24840 (lambda (x) (or (get-file-buffer x) (find-file-noselect x)))
24841 (org-agenda-files))
24842 regexp))
24843
24321(defun org-uniquify (list) 24844(defun org-uniquify (list)
24322 "Remove duplicate elements from LIST." 24845 "Remove duplicate elements from LIST."
24323 (let (res) 24846 (let (res)
@@ -24391,7 +24914,7 @@ ones and overrule settings in the other lists."
24391 24914
24392(defun org-replace-escapes (string table) 24915(defun org-replace-escapes (string table)
24393 "Replace %-escapes in STRING with values in TABLE. 24916 "Replace %-escapes in STRING with values in TABLE.
24394TABLE is an association list with keys line \"%a\" and string values. 24917TABLE is an association list with keys like \"%a\" and string values.
24395The sequences in STRING may contain normal field width and padding information, 24918The sequences in STRING may contain normal field width and padding information,
24396for example \"%-5s\". Replacements happen in the sequence given by TABLE, 24919for example \"%-5s\". Replacements happen in the sequence given by TABLE,
24397so values can contain further %-escapes if they are define later in TABLE." 24920so values can contain further %-escapes if they are define later in TABLE."
@@ -24420,7 +24943,9 @@ Counting starts at 1."
24420 "Like `find-buffer-visiting' but alway return the base buffer and 24943 "Like `find-buffer-visiting' but alway return the base buffer and
24421not an indirect buffer" 24944not an indirect buffer"
24422 (let ((buf (find-buffer-visiting file))) 24945 (let ((buf (find-buffer-visiting file)))
24423 (or (buffer-base-buffer buf) buf))) 24946 (if buf
24947 (or (buffer-base-buffer buf) buf)
24948 nil)))
24424 24949
24425(defun org-image-file-name-regexp () 24950(defun org-image-file-name-regexp ()
24426 "Return regexp matching the file names of images." 24951 "Return regexp matching the file names of images."
@@ -24501,7 +25026,6 @@ not an indirect buffer"
24501 ;; fill the headline as well. 25026 ;; fill the headline as well.
24502 (org-set-local 'comment-start-skip "^#+[ \t]*") 25027 (org-set-local 'comment-start-skip "^#+[ \t]*")
24503 (org-set-local 'paragraph-separate "\f\\|\\*+ \\|[ ]*$\\|[ \t]*[:|]") 25028 (org-set-local 'paragraph-separate "\f\\|\\*+ \\|[ ]*$\\|[ \t]*[:|]")
24504;; FIXME!!!!!!! (org-set-local 'paragraph-separate "\f\\|[ ]*$")
24505 ;; The paragraph starter includes hand-formatted lists. 25029 ;; The paragraph starter includes hand-formatted lists.
24506 (org-set-local 'paragraph-start 25030 (org-set-local 'paragraph-start
24507 "\f\\|[ ]*$\\|\\*+ \\|\f\\|[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]") 25031 "\f\\|[ ]*$\\|\\*+ \\|\f\\|[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]")
@@ -24750,13 +25274,17 @@ When ENTRY is non-nil, show the entire entry."
24750Show the heading too, if it is currently invisible." 25274Show the heading too, if it is currently invisible."
24751 (interactive) 25275 (interactive)
24752 (save-excursion 25276 (save-excursion
24753 (org-back-to-heading t) 25277 (condition-case nil
24754 (outline-flag-region 25278 (progn
24755 (max (point-min) (1- (point))) 25279 (org-back-to-heading t)
24756 (save-excursion 25280 (outline-flag-region
24757 (re-search-forward (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move) 25281 (max (point-min) (1- (point)))
24758 (or (match-beginning 1) (point-max))) 25282 (save-excursion
24759 nil))) 25283 (re-search-forward
25284 (concat "[\r\n]\\(" outline-regexp "\\)") nil 'move)
25285 (or (match-beginning 1) (point-max)))
25286 nil))
25287 (error nil))))
24760 25288
24761(defun org-make-options-regexp (kwds) 25289(defun org-make-options-regexp (kwds)
24762 "Make a regular expression for keyword lines." 25290 "Make a regular expression for keyword lines."
@@ -24821,28 +25349,6 @@ Show the heading too, if it is currently invisible."
24821 25349
24822;;;; Experimental code 25350;;;; Experimental code
24823 25351
24824;; Make appt aware of appointments from the agenda
24825(defun org-agenda-to-appt ()
24826 "Activate appointments found in `org-agenda-files'."
24827 (interactive)
24828 (require 'org)
24829 (let* ((today (org-date-to-gregorian
24830 (time-to-days (current-time))))
24831 (files org-agenda-files) entries file)
24832 (while (setq file (pop files))
24833 (setq entries (append entries (org-agenda-get-day-entries
24834 file today :timestamp))))
24835 (setq entries (delq nil entries))
24836 (mapc (lambda(x)
24837 (let* ((event (org-trim (get-text-property 1 'txt x)))
24838 (time-of-day (get-text-property 1 'time-of-day x)) tod)
24839 (when time-of-day
24840 (setq tod (number-to-string time-of-day)
24841 tod (when (string-match
24842 "\\([0-9]\\{1,2\\}\\)\\([0-9]\\{2\\}\\)" tod)
24843 (concat (match-string 1 tod) ":"
24844 (match-string 2 tod))))
24845 (if tod (appt-add tod event))))) entries)))
24846 25352
24847(defun org-closed-in-range () 25353(defun org-closed-in-range ()
24848 "Sparse tree of items closed in a certain time range. 25354 "Sparse tree of items closed in a certain time range.
@@ -24908,6 +25414,27 @@ Respect keys that are already there."
24908 (push (cons k c) new)))) 25414 (push (cons k c) new))))
24909 (nreverse new))) 25415 (nreverse new)))
24910 25416
25417(defun org-parse-local-options (string var)
25418 "Parse STRING for startup setting relevant for variable VAR."
25419 (let ((rtn (symbol-value var))
25420 e opts)
25421 (save-match-data
25422 (if (or (not string) (not (string-match "\\S-" string)))
25423 rtn
25424 (setq opts (delq nil (mapcar (lambda (x)
25425 (setq e (assoc x org-startup-options))
25426 (if (eq (nth 1 e) var) e nil))
25427 (org-split-string string "[ \t]+"))))
25428 (if (not opts)
25429 rtn
25430 (setq rtn nil)
25431 (while (setq e (pop opts))
25432 (if (not (nth 3 e))
25433 (setq rtn (nth 2 e))
25434 (if (not (listp rtn)) (setq rtn nil))
25435 (push (nth 2 e) rtn)))
25436 rtn)))))
25437
24911;;;; Finish up 25438;;;; Finish up
24912 25439
24913(provide 'org) 25440(provide 'org)
diff --git a/lisp/textmodes/reftex-cite.el b/lisp/textmodes/reftex-cite.el
index c8a64b8aecc..46becd26dd4 100644
--- a/lisp/textmodes/reftex-cite.el
+++ b/lisp/textmodes/reftex-cite.el
@@ -702,26 +702,26 @@ While entering the regexp, completion on knows citation keys is possible.
702 (delete-char 1)) 702 (delete-char 1))
703 703
704 ;; Tell AUCTeX 704 ;; Tell AUCTeX
705 (when (and reftex-mode 705 (when (and reftex-mode
706 (fboundp 'LaTeX-add-bibitems) 706 (fboundp 'LaTeX-add-bibitems)
707 reftex-plug-into-AUCTeX) 707 reftex-plug-into-AUCTeX)
708 (apply 'LaTeX-add-bibitems (mapcar 'car selected-entries))) 708 (apply 'LaTeX-add-bibitems (mapcar 'car selected-entries)))
709 709
710 ;; Produce the cite-view strings 710 ;; Produce the cite-view strings
711 (when (and reftex-mode reftex-cache-cite-echo cite-view) 711 (when (and reftex-mode reftex-cache-cite-echo cite-view)
712 (mapcar (lambda (entry) 712 (mapc (lambda (entry)
713 (reftex-make-cite-echo-string entry docstruct-symbol)) 713 (reftex-make-cite-echo-string entry docstruct-symbol))
714 selected-entries)) 714 selected-entries))
715 715
716 (message "")) 716 (message ""))
717 717
718 (set-marker reftex-select-return-marker nil) 718 (set-marker reftex-select-return-marker nil)
719 (reftex-kill-buffer "*RefTeX Select*") 719 (reftex-kill-buffer "*RefTeX Select*")
720 720
721 ;; Check if the prefix arg was numeric, and call recursively 721 ;; Check if the prefix arg was numeric, and call recursively
722 (when (integerp arg) 722 (when (integerp arg)
723 (if (> arg 1) 723 (if (> arg 1)
724 (progn 724 (progn
725 (skip-chars-backward "}") 725 (skip-chars-backward "}")
726 (decf arg) 726 (decf arg)
727 (reftex-do-citation arg)) 727 (reftex-do-citation arg))
@@ -954,7 +954,7 @@ While entering the regexp, completion on knows citation keys is possible.
954 reftex-mouse-selected-face 954 reftex-mouse-selected-face
955 nil)) 955 nil))
956 tmp len) 956 tmp len)
957 (mapcar 957 (mapc
958 (lambda (x) 958 (lambda (x)
959 (setq tmp (cdr (assoc "&formatted" x)) 959 (setq tmp (cdr (assoc "&formatted" x))
960 len (length tmp)) 960 len (length tmp))
diff --git a/lisp/textmodes/reftex-ref.el b/lisp/textmodes/reftex-ref.el
index 3294c4c22a9..c004602757c 100644
--- a/lisp/textmodes/reftex-ref.el
+++ b/lisp/textmodes/reftex-ref.el
@@ -665,10 +665,10 @@ When called with 2 C-u prefix args, disable magic word recognition."
665 (save-excursion 665 (save-excursion
666 (while reftex-buffers-with-changed-invisibility 666 (while reftex-buffers-with-changed-invisibility
667 (set-buffer (car (car reftex-buffers-with-changed-invisibility))) 667 (set-buffer (car (car reftex-buffers-with-changed-invisibility)))
668 (setq buffer-invisibility-spec 668 (setq buffer-invisibility-spec
669 (cdr (pop reftex-buffers-with-changed-invisibility))))) 669 (cdr (pop reftex-buffers-with-changed-invisibility)))))
670 (mapcar (lambda (buf) (and (buffer-live-p buf) (bury-buffer buf))) 670 (mapc (lambda (buf) (and (buffer-live-p buf) (bury-buffer buf)))
671 selection-buffers) 671 selection-buffers)
672 (reftex-kill-temporary-buffers)) 672 (reftex-kill-temporary-buffers))
673 ;; Add the prefixes, put together the relevant information in the form 673 ;; Add the prefixes, put together the relevant information in the form
674 ;; (LABEL TYPEKEY SEPARATOR) and return a list of those. 674 ;; (LABEL TYPEKEY SEPARATOR) and return a list of those.
diff --git a/lisp/textmodes/reftex-sel.el b/lisp/textmodes/reftex-sel.el
index 4a9ad14510d..4551068af90 100644
--- a/lisp/textmodes/reftex-sel.el
+++ b/lisp/textmodes/reftex-sel.el
@@ -643,12 +643,12 @@ Useful for large TOC's."
643 (and ovl (reftex-delete-overlay ovl)) 643 (and ovl (reftex-delete-overlay ovl))
644 (setq reftex-select-marked (delq cell reftex-select-marked)) 644 (setq reftex-select-marked (delq cell reftex-select-marked))
645 (setq cnt (1+ (length reftex-select-marked))) 645 (setq cnt (1+ (length reftex-select-marked)))
646 (mapcar (lambda (c) 646 (mapc (lambda (c)
647 (setq sep (nth 2 c)) 647 (setq sep (nth 2 c))
648 (reftex-overlay-put (nth 1 c) 'before-string 648 (reftex-overlay-put (nth 1 c) 'before-string
649 (if sep 649 (if sep
650 (format "*%c%d* " sep (decf cnt)) 650 (format "*%c%d* " sep (decf cnt))
651 (format "*%d* " (decf cnt))))) 651 (format "*%d* " (decf cnt)))))
652 reftex-select-marked) 652 reftex-select-marked)
653 (message "Entry no longer marked"))) 653 (message "Entry no longer marked")))
654 654
diff --git a/lisp/textmodes/reftex-toc.el b/lisp/textmodes/reftex-toc.el
index 4de409de70c..ae147cc6b97 100644
--- a/lisp/textmodes/reftex-toc.el
+++ b/lisp/textmodes/reftex-toc.el
@@ -618,7 +618,7 @@ point."
618 nil ; we have permission, do nothing 618 nil ; we have permission, do nothing
619 (error "Abort")) ; abort, we don't have permission 619 (error "Abort")) ; abort, we don't have permission
620 ;; Do the changes 620 ;; Do the changes
621 (mapcar 'reftex-toc-promote-action entries) 621 (mapc 'reftex-toc-promote-action entries)
622 ;; Rescan the document and rebuilt the toc buffer 622 ;; Rescan the document and rebuilt the toc buffer
623 (save-window-excursion 623 (save-window-excursion
624 (reftex-toc-Rescan)) 624 (reftex-toc-Rescan))
diff --git a/lisp/textmodes/reftex.el b/lisp/textmodes/reftex.el
index 375bd2d2652..519faded548 100644
--- a/lisp/textmodes/reftex.el
+++ b/lisp/textmodes/reftex.el
@@ -859,12 +859,12 @@ This enforces rescanning the buffer on next use."
859 859
860(defun reftex-erase-all-selection-and-index-buffers () 860(defun reftex-erase-all-selection-and-index-buffers ()
861 ;; Remove all selection buffers associated with current document. 861 ;; Remove all selection buffers associated with current document.
862 (mapcar 862 (mapc
863 (lambda (type) 863 (lambda (type)
864 (reftex-erase-buffer (reftex-make-selection-buffer-name type))) 864 (reftex-erase-buffer (reftex-make-selection-buffer-name type)))
865 reftex-typekey-list) 865 reftex-typekey-list)
866 ;; Kill all index buffers 866 ;; Kill all index buffers
867 (mapcar 867 (mapc
868 (lambda (tag) 868 (lambda (tag)
869 (reftex-kill-buffer (reftex-make-index-buffer-name tag))) 869 (reftex-kill-buffer (reftex-make-index-buffer-name tag)))
870 (cdr (assoc 'index-tags (symbol-value reftex-docstruct-symbol))))) 870 (cdr (assoc 'index-tags (symbol-value reftex-docstruct-symbol)))))
@@ -1339,7 +1339,7 @@ Valid actions are: readable, restore, read, kill, write."
1339 (user-login-name) (user-full-name))) 1339 (user-login-name) (user-full-name)))
1340 (insert "(set reftex-docstruct-symbol '(\n\n") 1340 (insert "(set reftex-docstruct-symbol '(\n\n")
1341 (let ((standard-output (current-buffer))) 1341 (let ((standard-output (current-buffer)))
1342 (mapcar 1342 (mapc
1343 (lambda (x) 1343 (lambda (x)
1344 (cond ((eq (car x) 'toc) 1344 (cond ((eq (car x) 'toc)
1345 ;; A toc entry. Do not save the marker. 1345 ;; A toc entry. Do not save the marker.
diff --git a/lisp/url/ChangeLog b/lisp/url/ChangeLog
index 5da6a1fbae3..0e4362bce31 100644
--- a/lisp/url/ChangeLog
+++ b/lisp/url/ChangeLog
@@ -1,3 +1,8 @@
12007-10-12 Diane Murray <disumu@x3y2z1.net>
2
3 * url-auth.el (url-basic-auth): Set path to "/" when URL has an
4 empty string filename.
5
12007-09-26 Juanma Barranquero <lekktu@gmail.com> 62007-09-26 Juanma Barranquero <lekktu@gmail.com>
2 7
3 * url-dav.el (top): 8 * url-dav.el (top):
diff --git a/lisp/url/url-auth.el b/lisp/url/url-auth.el
index e48a4e293bd..60239ba76ac 100644
--- a/lisp/url/url-auth.el
+++ b/lisp/url/url-auth.el
@@ -74,6 +74,7 @@ instead of the pathname inheritance method."
74 (setq server (format "%s:%d" server port) 74 (setq server (format "%s:%d" server port)
75 path (cond 75 path (cond
76 (realm realm) 76 (realm realm)
77 ((string= "" path) "/")
77 ((string-match "/$" path) path) 78 ((string-match "/$" path) path)
78 (t (url-basepath path))) 79 (t (url-basepath path)))
79 byserv (cdr-safe (assoc server 80 byserv (cdr-safe (assoc server
diff --git a/lisp/vc-arch.el b/lisp/vc-arch.el
index 840a19a0f66..96957de0812 100644
--- a/lisp/vc-arch.el
+++ b/lisp/vc-arch.el
@@ -265,7 +265,7 @@ Return non-nil if FILE is unchanged."
265 ;; ID not found. 265 ;; ID not found.
266 (if (equal (file-name-nondirectory sigfile) 266 (if (equal (file-name-nondirectory sigfile)
267 (subst-char-in-string 267 (subst-char-in-string
268 ?/ ?% (vc-arch-workfile-version file))) 268 ?/ ?% (vc-arch-working-revision file)))
269 'added 269 'added
270 ;; Might be `added' or `up-to-date' as well. 270 ;; Might be `added' or `up-to-date' as well.
271 ;; FIXME: Check in the patch logs to find out. 271 ;; FIXME: Check in the patch logs to find out.
@@ -283,7 +283,7 @@ Return non-nil if FILE is unchanged."
283 'up-to-date 283 'up-to-date
284 'edited))))))))) 284 'edited)))))))))
285 285
286(defun vc-arch-workfile-version (file) 286(defun vc-arch-working-revision (file)
287 (let* ((root (expand-file-name "{arch}" (vc-arch-root file))) 287 (let* ((root (expand-file-name "{arch}" (vc-arch-root file)))
288 (defbranch (vc-arch-default-version file))) 288 (defbranch (vc-arch-default-version file)))
289 (when (and defbranch (string-match "\\`\\(.+@[^/\n]+\\)/\\(\\(\\(.*?\\)\\(?:--.*\\)?\\)--.*\\)\\'" defbranch)) 289 (when (and defbranch (string-match "\\`\\(.+@[^/\n]+\\)/\\(\\(\\(.*?\\)\\(?:--.*\\)?\\)--.*\\)\\'" defbranch))
@@ -321,7 +321,7 @@ Return non-nil if FILE is unchanged."
321 321
322(defun vc-arch-mode-line-string (file) 322(defun vc-arch-mode-line-string (file)
323 "Return string for placement in modeline by `vc-mode-line' for FILE." 323 "Return string for placement in modeline by `vc-mode-line' for FILE."
324 (let ((rev (vc-workfile-version file))) 324 (let ((rev (vc-working-revision file)))
325 (dolist (rule vc-arch-mode-line-rewrite) 325 (dolist (rule vc-arch-mode-line-rewrite)
326 (if (string-match (car rule) rev) 326 (if (string-match (car rule) rev)
327 (setq rev (replace-match (cdr rule) t nil rev)))) 327 (setq rev (replace-match (cdr rule) t nil rev))))
@@ -389,7 +389,7 @@ Return non-nil if FILE is unchanged."
389 (let ((file (car files))) 389 (let ((file (car files)))
390 (if (and newvers 390 (if (and newvers
391 (vc-up-to-date-p file) 391 (vc-up-to-date-p file)
392 (equal newvers (vc-workfile-version file))) 392 (equal newvers (vc-working-revision file)))
393 ;; Newvers is the base revision and the current file is unchanged, 393 ;; Newvers is the base revision and the current file is unchanged,
394 ;; so we can diff with the current file. 394 ;; so we can diff with the current file.
395 (setq newvers nil)) 395 (setq newvers nil))
@@ -406,7 +406,7 @@ Return non-nil if FILE is unchanged."
406 ;; Arch does not support the typical flags. 406 ;; Arch does not support the typical flags.
407 ;; (vc-switches 'Arch 'diff) 407 ;; (vc-switches 'Arch 'diff)
408 (file-relative-name file) 408 (file-relative-name file)
409 (if (equal oldvers (vc-workfile-version file)) 409 (if (equal oldvers (vc-working-revision file))
410 nil 410 nil
411 oldvers)))) 411 oldvers))))
412 (if async 1 status))))) ; async diff, pessimistic assumption. 412 (if async 1 status))))) ; async diff, pessimistic assumption.
@@ -423,7 +423,7 @@ Return non-nil if FILE is unchanged."
423 "A wrapper around `vc-do-command' for use in vc-arch.el." 423 "A wrapper around `vc-do-command' for use in vc-arch.el."
424 (apply 'vc-do-command buffer okstatus vc-arch-command file flags)) 424 (apply 'vc-do-command buffer okstatus vc-arch-command file flags))
425 425
426(defun vc-arch-init-version () nil) 426(defun vc-arch-init-revision () nil)
427 427
428;;; Completion of versions and revisions. 428;;; Completion of versions and revisions.
429 429
@@ -559,7 +559,7 @@ Return non-nil if FILE is unchanged."
559 559
560;;; Less obvious implementations. 560;;; Less obvious implementations.
561 561
562(defun vc-arch-find-version (file rev buffer) 562(defun vc-arch-find-revision (file rev buffer)
563 (let ((out (make-temp-file "vc-out"))) 563 (let ((out (make-temp-file "vc-out")))
564 (unwind-protect 564 (unwind-protect
565 (progn 565 (progn
diff --git a/lisp/vc-bzr.el b/lisp/vc-bzr.el
index 18abed00939..5ed46431fda 100644
--- a/lisp/vc-bzr.el
+++ b/lisp/vc-bzr.el
@@ -238,7 +238,7 @@ If any error occurred in running `bzr status', then return nil."
238(defun vc-bzr-workfile-unchanged-p (file) 238(defun vc-bzr-workfile-unchanged-p (file)
239 (eq 'unchanged (car (vc-bzr-status file)))) 239 (eq 'unchanged (car (vc-bzr-status file))))
240 240
241(defun vc-bzr-workfile-version (file) 241(defun vc-bzr-working-revision (file)
242 (lexical-let* 242 (lexical-let*
243 ((rootdir (vc-bzr-root file)) 243 ((rootdir (vc-bzr-root file))
244 (branch-format-file (expand-file-name vc-bzr-admin-branch-format-file 244 (branch-format-file (expand-file-name vc-bzr-admin-branch-format-file
@@ -284,7 +284,7 @@ If any error occurred in running `bzr status', then return nil."
284 "Register FILE under bzr. 284 "Register FILE under bzr.
285Signal an error unless REV is nil. 285Signal an error unless REV is nil.
286COMMENT is ignored." 286COMMENT is ignored."
287 (if rev (error "Can't register explicit version with bzr")) 287 (if rev (error "Can't register explicit revision with bzr"))
288 (vc-bzr-command "add" nil 0 files)) 288 (vc-bzr-command "add" nil 0 files))
289 289
290;; Could run `bzr status' in the directory and see if it succeeds, but 290;; Could run `bzr status' in the directory and see if it succeeds, but
@@ -313,7 +313,7 @@ or a superior directory.")
313(defun vc-bzr-checkin (files rev comment) 313(defun vc-bzr-checkin (files rev comment)
314 "Check FILE in to bzr with log message COMMENT. 314 "Check FILE in to bzr with log message COMMENT.
315REV non-nil gets an error." 315REV non-nil gets an error."
316 (if rev (error "Can't check in a specific version with bzr")) 316 (if rev (error "Can't check in a specific revision with bzr"))
317 (vc-bzr-command "commit" nil 0 files "-m" comment)) 317 (vc-bzr-command "commit" nil 0 files "-m" comment))
318 318
319(defun vc-bzr-checkout (file &optional editable rev destfile) 319(defun vc-bzr-checkout (file &optional editable rev destfile)
@@ -365,11 +365,11 @@ EDITABLE is ignored."
365 (unless (fboundp 'vc-default-log-view-mode) 365 (unless (fboundp 'vc-default-log-view-mode)
366 (add-hook 'log-view-mode-hook 'vc-bzr-log-view-mode))) 366 (add-hook 'log-view-mode-hook 'vc-bzr-log-view-mode)))
367 367
368(defun vc-bzr-show-log-entry (version) 368(defun vc-bzr-show-log-entry (revision)
369 "Find entry for patch name VERSION in bzr change log buffer." 369 "Find entry for patch name REVISION in bzr change log buffer."
370 (goto-char (point-min)) 370 (goto-char (point-min))
371 (let (case-fold-search) 371 (let (case-fold-search)
372 (if (re-search-forward (concat "^-+\nrevno: " version "$") nil t) 372 (if (re-search-forward (concat "^-+\nrevno: " revision "$") nil t)
373 (beginning-of-line 0) 373 (beginning-of-line 0)
374 (goto-char (point-min))))) 374 (goto-char (point-min)))))
375 375
@@ -377,7 +377,7 @@ EDITABLE is ignored."
377 377
378(defun vc-bzr-diff (files &optional rev1 rev2 buffer) 378(defun vc-bzr-diff (files &optional rev1 rev2 buffer)
379 "VC bzr backend for diff." 379 "VC bzr backend for diff."
380 (let ((working (vc-workfile-version (if (consp files) (car files) files)))) 380 (let ((working (vc-working-revision (if (consp files) (car files) files))))
381 (if (and (equal rev1 working) (not rev2)) 381 (if (and (equal rev1 working) (not rev2))
382 (setq rev1 nil)) 382 (setq rev1 nil))
383 (if (and (not rev1) rev2) 383 (if (and (not rev1) rev2)
@@ -394,8 +394,8 @@ EDITABLE is ignored."
394(defalias 'vc-bzr-diff-tree 'vc-bzr-diff) 394(defalias 'vc-bzr-diff-tree 'vc-bzr-diff)
395 395
396 396
397;; FIXME: vc-{next,previous}-version need fixing in vc.el to deal with 397;; FIXME: vc-{next,previous}-revision need fixing in vc.el to deal with
398;; straight integer versions. 398;; straight integer revisions.
399 399
400(defun vc-bzr-delete-file (file) 400(defun vc-bzr-delete-file (file)
401 "Delete FILE and delete it in the bzr repository." 401 "Delete FILE and delete it in the bzr repository."
@@ -412,12 +412,12 @@ EDITABLE is ignored."
412 "Internal use.") 412 "Internal use.")
413(make-variable-buffer-local 'vc-bzr-annotation-table) 413(make-variable-buffer-local 'vc-bzr-annotation-table)
414 414
415(defun vc-bzr-annotate-command (file buffer &optional version) 415(defun vc-bzr-annotate-command (file buffer &optional revision)
416 "Prepare BUFFER for `vc-annotate' on FILE. 416 "Prepare BUFFER for `vc-annotate' on FILE.
417Each line is tagged with the revision number, which has a `help-echo' 417Each line is tagged with the revision number, which has a `help-echo'
418property containing author and date information." 418property containing author and date information."
419 (apply #'vc-bzr-command "annotate" buffer 0 file "--long" "--all" 419 (apply #'vc-bzr-command "annotate" buffer 0 file "--long" "--all"
420 (if version (list "-r" version))) 420 (if revision (list "-r" revision)))
421 (with-current-buffer buffer 421 (with-current-buffer buffer
422 ;; Store the tags for the annotated source lines in a hash table 422 ;; Store the tags for the annotated source lines in a hash table
423 ;; to allow saving space by sharing the text properties. 423 ;; to allow saving space by sharing the text properties.
@@ -546,7 +546,7 @@ Optional argument LOCALP is always ignored."
546 (vc-file-setprop file 'vc-state current-vc-state) 546 (vc-file-setprop file 'vc-state current-vc-state)
547 (vc-file-setprop file 'vc-bzr-state current-bzr-state) 547 (vc-file-setprop file 'vc-bzr-state current-bzr-state)
548 (when (eq 'added current-bzr-state) 548 (when (eq 'added current-bzr-state)
549 (vc-file-setprop file 'vc-workfile-version "0")))) 549 (vc-file-setprop file 'vc-working-revision "0"))))
550 (when (eq 'not-versioned current-bzr-state) 550 (when (eq 'not-versioned current-bzr-state)
551 (let ((file (expand-file-name 551 (let ((file (expand-file-name
552 (buffer-substring-no-properties 552 (buffer-substring-no-properties
diff --git a/lisp/vc-cvs.el b/lisp/vc-cvs.el
index 0a17388ae34..5ffb4815182 100644
--- a/lisp/vc-cvs.el
+++ b/lisp/vc-cvs.el
@@ -229,13 +229,13 @@ See also variable `vc-cvs-sticky-date-format-string'."
229 (goto-char (point-max)) 229 (goto-char (point-max))
230 (widen))))))) 230 (widen)))))))
231 231
232(defun vc-cvs-workfile-version (file) 232(defun vc-cvs-working-revision (file)
233 "CVS-specific version of `vc-workfile-version'." 233 "CVS-specific version of `vc-working-revision'."
234 ;; There is no need to consult RCS headers under CVS, because we 234 ;; There is no need to consult RCS headers under CVS, because we
235 ;; get the workfile version for free when we recognize that a file 235 ;; get the workfile version for free when we recognize that a file
236 ;; is registered in CVS. 236 ;; is registered in CVS.
237 (vc-cvs-registered file) 237 (vc-cvs-registered file)
238 (vc-file-getprop file 'vc-workfile-version)) 238 (vc-file-getprop file 'vc-working-revision))
239 239
240(defun vc-cvs-checkout-model (file) 240(defun vc-cvs-checkout-model (file)
241 "CVS-specific version of `vc-checkout-model'." 241 "CVS-specific version of `vc-checkout-model'."
@@ -261,7 +261,7 @@ committed and support display of sticky tags."
261 (let* ((sticky-tag (vc-file-getprop file 'vc-cvs-sticky-tag)) 261 (let* ((sticky-tag (vc-file-getprop file 'vc-cvs-sticky-tag))
262 help-echo 262 help-echo
263 (string 263 (string
264 (if (string= (vc-workfile-version file) "0") 264 (if (string= (vc-working-revision file) "0")
265 ;; A file that is added but not yet committed. 265 ;; A file that is added but not yet committed.
266 (progn 266 (progn
267 (setq help-echo "Added file (needs commit) under CVS") 267 (setq help-echo "Added file (needs commit) under CVS")
@@ -282,7 +282,7 @@ committed and support display of sticky tags."
282 "CVS-specific version of `vc-dired-state-info'." 282 "CVS-specific version of `vc-dired-state-info'."
283 (let ((cvs-state (vc-state file))) 283 (let ((cvs-state (vc-state file)))
284 (cond ((eq cvs-state 'edited) 284 (cond ((eq cvs-state 'edited)
285 (if (equal (vc-workfile-version file) "0") 285 (if (equal (vc-working-revision file) "0")
286 "(added)" "(modified)")) 286 "(added)" "(modified)"))
287 ((eq cvs-state 'needs-patch) "(patch)") 287 ((eq cvs-state 'needs-patch) "(patch)")
288 ((eq cvs-state 'needs-merge) "(merge)")))) 288 ((eq cvs-state 'needs-merge) "(merge)"))))
@@ -330,7 +330,7 @@ its parents."
330 330
331(defun vc-cvs-checkin (files rev comment) 331(defun vc-cvs-checkin (files rev comment)
332 "CVS-specific version of `vc-backend-checkin'." 332 "CVS-specific version of `vc-backend-checkin'."
333 (unless (or (not rev) (vc-cvs-valid-version-number-p rev)) 333 (unless (or (not rev) (vc-cvs-valid-revision-number-p rev))
334 (if (not (vc-cvs-valid-symbolic-tag-name-p rev)) 334 (if (not (vc-cvs-valid-symbolic-tag-name-p rev))
335 (error "%s is not a valid symbolic tag name" rev) 335 (error "%s is not a valid symbolic tag name" rev)
336 ;; If the input revison is a valid symbolic tag name, we create it 336 ;; If the input revison is a valid symbolic tag name, we create it
@@ -359,12 +359,12 @@ its parents."
359 (goto-char (point-min)) 359 (goto-char (point-min))
360 (shrink-window-if-larger-than-buffer) 360 (shrink-window-if-larger-than-buffer)
361 (error "Check-in failed")))) 361 (error "Check-in failed"))))
362 ;; Single-file commit? Then update the version by parsing the buffer. 362 ;; Single-file commit? Then update the revision by parsing the buffer.
363 ;; Otherwise we can't necessarily tell what goes with what; clear 363 ;; Otherwise we can't necessarily tell what goes with what; clear
364 ;; its properties so they have to be refetched. 364 ;; its properties so they have to be refetched.
365 (if (= (length files) 1) 365 (if (= (length files) 1)
366 (vc-file-setprop 366 (vc-file-setprop
367 (car files) 'vc-workfile-version 367 (car files) 'vc-working-revision
368 (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) 368 (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2))
369 (mapc (lambda (file) (vc-file-clearprops file)) files)) 369 (mapc (lambda (file) (vc-file-clearprops file)) files))
370 ;; Anyway, forget the checkout model of the file, because we might have 370 ;; Anyway, forget the checkout model of the file, because we might have
@@ -379,7 +379,7 @@ its parents."
379 (if (and rev (not (vc-cvs-valid-symbolic-tag-name-p rev))) 379 (if (and rev (not (vc-cvs-valid-symbolic-tag-name-p rev)))
380 (vc-cvs-command nil 0 files "update" "-A")))) 380 (vc-cvs-command nil 0 files "update" "-A"))))
381 381
382(defun vc-cvs-find-version (file rev buffer) 382(defun vc-cvs-find-revision (file rev buffer)
383 (apply 'vc-cvs-command 383 (apply 'vc-cvs-command
384 buffer 0 file 384 buffer 0 file
385 "-Q" ; suppress diagnostic output 385 "-Q" ; suppress diagnostic output
@@ -404,8 +404,8 @@ REV is the revision to check out."
404 (vc-cvs-command nil 0 file "edit") 404 (vc-cvs-command nil 0 file "edit")
405 (set-file-modes file (logior (file-modes file) 128)) 405 (set-file-modes file (logior (file-modes file) 128))
406 (if (equal file buffer-file-name) (toggle-read-only -1)))) 406 (if (equal file buffer-file-name) (toggle-read-only -1))))
407 ;; Check out a particular version (or recreate the file). 407 ;; Check out a particular revision (or recreate the file).
408 (vc-file-setprop file 'vc-workfile-version nil) 408 (vc-file-setprop file 'vc-working-revision nil)
409 (apply 'vc-cvs-command nil 0 file 409 (apply 'vc-cvs-command nil 0 file
410 (and editable "-w") 410 (and editable "-w")
411 "update" 411 "update"
@@ -426,7 +426,7 @@ REV is the revision to check out."
426 (vc-cvs-command nil 0 file "commit" "-mRemoved.")) 426 (vc-cvs-command nil 0 file "commit" "-mRemoved."))
427 427
428(defun vc-cvs-revert (file &optional contents-done) 428(defun vc-cvs-revert (file &optional contents-done)
429 "Revert FILE to the version on which it was based." 429 "Revert FILE to the working revision on which it was based."
430 (vc-default-revert 'CVS file contents-done) 430 (vc-default-revert 'CVS file contents-done)
431 (unless (eq (vc-checkout-model file) 'implicit) 431 (unless (eq (vc-checkout-model file) 'implicit)
432 (if vc-cvs-use-edit 432 (if vc-cvs-use-edit
@@ -434,13 +434,13 @@ REV is the revision to check out."
434 ;; Make the file read-only by switching off all w-bits 434 ;; Make the file read-only by switching off all w-bits
435 (set-file-modes file (logand (file-modes file) 3950))))) 435 (set-file-modes file (logand (file-modes file) 3950)))))
436 436
437(defun vc-cvs-merge (file first-version &optional second-version) 437(defun vc-cvs-merge (file first-revision &optional second-revision)
438 "Merge changes into current working copy of FILE. 438 "Merge changes into current working copy of FILE.
439The changes are between FIRST-VERSION and SECOND-VERSION." 439The changes are between FIRST-REVISION and SECOND-REVISION."
440 (vc-cvs-command nil 0 file 440 (vc-cvs-command nil 0 file
441 "update" "-kk" 441 "update" "-kk"
442 (concat "-j" first-version) 442 (concat "-j" first-revision)
443 (concat "-j" second-version)) 443 (concat "-j" second-revision))
444 (vc-file-setprop file 'vc-state 'edited) 444 (vc-file-setprop file 'vc-state 'edited)
445 (with-current-buffer (get-buffer "*vc*") 445 (with-current-buffer (get-buffer "*vc*")
446 (goto-char (point-min)) 446 (goto-char (point-min))
@@ -451,18 +451,18 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
451(defun vc-cvs-merge-news (file) 451(defun vc-cvs-merge-news (file)
452 "Merge in any new changes made to FILE." 452 "Merge in any new changes made to FILE."
453 (message "Merging changes into %s..." file) 453 (message "Merging changes into %s..." file)
454 ;; (vc-file-setprop file 'vc-workfile-version nil) 454 ;; (vc-file-setprop file 'vc-working-revision nil)
455 (vc-file-setprop file 'vc-checkout-time 0) 455 (vc-file-setprop file 'vc-checkout-time 0)
456 (vc-cvs-command nil 0 file "update") 456 (vc-cvs-command nil 0 file "update")
457 ;; Analyze the merge result reported by CVS, and set 457 ;; Analyze the merge result reported by CVS, and set
458 ;; file properties accordingly. 458 ;; file properties accordingly.
459 (with-current-buffer (get-buffer "*vc*") 459 (with-current-buffer (get-buffer "*vc*")
460 (goto-char (point-min)) 460 (goto-char (point-min))
461 ;; get new workfile version 461 ;; get new working revision
462 (if (re-search-forward 462 (if (re-search-forward
463 "^Merging differences between [0-9.]* and \\([0-9.]*\\) into" nil t) 463 "^Merging differences between [0-9.]* and \\([0-9.]*\\) into" nil t)
464 (vc-file-setprop file 'vc-workfile-version (match-string 1)) 464 (vc-file-setprop file 'vc-working-revision (match-string 1))
465 (vc-file-setprop file 'vc-workfile-version nil)) 465 (vc-file-setprop file 'vc-working-revision nil))
466 ;; get file status 466 ;; get file status
467 (prog1 467 (prog1
468 (if (eq (buffer-size) 0) 468 (if (eq (buffer-size) 0)
@@ -512,7 +512,7 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
512 nil) 512 nil)
513 513
514(defun vc-cvs-diff (files &optional oldvers newvers buffer) 514(defun vc-cvs-diff (files &optional oldvers newvers buffer)
515 "Get a difference report using CVS between two versions of FILE." 515 "Get a difference report using CVS between two revisions of FILE."
516 (let* ((async (and (not vc-disable-async-diff) 516 (let* ((async (and (not vc-disable-async-diff)
517 (vc-stay-local-p files) 517 (vc-stay-local-p files)
518 (fboundp 'start-process))) 518 (fboundp 'start-process)))
@@ -559,14 +559,14 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
559 (set-process-filter process vc-filter) 559 (set-process-filter process vc-filter)
560 (funcall vc-filter process (substring string (match-beginning 0)))))) 560 (funcall vc-filter process (substring string (match-beginning 0))))))
561 561
562(defun vc-cvs-annotate-command (file buffer &optional version) 562(defun vc-cvs-annotate-command (file buffer &optional revision)
563 "Execute \"cvs annotate\" on FILE, inserting the contents in BUFFER. 563 "Execute \"cvs annotate\" on FILE, inserting the contents in BUFFER.
564Optional arg VERSION is a version to annotate from." 564Optional arg REVISION is a revision to annotate from."
565 (vc-cvs-command buffer 565 (vc-cvs-command buffer
566 (if (and (vc-stay-local-p file) (fboundp 'start-process)) 566 (if (and (vc-stay-local-p file) (fboundp 'start-process))
567 'async 0) 567 'async 0)
568 file "annotate" 568 file "annotate"
569 (if version (concat "-r" version))) 569 (if revision (concat "-r" revision)))
570 ;; Strip the leading few lines. 570 ;; Strip the leading few lines.
571 (let ((proc (get-buffer-process buffer))) 571 (let ((proc (get-buffer-process buffer)))
572 (if proc 572 (if proc
@@ -633,7 +633,7 @@ systime, or nil if there is none."
633;;; 633;;;
634 634
635(defun vc-cvs-create-snapshot (dir name branchp) 635(defun vc-cvs-create-snapshot (dir name branchp)
636 "Assign to DIR's current version a given NAME. 636 "Assign to DIR's current revision a given NAME.
637If BRANCHP is non-nil, the name is created as a branch (and the current 637If BRANCHP is non-nil, the name is created as a branch (and the current
638workspace is immediately moved to that new branch)." 638workspace is immediately moved to that new branch)."
639 (vc-cvs-command nil 0 dir "tag" "-c" (if branchp "-b") name) 639 (vc-cvs-command nil 0 dir "tag" "-c" (if branchp "-b") name)
@@ -663,13 +663,13 @@ If UPDATE is non-nil, then update (resynch) any affected buffers."
663 ((or (string= state "U") 663 ((or (string= state "U")
664 (string= state "P")) 664 (string= state "P"))
665 (vc-file-setprop file 'vc-state 'up-to-date) 665 (vc-file-setprop file 'vc-state 'up-to-date)
666 (vc-file-setprop file 'vc-workfile-version nil) 666 (vc-file-setprop file 'vc-working-revision nil)
667 (vc-file-setprop file 'vc-checkout-time 667 (vc-file-setprop file 'vc-checkout-time
668 (nth 5 (file-attributes file)))) 668 (nth 5 (file-attributes file))))
669 ((or (string= state "M") 669 ((or (string= state "M")
670 (string= state "C")) 670 (string= state "C"))
671 (vc-file-setprop file 'vc-state 'edited) 671 (vc-file-setprop file 'vc-state 'edited)
672 (vc-file-setprop file 'vc-workfile-version nil) 672 (vc-file-setprop file 'vc-working-revision nil)
673 (vc-file-setprop file 'vc-checkout-time 0))) 673 (vc-file-setprop file 'vc-checkout-time 0)))
674 (vc-file-setprop file 'vc-cvs-sticky-tag sticky-tag) 674 (vc-file-setprop file 'vc-cvs-sticky-tag sticky-tag)
675 (vc-resynch-buffer file t t)))) 675 (vc-resynch-buffer file t t))))
@@ -800,7 +800,7 @@ essential information."
800 "\\(RCS Version\\|RCS Revision\\|Repository revision\\):\ 800 "\\(RCS Version\\|RCS Revision\\|Repository revision\\):\
801\[\t ]+\\([0-9.]+\\)" 801\[\t ]+\\([0-9.]+\\)"
802 nil t)) 802 nil t))
803 (vc-file-setprop file 'vc-latest-version (match-string 2))) 803 (vc-file-setprop file 'vc-latest-revision (match-string 2)))
804 (vc-file-setprop 804 (vc-file-setprop
805 file 'vc-state 805 file 'vc-state
806 (cond 806 (cond
@@ -843,8 +843,8 @@ CVS/Entries should only be accessed through this function."
843 (and (string-match "^[a-zA-Z]" tag) 843 (and (string-match "^[a-zA-Z]" tag)
844 (not (string-match "[^a-z0-9A-Z-_]" tag)))) 844 (not (string-match "[^a-z0-9A-Z-_]" tag))))
845 845
846(defun vc-cvs-valid-version-number-p (tag) 846(defun vc-cvs-valid-revision-number-p (tag)
847 "Return non-nil if TAG is a valid version number." 847 "Return non-nil if TAG is a valid revision number."
848 (and (string-match "^[0-9]" tag) 848 (and (string-match "^[0-9]" tag)
849 (not (string-match "[^0-9.]" tag)))) 849 (not (string-match "[^0-9.]" tag))))
850 850
@@ -908,7 +908,7 @@ is non-nil."
908 ;; entry for a "locally added" file (not yet committed) 908 ;; entry for a "locally added" file (not yet committed)
909 ((looking-at "/[^/]+/0/") 909 ((looking-at "/[^/]+/0/")
910 (vc-file-setprop file 'vc-checkout-time 0) 910 (vc-file-setprop file 'vc-checkout-time 0)
911 (vc-file-setprop file 'vc-workfile-version "0") 911 (vc-file-setprop file 'vc-working-revision "0")
912 (if set-state (vc-file-setprop file 'vc-state 'edited))) 912 (if set-state (vc-file-setprop file 'vc-state 'edited)))
913 ;; normal entry 913 ;; normal entry
914 ((looking-at 914 ((looking-at
@@ -922,7 +922,7 @@ is non-nil."
922 ;; sticky tag 922 ;; sticky tag
923 "\\(.\\|\\)" ;Sticky tag type (date or tag name, could be empty) 923 "\\(.\\|\\)" ;Sticky tag type (date or tag name, could be empty)
924 "\\(.*\\)")) ;Sticky tag 924 "\\(.*\\)")) ;Sticky tag
925 (vc-file-setprop file 'vc-workfile-version (match-string 1)) 925 (vc-file-setprop file 'vc-working-revision (match-string 1))
926 (vc-file-setprop file 'vc-cvs-sticky-tag 926 (vc-file-setprop file 'vc-cvs-sticky-tag
927 (vc-cvs-parse-sticky-tag (match-string 4) 927 (vc-cvs-parse-sticky-tag (match-string 4)
928 (match-string 5))) 928 (match-string 5)))
diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index d68b33be76a..4bf6506dcb1 100644
--- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -53,7 +53,7 @@
53;; * state (file) OK 53;; * state (file) OK
54;; - state-heuristic (file) NOT NEEDED 54;; - state-heuristic (file) NOT NEEDED
55;; - dir-state (dir) OK 55;; - dir-state (dir) OK
56;; * workfile-version (file) OK 56;; * working-revision (file) OK
57;; - latest-on-branch-p (file) NOT NEEDED 57;; - latest-on-branch-p (file) NOT NEEDED
58;; * checkout-model (file) OK 58;; * checkout-model (file) OK
59;; - workfile-unchanged-p (file) OK 59;; - workfile-unchanged-p (file) OK
@@ -62,13 +62,13 @@
62;; STATE-CHANGING FUNCTIONS 62;; STATE-CHANGING FUNCTIONS
63;; * create-repo () OK 63;; * create-repo () OK
64;; * register (files &optional rev comment) OK 64;; * register (files &optional rev comment) OK
65;; - init-version (file) NOT NEEDED 65;; - init-revision (file) NOT NEEDED
66;; - responsible-p (file) OK 66;; - responsible-p (file) OK
67;; - could-register (file) NOT NEEDED, DEFAULT IS GOOD 67;; - could-register (file) NOT NEEDED, DEFAULT IS GOOD
68;; - receive-file (file rev) NOT NEEDED 68;; - receive-file (file rev) NOT NEEDED
69;; - unregister (file) OK 69;; - unregister (file) OK
70;; * checkin (files rev comment) OK 70;; * checkin (files rev comment) OK
71;; * find-version (file rev buffer) OK 71;; * find-revision (file rev buffer) OK
72;; * checkout (file &optional editable rev) OK 72;; * checkout (file &optional editable rev) OK
73;; * revert (file &optional contents-done) OK 73;; * revert (file &optional contents-done) OK
74;; - rollback (files) COULD BE SUPPORTED 74;; - rollback (files) COULD BE SUPPORTED
@@ -77,11 +77,11 @@
77;; wouldn't be identified as a merge by git, 77;; wouldn't be identified as a merge by git,
78;; so it's probably not a good idea. 78;; so it's probably not a good idea.
79;; - merge-news (file) see `merge' 79;; - merge-news (file) see `merge'
80;; - steal-lock (file &optional version) NOT NEEDED 80;; - steal-lock (file &optional revision) NOT NEEDED
81;; HISTORY FUNCTIONS 81;; HISTORY FUNCTIONS
82;; * print-log (files &optional buffer) OK 82;; * print-log (files &optional buffer) OK
83;; - log-view-mode () OK 83;; - log-view-mode () OK
84;; - show-log-entry (version) NOT NEEDED, DEFAULT IS GOOD 84;; - show-log-entry (revision) NOT NEEDED, DEFAULT IS GOOD
85;; - wash-log (file) COULD BE SUPPORTED 85;; - wash-log (file) COULD BE SUPPORTED
86;; - logentry-check () NOT NEEDED 86;; - logentry-check () NOT NEEDED
87;; - comment-history (file) ?? 87;; - comment-history (file) ??
@@ -100,8 +100,8 @@
100;; MISCELLANEOUS 100;; MISCELLANEOUS
101;; - make-version-backups-p (file) NOT NEEDED 101;; - make-version-backups-p (file) NOT NEEDED
102;; - repository-hostname (dirname) NOT NEEDED 102;; - repository-hostname (dirname) NOT NEEDED
103;; - previous-version (file rev) OK 103;; - previous-revision (file rev) OK
104;; - next-version (file rev) OK 104;; - next-revision (file rev) OK
105;; - check-headers () COULD BE SUPPORTED 105;; - check-headers () COULD BE SUPPORTED
106;; - clear-headers () NOT NEEDED 106;; - clear-headers () NOT NEEDED
107;; - delete-file (file) OK 107;; - delete-file (file) OK
@@ -177,8 +177,8 @@
177 (vc-file-setprop file 'vc-state 'nil))) 177 (vc-file-setprop file 'vc-state 'nil)))
178 (forward-line))))) 178 (forward-line)))))
179 179
180(defun vc-git-workfile-version (file) 180(defun vc-git-working-revision (file)
181 "Git-specific version of `vc-workfile-version'." 181 "Git-specific version of `vc-working-revision'."
182 (let ((str (with-output-to-string 182 (let ((str (with-output-to-string
183 (with-current-buffer standard-output 183 (with-current-buffer standard-output
184 (call-process "git" nil '(t nil) nil "symbolic-ref" "HEAD"))))) 184 (call-process "git" nil '(t nil) nil "symbolic-ref" "HEAD")))))
@@ -194,7 +194,7 @@
194 194
195(defun vc-git-mode-line-string (file) 195(defun vc-git-mode-line-string (file)
196 "Return string for placement into the modeline for FILE." 196 "Return string for placement into the modeline for FILE."
197 (let* ((branch (vc-git-workfile-version file)) 197 (let* ((branch (vc-git-working-revision file))
198 (def-ml (vc-default-mode-line-string 'Git file)) 198 (def-ml (vc-default-mode-line-string 'Git file))
199 (help-echo (get-text-property 0 'help-echo def-ml))) 199 (help-echo (get-text-property 0 'help-echo def-ml)))
200 (if (zerop (length branch)) 200 (if (zerop (length branch))
@@ -232,7 +232,7 @@
232 (let ((coding-system-for-write git-commits-coding-system)) 232 (let ((coding-system-for-write git-commits-coding-system))
233 (vc-git-command nil 0 files "commit" "-m" comment "--only" "--"))) 233 (vc-git-command nil 0 files "commit" "-m" comment "--only" "--")))
234 234
235(defun vc-git-find-version (file rev buffer) 235(defun vc-git-find-revision (file rev buffer)
236 (let ((coding-system-for-read 'binary) 236 (let ((coding-system-for-read 'binary)
237 (coding-system-for-write 'binary) 237 (coding-system-for-write 'binary)
238 (fullname (substring 238 (fullname (substring
@@ -372,8 +372,8 @@
372 372
373;;; MISCELLANEOUS 373;;; MISCELLANEOUS
374 374
375(defun vc-git-previous-version (file rev) 375(defun vc-git-previous-revision (file rev)
376 "Git-specific version of `vc-previous-version'." 376 "Git-specific version of `vc-previous-revision'."
377 (let ((default-directory (file-name-directory (expand-file-name file))) 377 (let ((default-directory (file-name-directory (expand-file-name file)))
378 (file (file-name-nondirectory file))) 378 (file (file-name-nondirectory file)))
379 (vc-git-symbolic-commit 379 (vc-git-symbolic-commit
@@ -390,8 +390,8 @@
390 (point) 390 (point)
391 (1- (point-max)))))))) 391 (1- (point-max))))))))
392 392
393(defun vc-git-next-version (file rev) 393(defun vc-git-next-revision (file rev)
394 "Git-specific version of `vc-next-version'." 394 "Git-specific version of `vc-next-revision'."
395 (let* ((default-directory (file-name-directory 395 (let* ((default-directory (file-name-directory
396 (expand-file-name file))) 396 (expand-file-name file)))
397 (file (file-name-nondirectory file)) 397 (file (file-name-nondirectory file))
diff --git a/lisp/vc-hg.el b/lisp/vc-hg.el
index 6b9565b8bd8..2e90d06fbc5 100644
--- a/lisp/vc-hg.el
+++ b/lisp/vc-hg.el
@@ -45,7 +45,7 @@
45;; * state (file) OK 45;; * state (file) OK
46;; - state-heuristic (file) ?? PROBABLY NOT NEEDED 46;; - state-heuristic (file) ?? PROBABLY NOT NEEDED
47;; - dir-state (dir) OK 47;; - dir-state (dir) OK
48;; * workfile-version (file) OK 48;; * working-revision (file) OK
49;; - latest-on-branch-p (file) ?? 49;; - latest-on-branch-p (file) ??
50;; * checkout-model (file) OK 50;; * checkout-model (file) OK
51;; - workfile-unchanged-p (file) OK 51;; - workfile-unchanged-p (file) OK
@@ -54,23 +54,23 @@
54;; STATE-CHANGING FUNCTIONS 54;; STATE-CHANGING FUNCTIONS
55;; * register (files &optional rev comment) OK 55;; * register (files &optional rev comment) OK
56;; * create-repo () OK 56;; * create-repo () OK
57;; - init-version () NOT NEEDED 57;; - init-revision () NOT NEEDED
58;; - responsible-p (file) OK 58;; - responsible-p (file) OK
59;; - could-register (file) OK 59;; - could-register (file) OK
60;; - receive-file (file rev) ?? PROBABLY NOT NEEDED 60;; - receive-file (file rev) ?? PROBABLY NOT NEEDED
61;; - unregister (file) COMMENTED OUT, MAY BE INCORRECT 61;; - unregister (file) COMMENTED OUT, MAY BE INCORRECT
62;; * checkin (files rev comment) OK 62;; * checkin (files rev comment) OK
63;; * find-version (file rev buffer) OK 63;; * find-revision (file rev buffer) OK
64;; * checkout (file &optional editable rev) OK 64;; * checkout (file &optional editable rev) OK
65;; * revert (file &optional contents-done) OK 65;; * revert (file &optional contents-done) OK
66;; - rollback (files) ?? PROBABLY NOT NEEDED 66;; - rollback (files) ?? PROBABLY NOT NEEDED
67;; - merge (file rev1 rev2) NEEDED 67;; - merge (file rev1 rev2) NEEDED
68;; - merge-news (file) NEEDED 68;; - merge-news (file) NEEDED
69;; - steal-lock (file &optional version) NOT NEEDED 69;; - steal-lock (file &optional revision) NOT NEEDED
70;; HISTORY FUNCTIONS 70;; HISTORY FUNCTIONS
71;; * print-log (files &optional buffer) OK 71;; * print-log (files &optional buffer) OK
72;; - log-view-mode () OK 72;; - log-view-mode () OK
73;; - show-log-entry (version) NOT NEEDED, DEFAULT IS GOOD 73;; - show-log-entry (revision) NOT NEEDED, DEFAULT IS GOOD
74;; - wash-log (file) ?? 74;; - wash-log (file) ??
75;; - logentry-check () NOT NEEDED 75;; - logentry-check () NOT NEEDED
76;; - comment-history (file) NOT NEEDED 76;; - comment-history (file) NOT NEEDED
@@ -89,8 +89,8 @@
89;; MISCELLANEOUS 89;; MISCELLANEOUS
90;; - make-version-backups-p (file) ?? 90;; - make-version-backups-p (file) ??
91;; - repository-hostname (dirname) ?? 91;; - repository-hostname (dirname) ??
92;; - previous-version (file rev) OK 92;; - previous-revision (file rev) OK
93;; - next-version (file rev) OK 93;; - next-revision (file rev) OK
94;; - check-headers () ?? 94;; - check-headers () ??
95;; - clear-headers () ?? 95;; - clear-headers () ??
96;; - delete-file (file) TEST IT 96;; - delete-file (file) TEST IT
@@ -198,7 +198,7 @@
198 ;; should not show up in vc-dired, so don't deal with them 198 ;; should not show up in vc-dired, so don't deal with them
199 ;; here. 199 ;; here.
200 ((eq status-char ?A) 200 ((eq status-char ?A)
201 (vc-file-setprop file 'vc-workfile-version "0") 201 (vc-file-setprop file 'vc-working-revision "0")
202 (vc-file-setprop file 'vc-state 'edited)) 202 (vc-file-setprop file 'vc-state 'edited))
203 ((eq status-char ?M) 203 ((eq status-char ?M)
204 (vc-file-setprop file 'vc-state 'edited)) 204 (vc-file-setprop file 'vc-state 'edited))
@@ -207,8 +207,8 @@
207 (vc-file-setprop file 'vc-state 'nil))) 207 (vc-file-setprop file 'vc-state 'nil)))
208 (forward-line))))) 208 (forward-line)))))
209 209
210(defun vc-hg-workfile-version (file) 210(defun vc-hg-working-revision (file)
211 "Hg-specific version of `vc-workfile-version'." 211 "Hg-specific version of `vc-working-revision'."
212 (let* 212 (let*
213 ((status nil) 213 ((status nil)
214 (out 214 (out
@@ -277,8 +277,8 @@
277 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))) 277 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))
278 278
279(defun vc-hg-diff (files &optional oldvers newvers buffer) 279(defun vc-hg-diff (files &optional oldvers newvers buffer)
280 "Get a difference report using hg between two versions of FILES." 280 "Get a difference report using hg between two revisions of FILES."
281 (let ((working (vc-workfile-version (car files)))) 281 (let ((working (vc-working-revision (car files))))
282 (if (and (equal oldvers working) (not newvers)) 282 (if (and (equal oldvers working) (not newvers))
283 (setq oldvers nil)) 283 (setq oldvers nil))
284 (if (and (not oldvers) newvers) 284 (if (and (not oldvers) newvers)
@@ -312,10 +312,10 @@
312(defun vc-hg-diff-tree (file &optional oldvers newvers buffer) 312(defun vc-hg-diff-tree (file &optional oldvers newvers buffer)
313 (vc-hg-diff (list file) oldvers newvers buffer)) 313 (vc-hg-diff (list file) oldvers newvers buffer))
314 314
315(defun vc-hg-annotate-command (file buffer &optional version) 315(defun vc-hg-annotate-command (file buffer &optional revision)
316 "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER. 316 "Execute \"hg annotate\" on FILE, inserting the contents in BUFFER.
317Optional arg VERSION is a version to annotate from." 317Optional arg REVISION is a revision to annotate from."
318 (vc-hg-command buffer 0 file "annotate" "-d" "-n" (if version (concat "-r" version))) 318 (vc-hg-command buffer 0 file "annotate" "-d" "-n" (if revision (concat "-r" revision)))
319 (with-current-buffer buffer 319 (with-current-buffer buffer
320 (goto-char (point-min)) 320 (goto-char (point-min))
321 (re-search-forward "^[0-9]") 321 (re-search-forward "^[0-9]")
@@ -338,22 +338,22 @@ Optional arg VERSION is a version to annotate from."
338 (beginning-of-line) 338 (beginning-of-line)
339 (if (looking-at vc-hg-annotate-re) (match-string-no-properties 1)))) 339 (if (looking-at vc-hg-annotate-re) (match-string-no-properties 1))))
340 340
341(defun vc-hg-previous-version (file rev) 341(defun vc-hg-previous-revision (file rev)
342 (let ((newrev (1- (string-to-number rev)))) 342 (let ((newrev (1- (string-to-number rev))))
343 (when (>= newrev 0) 343 (when (>= newrev 0)
344 (number-to-string newrev)))) 344 (number-to-string newrev))))
345 345
346(defun vc-hg-next-version (file rev) 346(defun vc-hg-next-revision (file rev)
347 (let ((newrev (1+ (string-to-number rev))) 347 (let ((newrev (1+ (string-to-number rev)))
348 (tip-version 348 (tip-revision
349 (with-temp-buffer 349 (with-temp-buffer
350 (vc-hg-command t 0 nil "tip") 350 (vc-hg-command t 0 nil "tip")
351 (goto-char (point-min)) 351 (goto-char (point-min))
352 (re-search-forward "^changeset:[ \t]*\\([0-9]+\\):") 352 (re-search-forward "^changeset:[ \t]*\\([0-9]+\\):")
353 (string-to-number (match-string-no-properties 1))))) 353 (string-to-number (match-string-no-properties 1)))))
354 ;; We don't want to exceed the maximum possible version number, ie 354 ;; We don't want to exceed the maximum possible revision number, ie
355 ;; the tip version. 355 ;; the tip revision.
356 (when (<= newrev tip-version) 356 (when (<= newrev tip-revision)
357 (number-to-string newrev)))) 357 (number-to-string newrev))))
358 358
359;; Modelled after the similar function in vc-bzr.el 359;; Modelled after the similar function in vc-bzr.el
@@ -402,7 +402,7 @@ COMMENT is ignored."
402REV is ignored." 402REV is ignored."
403 (vc-hg-command nil 0 files "commit" "-m" comment)) 403 (vc-hg-command nil 0 files "commit" "-m" comment))
404 404
405(defun vc-hg-find-version (file rev buffer) 405(defun vc-hg-find-revision (file rev buffer)
406 (let ((coding-system-for-read 'binary) 406 (let ((coding-system-for-read 'binary)
407 (coding-system-for-write 'binary)) 407 (coding-system-for-write 'binary))
408 (if rev 408 (if rev
@@ -432,7 +432,7 @@ REV is the revision to check out into WORKFILE."
432 "Hg-specific version of `vc-dired-state-info'." 432 "Hg-specific version of `vc-dired-state-info'."
433 (let ((hg-state (vc-state file))) 433 (let ((hg-state (vc-state file)))
434 (if (eq hg-state 'edited) 434 (if (eq hg-state 'edited)
435 (if (equal (vc-workfile-version file) "0") 435 (if (equal (vc-working-revision file) "0")
436 "(added)" "(modified)") 436 "(added)" "(modified)")
437 ;; fall back to the default VC representation 437 ;; fall back to the default VC representation
438 (vc-default-dired-state-info 'Hg file)))) 438 (vc-default-dired-state-info 'Hg file))))
diff --git a/lisp/vc-hooks.el b/lisp/vc-hooks.el
index 822a7eae682..92c6c734483 100644
--- a/lisp/vc-hooks.el
+++ b/lisp/vc-hooks.el
@@ -362,7 +362,8 @@ file was previously registered under a certain backend, then that
362backend is tried first." 362backend is tried first."
363 (let (handler) 363 (let (handler)
364 (cond 364 (cond
365 ((string-match vc-ignore-dir-regexp (file-name-directory file)) nil) 365 ((and (file-name-directory file) (string-match vc-ignore-dir-regexp (file-name-directory file)))
366 nil)
366 ((and (boundp 'file-name-handler-alist) 367 ((and (boundp 'file-name-handler-alist)
367 (setq handler (find-file-name-handler file 'vc-registered))) 368 (setq handler (find-file-name-handler file 'vc-registered)))
368 ;; handler should set vc-backend and return t if registered 369 ;; handler should set vc-backend and return t if registered
@@ -492,7 +493,7 @@ For registered files, the value returned is one of:
492 prompt the user to do it)." 493 prompt the user to do it)."
493 ;; FIXME: New (sub)states needed (?): 494 ;; FIXME: New (sub)states needed (?):
494 ;; - `added' (i.e. `edited' but with no base version yet, 495 ;; - `added' (i.e. `edited' but with no base version yet,
495 ;; typically represented by vc-workfile-version = "0") 496 ;; typically represented by vc-working-revision = "0")
496 ;; - `conflict' (i.e. `edited' with conflict markers) 497 ;; - `conflict' (i.e. `edited' with conflict markers)
497 ;; - `removed' 498 ;; - `removed'
498 ;; - `copied' and `moved' (might be handled by `removed' and `added') 499 ;; - `copied' and `moved' (might be handled by `removed' and `added')
@@ -548,13 +549,13 @@ Return non-nil if FILE is unchanged."
548 (signal (car err) (cdr err)) 549 (signal (car err) (cdr err))
549 (vc-call diff (list file))))))) 550 (vc-call diff (list file)))))))
550 551
551(defun vc-workfile-version (file) 552(defun vc-working-revision (file)
552 "Return the repository version from which FILE was checked out. 553 "Return the repository version from which FILE was checked out.
553If FILE is not registered, this function always returns nil." 554If FILE is not registered, this function always returns nil."
554 (or (vc-file-getprop file 'vc-workfile-version) 555 (or (vc-file-getprop file 'vc-working-revision)
555 (if (vc-backend file) 556 (if (vc-backend file)
556 (vc-file-setprop file 'vc-workfile-version 557 (vc-file-setprop file 'vc-working-revision
557 (vc-call workfile-version file))))) 558 (vc-call working-revision file)))))
558 559
559(defun vc-default-registered (backend file) 560(defun vc-default-registered (backend file)
560 "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates." 561 "Check if FILE is registered in BACKEND using vc-BACKEND-master-templates."
@@ -655,7 +656,7 @@ a regexp for matching all such backup files, regardless of the version."
655 "\\.~.+" (unless manual "\\.") "~") 656 "\\.~.+" (unless manual "\\.") "~")
656 (expand-file-name (concat (file-name-nondirectory file) 657 (expand-file-name (concat (file-name-nondirectory file)
657 ".~" (subst-char-in-string 658 ".~" (subst-char-in-string
658 ?/ ?_ (or rev (vc-workfile-version file))) 659 ?/ ?_ (or rev (vc-working-revision file)))
659 (unless manual ".") "~") 660 (unless manual ".") "~")
660 (file-name-directory file)))) 661 (file-name-directory file))))
661 662
@@ -789,7 +790,7 @@ This function assumes that the file is registered."
789 (setq backend (symbol-name backend)) 790 (setq backend (symbol-name backend))
790 (let ((state (vc-state file)) 791 (let ((state (vc-state file))
791 (state-echo nil) 792 (state-echo nil)
792 (rev (vc-workfile-version file))) 793 (rev (vc-working-revision file)))
793 (propertize 794 (propertize
794 (cond ((or (eq state 'up-to-date) 795 (cond ((or (eq state 'up-to-date)
795 (eq state 'needs-patch)) 796 (eq state 'needs-patch))
@@ -924,7 +925,7 @@ Used in `find-file-not-found-functions'."
924 (define-key map "v" 'vc-next-action) 925 (define-key map "v" 'vc-next-action)
925 (define-key map "+" 'vc-update) 926 (define-key map "+" 'vc-update)
926 (define-key map "=" 'vc-diff) 927 (define-key map "=" 'vc-diff)
927 (define-key map "~" 'vc-version-other-window) 928 (define-key map "~" 'vc-revision-other-window)
928 map)) 929 map))
929(fset 'vc-prefix-map vc-prefix-map) 930(fset 'vc-prefix-map vc-prefix-map)
930(define-key global-map "\C-xv" 'vc-prefix-map) 931(define-key global-map "\C-xv" 'vc-prefix-map)
@@ -941,8 +942,8 @@ Used in `find-file-not-found-functions'."
941 (define-key map [separator1] '("----")) 942 (define-key map [separator1] '("----"))
942 (define-key map [vc-annotate] '("Annotate" . vc-annotate)) 943 (define-key map [vc-annotate] '("Annotate" . vc-annotate))
943 (define-key map [vc-rename-file] '("Rename File" . vc-rename-file)) 944 (define-key map [vc-rename-file] '("Rename File" . vc-rename-file))
944 (define-key map [vc-version-other-window] 945 (define-key map [vc-revision-other-window]
945 '("Show Other Version" . vc-version-other-window)) 946 '("Show Other Version" . vc-revision-other-window))
946 (define-key map [vc-diff] '("Compare with Base Version" . vc-diff)) 947 (define-key map [vc-diff] '("Compare with Base Version" . vc-diff))
947 (define-key map [vc-update-change-log] 948 (define-key map [vc-update-change-log]
948 '("Update ChangeLog" . vc-update-change-log)) 949 '("Update ChangeLog" . vc-update-change-log))
@@ -984,7 +985,7 @@ Used in `find-file-not-found-functions'."
984 985
985;;(put 'vc-rename-file 'menu-enable 'vc-mode) 986;;(put 'vc-rename-file 'menu-enable 'vc-mode)
986;;(put 'vc-annotate 'menu-enable '(eq (vc-buffer-backend) 'CVS)) 987;;(put 'vc-annotate 'menu-enable '(eq (vc-buffer-backend) 'CVS))
987;;(put 'vc-version-other-window 'menu-enable 'vc-mode) 988;;(put 'vc-revision-other-window 'menu-enable 'vc-mode)
988;;(put 'vc-diff 'menu-enable 'vc-mode) 989;;(put 'vc-diff 'menu-enable 'vc-mode)
989;;(put 'vc-update-change-log 'menu-enable 990;;(put 'vc-update-change-log 'menu-enable
990;; '(member (vc-buffer-backend) '(RCS CVS))) 991;; '(member (vc-buffer-backend) '(RCS CVS)))
diff --git a/lisp/vc-mcvs.el b/lisp/vc-mcvs.el
index 766daf3c97b..aa99e3f4273 100644
--- a/lisp/vc-mcvs.el
+++ b/lisp/vc-mcvs.el
@@ -196,8 +196,8 @@ This is only meaningful if you don't use the implicit checkout model
196 (goto-char (point-max)) 196 (goto-char (point-max))
197 (widen))))))) 197 (widen)))))))
198 198
199(defun vc-mcvs-workfile-version (file) 199(defun vc-mcvs-working-revision (file)
200 (vc-cvs-workfile-version 200 (vc-cvs-working-revision
201 (expand-file-name (vc-file-getprop file 'mcvs-inode) 201 (expand-file-name (vc-file-getprop file 'mcvs-inode)
202 (vc-file-getprop file 'mcvs-root)))) 202 (vc-file-getprop file 'mcvs-root))))
203 203
@@ -253,7 +253,7 @@ the Meta-CVS command (in that order)."
253 (vc-switches 'MCVS 'register)) 253 (vc-switches 'MCVS 'register))
254 ;; I'm not sure exactly why, but if we don't setup the inode and root 254 ;; I'm not sure exactly why, but if we don't setup the inode and root
255 ;; prop of the file, things break later on in vc-mode-line that 255 ;; prop of the file, things break later on in vc-mode-line that
256 ;; ends up calling vc-mcvs-workfile-version. 256 ;; ends up calling vc-mcvs-working-revision.
257 ;; We also need to set vc-checkout-time so that vc-workfile-unchanged-p 257 ;; We also need to set vc-checkout-time so that vc-workfile-unchanged-p
258 ;; doesn't try to call `mcvs diff' on the file. 258 ;; doesn't try to call `mcvs diff' on the file.
259 (vc-mcvs-registered file))) 259 (vc-mcvs-registered file)))
@@ -267,7 +267,7 @@ This is only possible if Meta-CVS is responsible for FILE's directory.")
267 267
268(defun vc-mcvs-checkin (files rev comment) 268(defun vc-mcvs-checkin (files rev comment)
269 "Meta-CVS-specific version of `vc-backend-checkin'." 269 "Meta-CVS-specific version of `vc-backend-checkin'."
270 (unless (or (not rev) (vc-mcvs-valid-version-number-p rev)) 270 (unless (or (not rev) (vc-mcvs-valid-revision-number-p rev))
271 (if (not (vc-mcvs-valid-symbolic-tag-name-p rev)) 271 (if (not (vc-mcvs-valid-symbolic-tag-name-p rev))
272 (error "%s is not a valid symbolic tag name" rev) 272 (error "%s is not a valid symbolic tag name" rev)
273 ;; If the input revision is a valid symbolic tag name, we create it 273 ;; If the input revision is a valid symbolic tag name, we create it
@@ -277,8 +277,8 @@ This is only possible if Meta-CVS is responsible for FILE's directory.")
277 ;; be applied just to this one file. 277 ;; be applied just to this one file.
278 (apply 'vc-mcvs-command nil 0 files "tag" "-b" (list rev)) 278 (apply 'vc-mcvs-command nil 0 files "tag" "-b" (list rev))
279 (apply 'vc-mcvs-command nil 0 files "update" "-r" (list rev)) 279 (apply 'vc-mcvs-command nil 0 files "update" "-r" (list rev))
280 (mapcar (lambda (file) (vc-file-setprop file 'vc-mcvs-sticky-tag rev)) 280 (mapc (lambda (file) (vc-file-setprop file 'vc-mcvs-sticky-tag rev))
281 files) 281 files)
282 (setq rev nil))) 282 (setq rev nil)))
283 ;; This commit might cvs-commit several files (e.g. MAP and TYPES) 283 ;; This commit might cvs-commit several files (e.g. MAP and TYPES)
284 ;; so using numbered revs here is dangerous and somewhat meaningless. 284 ;; so using numbered revs here is dangerous and somewhat meaningless.
@@ -292,7 +292,7 @@ This is only possible if Meta-CVS is responsible for FILE's directory.")
292 ;; Check checkin problem. 292 ;; Check checkin problem.
293 (cond 293 (cond
294 ((re-search-forward "Up-to-date check failed" nil t) 294 ((re-search-forward "Up-to-date check failed" nil t)
295 (mapcar (lambda (file) (vc-file-setprop file 'vc-state 'needs-merge)) 295 (mapc (lambda (file) (vc-file-setprop file 'vc-state 'needs-merge))
296 files) 296 files)
297 (error (substitute-command-keys 297 (error (substitute-command-keys
298 (concat "Up-to-date check failed: " 298 (concat "Up-to-date check failed: "
@@ -302,12 +302,12 @@ This is only possible if Meta-CVS is responsible for FILE's directory.")
302 (goto-char (point-min)) 302 (goto-char (point-min))
303 (shrink-window-if-larger-than-buffer) 303 (shrink-window-if-larger-than-buffer)
304 (error "Check-in failed")))) 304 (error "Check-in failed"))))
305 ;; Single-file commit? Then update the version by parsing the buffer. 305 ;; Single-file commit? Then update the revision by parsing the buffer.
306 ;; Otherwise we can't necessarily tell what goes with what; clear 306 ;; Otherwise we can't necessarily tell what goes with what; clear
307 ;; its properties so they have to be refetched. 307 ;; its properties so they have to be refetched.
308 (if (= (length files) 1) 308 (if (= (length files) 1)
309 (vc-file-setprop 309 (vc-file-setprop
310 (car files) 'vc-workfile-version 310 (car files) 'vc-working-revision
311 (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) 311 (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2))
312 (mapc (lambda (file) (vc-file-clearprops file)) files)) 312 (mapc (lambda (file) (vc-file-clearprops file)) files))
313 ;; Anyway, forget the checkout model of the file, because we might have 313 ;; Anyway, forget the checkout model of the file, because we might have
@@ -322,7 +322,7 @@ This is only possible if Meta-CVS is responsible for FILE's directory.")
322 (if (and rev (not (vc-mcvs-valid-symbolic-tag-name-p rev))) 322 (if (and rev (not (vc-mcvs-valid-symbolic-tag-name-p rev)))
323 (vc-mcvs-command nil 0 files "update" "-A")))) 323 (vc-mcvs-command nil 0 files "update" "-A"))))
324 324
325(defun vc-mcvs-find-version (file rev buffer) 325(defun vc-mcvs-find-revision (file rev buffer)
326 (apply 'vc-mcvs-command 326 (apply 'vc-mcvs-command
327 buffer 0 file 327 buffer 0 file
328 "-Q" ; suppress diagnostic output 328 "-Q" ; suppress diagnostic output
@@ -348,8 +348,8 @@ This is only possible if Meta-CVS is responsible for FILE's directory.")
348 (vc-mcvs-command nil 0 file "edit") 348 (vc-mcvs-command nil 0 file "edit")
349 (set-file-modes file (logior (file-modes file) 128)) 349 (set-file-modes file (logior (file-modes file) 128))
350 (if (equal file buffer-file-name) (toggle-read-only -1)))) 350 (if (equal file buffer-file-name) (toggle-read-only -1))))
351 ;; Check out a particular version (or recreate the file). 351 ;; Check out a particular revision (or recreate the file).
352 (vc-file-setprop file 'vc-workfile-version nil) 352 (vc-file-setprop file 'vc-working-revision nil)
353 (apply 'vc-mcvs-command nil 0 file 353 (apply 'vc-mcvs-command nil 0 file
354 (if editable "-w") 354 (if editable "-w")
355 "update" 355 "update"
@@ -364,7 +364,7 @@ This is only possible if Meta-CVS is responsible for FILE's directory.")
364 (vc-mcvs-command nil 0 new "move" (file-relative-name old))) 364 (vc-mcvs-command nil 0 new "move" (file-relative-name old)))
365 365
366(defun vc-mcvs-revert (file &optional contents-done) 366(defun vc-mcvs-revert (file &optional contents-done)
367 "Revert FILE to the version it was based on." 367 "Revert FILE to the working revision it was based on."
368 (vc-default-revert 'MCVS file contents-done) 368 (vc-default-revert 'MCVS file contents-done)
369 (unless (eq (vc-checkout-model file) 'implicit) 369 (unless (eq (vc-checkout-model file) 'implicit)
370 (if vc-mcvs-use-edit 370 (if vc-mcvs-use-edit
@@ -372,13 +372,13 @@ This is only possible if Meta-CVS is responsible for FILE's directory.")
372 ;; Make the file read-only by switching off all w-bits 372 ;; Make the file read-only by switching off all w-bits
373 (set-file-modes file (logand (file-modes file) 3950))))) 373 (set-file-modes file (logand (file-modes file) 3950)))))
374 374
375(defun vc-mcvs-merge (file first-version &optional second-version) 375(defun vc-mcvs-merge (file first-revision &optional second-revision)
376 "Merge changes into current working copy of FILE. 376 "Merge changes into current working copy of FILE.
377The changes are between FIRST-VERSION and SECOND-VERSION." 377The changes are between FIRST-REVISION and SECOND-REVISION."
378 (vc-mcvs-command nil 0 file 378 (vc-mcvs-command nil 0 file
379 "update" "-kk" 379 "update" "-kk"
380 (concat "-j" first-version) 380 (concat "-j" first-revision)
381 (concat "-j" second-version)) 381 (concat "-j" second-revision))
382 (vc-file-setprop file 'vc-state 'edited) 382 (vc-file-setprop file 'vc-state 'edited)
383 (with-current-buffer (get-buffer "*vc*") 383 (with-current-buffer (get-buffer "*vc*")
384 (goto-char (point-min)) 384 (goto-char (point-min))
@@ -389,18 +389,18 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
389(defun vc-mcvs-merge-news (file) 389(defun vc-mcvs-merge-news (file)
390 "Merge in any new changes made to FILE." 390 "Merge in any new changes made to FILE."
391 (message "Merging changes into %s..." file) 391 (message "Merging changes into %s..." file)
392 ;; (vc-file-setprop file 'vc-workfile-version nil) 392 ;; (vc-file-setprop file 'vc-working-revision nil)
393 (vc-file-setprop file 'vc-checkout-time 0) 393 (vc-file-setprop file 'vc-checkout-time 0)
394 (vc-mcvs-command nil 0 file "update") 394 (vc-mcvs-command nil 0 file "update")
395 ;; Analyze the merge result reported by Meta-CVS, and set 395 ;; Analyze the merge result reported by Meta-CVS, and set
396 ;; file properties accordingly. 396 ;; file properties accordingly.
397 (with-current-buffer (get-buffer "*vc*") 397 (with-current-buffer (get-buffer "*vc*")
398 (goto-char (point-min)) 398 (goto-char (point-min))
399 ;; get new workfile version 399 ;; get new working revision
400 (if (re-search-forward 400 (if (re-search-forward
401 "^Merging differences between [0-9.]* and \\([0-9.]*\\) into" nil t) 401 "^Merging differences between [0-9.]* and \\([0-9.]*\\) into" nil t)
402 (vc-file-setprop file 'vc-workfile-version (match-string 1)) 402 (vc-file-setprop file 'vc-working-revision (match-string 1))
403 (vc-file-setprop file 'vc-workfile-version nil)) 403 (vc-file-setprop file 'vc-working-revision nil))
404 ;; get file status 404 ;; get file status
405 (prog1 405 (prog1
406 (if (eq (buffer-size) 0) 406 (if (eq (buffer-size) 0)
@@ -447,7 +447,7 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
447 files "log"))) 447 files "log")))
448 448
449(defun vc-mcvs-diff (files &optional oldvers newvers buffer) 449(defun vc-mcvs-diff (files &optional oldvers newvers buffer)
450 "Get a difference report using Meta-CVS between two versions of FILES." 450 "Get a difference report using Meta-CVS between two revisions of FILES."
451 (let* ((async (and (not vc-disable-async-diff) 451 (let* ((async (and (not vc-disable-async-diff)
452 (vc-stay-local-p files) 452 (vc-stay-local-p files)
453 (fboundp 'start-process))) 453 (fboundp 'start-process)))
@@ -476,13 +476,13 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
476 (and rev2 (concat "-r" rev2)) 476 (and rev2 (concat "-r" rev2))
477 (vc-switches 'MCVS 'diff))))) 477 (vc-switches 'MCVS 'diff)))))
478 478
479(defun vc-mcvs-annotate-command (file buffer &optional version) 479(defun vc-mcvs-annotate-command (file buffer &optional revision)
480 "Execute \"mcvs annotate\" on FILE, inserting the contents in BUFFER. 480 "Execute \"mcvs annotate\" on FILE, inserting the contents in BUFFER.
481Optional arg VERSION is a version to annotate from." 481Optional arg REVISION is a revision to annotate from."
482 (vc-mcvs-command 482 (vc-mcvs-command
483 buffer 483 buffer
484 (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0) 484 (if (and (vc-stay-local-p file) (fboundp 'start-process)) 'async 0)
485 file "annotate" (if version (concat "-r" version))) 485 file "annotate" (if revision (concat "-r" revision)))
486 (with-current-buffer buffer 486 (with-current-buffer buffer
487 (goto-char (point-min)) 487 (goto-char (point-min))
488 (re-search-forward "^[0-9]") 488 (re-search-forward "^[0-9]")
@@ -496,7 +496,7 @@ Optional arg VERSION is a version to annotate from."
496;;; 496;;;
497 497
498(defun vc-mcvs-create-snapshot (dir name branchp) 498(defun vc-mcvs-create-snapshot (dir name branchp)
499 "Assign to DIR's current version a given NAME. 499 "Assign to DIR's current revision a given NAME.
500If BRANCHP is non-nil, the name is created as a branch (and the current 500If BRANCHP is non-nil, the name is created as a branch (and the current
501workspace is immediately moved to that new branch)." 501workspace is immediately moved to that new branch)."
502 (if (not branchp) 502 (if (not branchp)
@@ -528,13 +528,13 @@ If UPDATE is non-nil, then update (resynch) any affected buffers."
528 ((or (string= state "U") 528 ((or (string= state "U")
529 (string= state "P")) 529 (string= state "P"))
530 (vc-file-setprop file 'vc-state 'up-to-date) 530 (vc-file-setprop file 'vc-state 'up-to-date)
531 (vc-file-setprop file 'vc-workfile-version nil) 531 (vc-file-setprop file 'vc-working-revision nil)
532 (vc-file-setprop file 'vc-checkout-time 532 (vc-file-setprop file 'vc-checkout-time
533 (nth 5 (file-attributes file)))) 533 (nth 5 (file-attributes file))))
534 ((or (string= state "M") 534 ((or (string= state "M")
535 (string= state "C")) 535 (string= state "C"))
536 (vc-file-setprop file 'vc-state 'edited) 536 (vc-file-setprop file 'vc-state 'edited)
537 (vc-file-setprop file 'vc-workfile-version nil) 537 (vc-file-setprop file 'vc-working-revision nil)
538 (vc-file-setprop file 'vc-checkout-time 0))) 538 (vc-file-setprop file 'vc-checkout-time 0)))
539 (vc-file-setprop file 'vc-mcvs-sticky-tag sticky-tag) 539 (vc-file-setprop file 'vc-mcvs-sticky-tag sticky-tag)
540 (vc-resynch-buffer file t t)))) 540 (vc-resynch-buffer file t t))))
@@ -596,7 +596,7 @@ and that it passes `vc-mcvs-global-switches' to it before FLAGS."
596 (forward-line 1)))) 596 (forward-line 1))))
597 597
598(defalias 'vc-mcvs-valid-symbolic-tag-name-p 'vc-cvs-valid-symbolic-tag-name-p) 598(defalias 'vc-mcvs-valid-symbolic-tag-name-p 'vc-cvs-valid-symbolic-tag-name-p)
599(defalias 'vc-mcvs-valid-version-number-p 'vc-cvs-valid-version-number-p) 599(defalias 'vc-mcvs-valid-revision-number-p 'vc-cvs-valid-revision-number-p)
600 600
601(provide 'vc-mcvs) 601(provide 'vc-mcvs)
602 602
diff --git a/lisp/vc-mtn.el b/lisp/vc-mtn.el
index e24bf399ba1..5365b4d9289 100644
--- a/lisp/vc-mtn.el
+++ b/lisp/vc-mtn.el
@@ -81,7 +81,7 @@
81 'edited 81 'edited
82 'up-to-date)))) 82 'up-to-date))))
83 83
84(defun vc-mtn-workfile-version (file) 84(defun vc-mtn-working-revision (file)
85 ;; If `mtn' fails or returns status>0, or if the search fails, just 85 ;; If `mtn' fails or returns status>0, or if the search fails, just
86 ;; return nil. 86 ;; return nil.
87 (ignore-errors 87 (ignore-errors
@@ -134,7 +134,7 @@
134(defun vc-mtn-checkin (files rev comment) 134(defun vc-mtn-checkin (files rev comment)
135 (vc-mtn-command nil 0 files "commit" "-m" comment)) 135 (vc-mtn-command nil 0 files "commit" "-m" comment))
136 136
137(defun vc-mtn-find-version (file rev buffer) 137(defun vc-mtn-find-revision (file rev buffer)
138 (vc-mtn-command buffer 0 file "cat" "-r" rev)) 138 (vc-mtn-command buffer 0 file "cat" "-r" rev))
139 139
140;; (defun vc-mtn-checkout (file &optional editable rev) 140;; (defun vc-mtn-checkout (file &optional editable rev)
@@ -163,7 +163,7 @@
163 '(("^[ |]+Author: \\(.*\\)" (1 'change-log-email)) 163 '(("^[ |]+Author: \\(.*\\)" (1 'change-log-email))
164 ("^[ |]+Date: \\(.*\\)" (1 'change-log-date-face)))))) 164 ("^[ |]+Date: \\(.*\\)" (1 'change-log-date-face))))))
165 165
166;; (defun vc-mtn-show-log-entry (version) 166;; (defun vc-mtn-show-log-entry (revision)
167;; ) 167;; )
168 168
169(defun vc-mtn-wash-log (file)) 169(defun vc-mtn-wash-log (file))
diff --git a/lisp/vc-rcs.el b/lisp/vc-rcs.el
index e50e74e5eba..35eba607bea 100644
--- a/lisp/vc-rcs.el
+++ b/lisp/vc-rcs.el
@@ -123,12 +123,12 @@ For a description of possible values, see `vc-check-master-templates'."
123 (and vc-consult-headers 123 (and vc-consult-headers
124 (vc-rcs-consult-headers file))) 124 (vc-rcs-consult-headers file)))
125 (let ((state 125 (let ((state
126 ;; vc-workfile-version might not be known; in that case the 126 ;; vc-working-revision might not be known; in that case the
127 ;; property is nil. vc-rcs-fetch-master-state knows how to 127 ;; property is nil. vc-rcs-fetch-master-state knows how to
128 ;; handle that. 128 ;; handle that.
129 (vc-rcs-fetch-master-state file 129 (vc-rcs-fetch-master-state file
130 (vc-file-getprop file 130 (vc-file-getprop file
131 'vc-workfile-version)))) 131 'vc-working-revision))))
132 (if (not (eq state 'up-to-date)) 132 (if (not (eq state 'up-to-date))
133 state 133 state
134 (if (vc-workfile-unchanged-p file) 134 (if (vc-workfile-unchanged-p file)
@@ -181,19 +181,19 @@ For a description of possible values, see `vc-check-master-templates'."
181 (vc-rcs-state file)))) 181 (vc-rcs-state file))))
182 (vc-rcs-state file))))) 182 (vc-rcs-state file)))))
183 183
184(defun vc-rcs-workfile-version (file) 184(defun vc-rcs-working-revision (file)
185 "RCS-specific version of `vc-workfile-version'." 185 "RCS-specific version of `vc-working-revision'."
186 (or (and vc-consult-headers 186 (or (and vc-consult-headers
187 (vc-rcs-consult-headers file) 187 (vc-rcs-consult-headers file)
188 (vc-file-getprop file 'vc-workfile-version)) 188 (vc-file-getprop file 'vc-working-revision))
189 (progn 189 (progn
190 (vc-rcs-fetch-master-state file) 190 (vc-rcs-fetch-master-state file)
191 (vc-file-getprop file 'vc-workfile-version)))) 191 (vc-file-getprop file 'vc-working-revision))))
192 192
193(defun vc-rcs-latest-on-branch-p (file &optional version) 193(defun vc-rcs-latest-on-branch-p (file &optional version)
194 "Return non-nil if workfile version of FILE is the latest on its branch. 194 "Return non-nil if workfile version of FILE is the latest on its branch.
195When VERSION is given, perform check for that version." 195When VERSION is given, perform check for that version."
196 (unless version (setq version (vc-workfile-version file))) 196 (unless version (setq version (vc-working-revision file)))
197 (with-temp-buffer 197 (with-temp-buffer
198 (string= version 198 (string= version
199 (if (vc-trunk-p version) 199 (if (vc-trunk-p version)
@@ -221,7 +221,7 @@ When VERSION is given, perform check for that version."
221 "RCS-specific implementation of `vc-workfile-unchanged-p'." 221 "RCS-specific implementation of `vc-workfile-unchanged-p'."
222 ;; Try to use rcsdiff --brief. If rcsdiff does not understand that, 222 ;; Try to use rcsdiff --brief. If rcsdiff does not understand that,
223 ;; do a double take and remember the fact for the future 223 ;; do a double take and remember the fact for the future
224 (let* ((version (concat "-r" (vc-workfile-version file))) 224 (let* ((version (concat "-r" (vc-working-revision file)))
225 (status (if (eq vc-rcsdiff-knows-brief 'no) 225 (status (if (eq vc-rcsdiff-knows-brief 'no)
226 (vc-do-command nil 1 "rcsdiff" file version) 226 (vc-do-command nil 1 "rcsdiff" file version)
227 (vc-do-command nil 2 "rcsdiff" file "--brief" version)))) 227 (vc-do-command nil 2 "rcsdiff" file "--brief" version))))
@@ -292,7 +292,7 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
292 (expand-file-name 292 (expand-file-name
293 name 293 name
294 (file-name-directory file)))))) 294 (file-name-directory file))))))
295 (vc-file-setprop file 'vc-workfile-version 295 (vc-file-setprop file 'vc-working-revision
296 (if (re-search-forward 296 (if (re-search-forward
297 "^initial revision: \\([0-9.]+\\).*\n" 297 "^initial revision: \\([0-9.]+\\).*\n"
298 nil t) 298 nil t)
@@ -335,7 +335,7 @@ whether to remove it."
335 (let ((switches (vc-switches 'RCS 'checkin))) 335 (let ((switches (vc-switches 'RCS 'checkin)))
336 ;; Now operate on the files 336 ;; Now operate on the files
337 (dolist (file files) 337 (dolist (file files)
338 (let ((old-version (vc-workfile-version file)) new-version 338 (let ((old-version (vc-working-revision file)) new-version
339 (default-branch (vc-file-getprop file 'vc-rcs-default-branch))) 339 (default-branch (vc-file-getprop file 'vc-rcs-default-branch)))
340 ;; Force branch creation if an appropriate 340 ;; Force branch creation if an appropriate
341 ;; default branch has been set. 341 ;; default branch has been set.
@@ -353,7 +353,7 @@ whether to remove it."
353 (concat (if vc-keep-workfiles "-u" "-r") rev) 353 (concat (if vc-keep-workfiles "-u" "-r") rev)
354 (concat "-m" comment) 354 (concat "-m" comment)
355 switches) 355 switches)
356 (vc-file-setprop file 'vc-workfile-version nil) 356 (vc-file-setprop file 'vc-working-revision nil)
357 357
358 ;; determine the new workfile version 358 ;; determine the new workfile version
359 (set-buffer "*vc*") 359 (set-buffer "*vc*")
@@ -363,7 +363,7 @@ whether to remove it."
363 (re-search-forward 363 (re-search-forward
364 "reverting to previous revision \\([0-9.]+\\)" nil t)) 364 "reverting to previous revision \\([0-9.]+\\)" nil t))
365 (setq new-version (match-string 1)) 365 (setq new-version (match-string 1))
366 (vc-file-setprop file 'vc-workfile-version new-version)) 366 (vc-file-setprop file 'vc-working-revision new-version))
367 367
368 ;; if we got to a different branch, adjust the default 368 ;; if we got to a different branch, adjust the default
369 ;; branch accordingly 369 ;; branch accordingly
@@ -382,7 +382,7 @@ whether to remove it."
382 (vc-do-command nil 1 "rcs" (vc-name file) 382 (vc-do-command nil 1 "rcs" (vc-name file)
383 (concat "-u" old-version))))))))) 383 (concat "-u" old-version)))))))))
384 384
385(defun vc-rcs-find-version (file rev buffer) 385(defun vc-rcs-find-revision (file rev buffer)
386 (apply 'vc-do-command 386 (apply 'vc-do-command
387 buffer 0 "co" (vc-name file) 387 buffer 0 "co" (vc-name file)
388 "-q" ;; suppress diagnostic output 388 "-q" ;; suppress diagnostic output
@@ -421,7 +421,7 @@ whether to remove it."
421 (if (stringp rev) 421 (if (stringp rev)
422 ;; a literal revision was specified 422 ;; a literal revision was specified
423 (concat "-r" rev) 423 (concat "-r" rev)
424 (let ((workrev (vc-workfile-version file))) 424 (let ((workrev (vc-working-revision file)))
425 (if workrev 425 (if workrev
426 (concat "-r" 426 (concat "-r"
427 (if (not rev) 427 (if (not rev)
@@ -441,7 +441,7 @@ whether to remove it."
441 (with-current-buffer "*vc*" 441 (with-current-buffer "*vc*"
442 (setq new-version 442 (setq new-version
443 (vc-parse-buffer "^revision \\([0-9.]+\\).*\n" 1))) 443 (vc-parse-buffer "^revision \\([0-9.]+\\).*\n" 1)))
444 (vc-file-setprop file 'vc-workfile-version new-version) 444 (vc-file-setprop file 'vc-working-revision new-version)
445 ;; if necessary, adjust the default branch 445 ;; if necessary, adjust the default branch
446 (and rev (not (string= rev "")) 446 (and rev (not (string= rev ""))
447 (vc-rcs-set-default-branch 447 (vc-rcs-set-default-branch
@@ -457,7 +457,7 @@ whether to remove it."
457 (if (not files) 457 (if (not files)
458 (error "RCS backend doesn't support directory-level rollback.")) 458 (error "RCS backend doesn't support directory-level rollback."))
459 (dolist (file files) 459 (dolist (file files)
460 (let* ((discard (vc-workfile-version file)) 460 (let* ((discard (vc-working-revision file))
461 (previous (if (vc-trunk-p discard) "" (vc-branch-part discard))) 461 (previous (if (vc-trunk-p discard) "" (vc-branch-part discard)))
462 (config (current-window-configuration)) 462 (config (current-window-configuration))
463 (done nil)) 463 (done nil))
@@ -492,7 +492,7 @@ whether to remove it."
492 "Revert FILE to the version it was based on." 492 "Revert FILE to the version it was based on."
493 (vc-do-command nil 0 "co" (vc-name file) "-f" 493 (vc-do-command nil 0 "co" (vc-name file) "-f"
494 (concat (if (eq (vc-state file) 'edited) "-u" "-r") 494 (concat (if (eq (vc-state file) 'edited) "-u" "-r")
495 (vc-workfile-version file)))) 495 (vc-working-revision file))))
496 496
497(defun vc-rcs-merge (file first-version &optional second-version) 497(defun vc-rcs-merge (file first-version &optional second-version)
498 "Merge changes into current working copy of FILE. 498 "Merge changes into current working copy of FILE.
@@ -811,11 +811,11 @@ to its master version."
811 (or value 811 (or value
812 (vc-branch-part branch)))) 812 (vc-branch-part branch))))
813 813
814(defun vc-rcs-fetch-master-state (file &optional workfile-version) 814(defun vc-rcs-fetch-master-state (file &optional working-revision)
815 "Compute the master file's idea of the state of FILE. 815 "Compute the master file's idea of the state of FILE.
816If a WORKFILE-VERSION is given, compute the state of that version, 816If a WORKFILE-VERSION is given, compute the state of that version,
817otherwise determine the workfile version based on the master file. 817otherwise determine the workfile version based on the master file.
818This function sets the properties `vc-workfile-version' and 818This function sets the properties `vc-working-revision' and
819`vc-checkout-model' to their correct values, based on the master 819`vc-checkout-model' to their correct values, based on the master
820file." 820file."
821 (with-temp-buffer 821 (with-temp-buffer
@@ -826,7 +826,7 @@ file."
826 (let ((workfile-is-latest nil) 826 (let ((workfile-is-latest nil)
827 (default-branch (vc-parse-buffer "^branch[ \t\n]+\\([^;]*\\);" 1))) 827 (default-branch (vc-parse-buffer "^branch[ \t\n]+\\([^;]*\\);" 1)))
828 (vc-file-setprop file 'vc-rcs-default-branch default-branch) 828 (vc-file-setprop file 'vc-rcs-default-branch default-branch)
829 (unless workfile-version 829 (unless working-revision
830 ;; Workfile version not known yet. Determine that first. It 830 ;; Workfile version not known yet. Determine that first. It
831 ;; is either the head of the trunk, the head of the default 831 ;; is either the head of the trunk, the head of the default
832 ;; branch, or the "default branch" itself, if that is a full 832 ;; branch, or the "default branch" itself, if that is a full
@@ -834,19 +834,19 @@ file."
834 (cond 834 (cond
835 ;; no default branch 835 ;; no default branch
836 ((or (not default-branch) (string= "" default-branch)) 836 ((or (not default-branch) (string= "" default-branch))
837 (setq workfile-version 837 (setq working-revision
838 (vc-parse-buffer "^head[ \t\n]+\\([^;]+\\);" 1)) 838 (vc-parse-buffer "^head[ \t\n]+\\([^;]+\\);" 1))
839 (setq workfile-is-latest t)) 839 (setq workfile-is-latest t))
840 ;; default branch is actually a revision 840 ;; default branch is actually a revision
841 ((string-match "^[0-9]+\\.[0-9]+\\(\\.[0-9]+\\.[0-9]+\\)*$" 841 ((string-match "^[0-9]+\\.[0-9]+\\(\\.[0-9]+\\.[0-9]+\\)*$"
842 default-branch) 842 default-branch)
843 (setq workfile-version default-branch)) 843 (setq working-revision default-branch))
844 ;; else, search for the head of the default branch 844 ;; else, search for the head of the default branch
845 (t (vc-insert-file (vc-name file) "^desc") 845 (t (vc-insert-file (vc-name file) "^desc")
846 (setq workfile-version 846 (setq working-revision
847 (vc-rcs-find-most-recent-rev default-branch)) 847 (vc-rcs-find-most-recent-rev default-branch))
848 (setq workfile-is-latest t))) 848 (setq workfile-is-latest t)))
849 (vc-file-setprop file 'vc-workfile-version workfile-version)) 849 (vc-file-setprop file 'vc-working-revision working-revision))
850 ;; Check strict locking 850 ;; Check strict locking
851 (goto-char (point-min)) 851 (goto-char (point-min))
852 (vc-file-setprop file 'vc-checkout-model 852 (vc-file-setprop file 'vc-checkout-model
@@ -856,14 +856,14 @@ file."
856 (goto-char (point-min)) 856 (goto-char (point-min))
857 (let ((locking-user 857 (let ((locking-user
858 (vc-parse-buffer (concat "^locks[ \t\n]+[^;]*[ \t\n]+\\([^:]+\\):" 858 (vc-parse-buffer (concat "^locks[ \t\n]+[^;]*[ \t\n]+\\([^:]+\\):"
859 (regexp-quote workfile-version) 859 (regexp-quote working-revision)
860 "[^0-9.]") 860 "[^0-9.]")
861 1))) 861 1)))
862 (cond 862 (cond
863 ;; not locked 863 ;; not locked
864 ((not locking-user) 864 ((not locking-user)
865 (if (or workfile-is-latest 865 (if (or workfile-is-latest
866 (vc-rcs-latest-on-branch-p file workfile-version)) 866 (vc-rcs-latest-on-branch-p file working-revision))
867 ;; workfile version is latest on branch 867 ;; workfile version is latest on branch
868 'up-to-date 868 'up-to-date
869 ;; workfile version is not latest on branch 869 ;; workfile version is not latest on branch
@@ -873,7 +873,7 @@ file."
873 (string= locking-user (vc-user-login-name file))) 873 (string= locking-user (vc-user-login-name file)))
874 (if (or (eq (vc-checkout-model file) 'locking) 874 (if (or (eq (vc-checkout-model file) 'locking)
875 workfile-is-latest 875 workfile-is-latest
876 (vc-rcs-latest-on-branch-p file workfile-version)) 876 (vc-rcs-latest-on-branch-p file working-revision))
877 'edited 877 'edited
878 ;; Locking is not used for the file, but the owner does 878 ;; Locking is not used for the file, but the owner does
879 ;; have a lock, and there is a higher version on the current 879 ;; have a lock, and there is a higher version on the current
@@ -954,7 +954,7 @@ Returns: nil if no headers were found
954 ;; else: nothing found 954 ;; else: nothing found
955 ;; ------------------- 955 ;; -------------------
956 (t nil))) 956 (t nil)))
957 (if status (vc-file-setprop file 'vc-workfile-version version)) 957 (if status (vc-file-setprop file 'vc-working-revision version))
958 (and (eq status 'rev-and-lock) 958 (and (eq status 'rev-and-lock)
959 (vc-file-setprop file 'vc-state 959 (vc-file-setprop file 'vc-state
960 (cond 960 (cond
diff --git a/lisp/vc-sccs.el b/lisp/vc-sccs.el
index 2389cb36203..06fcff3ceb5 100644
--- a/lisp/vc-sccs.el
+++ b/lisp/vc-sccs.el
@@ -111,8 +111,8 @@ For a description of possible values, see `vc-check-master-templates'."
111 (with-temp-buffer 111 (with-temp-buffer
112 (if (vc-insert-file (vc-sccs-lock-file file)) 112 (if (vc-insert-file (vc-sccs-lock-file file))
113 (let* ((locks (vc-sccs-parse-locks)) 113 (let* ((locks (vc-sccs-parse-locks))
114 (workfile-version (vc-workfile-version file)) 114 (working-revision (vc-working-revision file))
115 (locking-user (cdr (assoc workfile-version locks)))) 115 (locking-user (cdr (assoc working-revision locks))))
116 (if (not locking-user) 116 (if (not locking-user)
117 (if (vc-workfile-unchanged-p file) 117 (if (vc-workfile-unchanged-p file)
118 'up-to-date 118 'up-to-date
@@ -145,13 +145,13 @@ For a description of possible values, see `vc-check-master-templates'."
145 (vc-sccs-state file)))) 145 (vc-sccs-state file))))
146 (vc-sccs-state file))) 146 (vc-sccs-state file)))
147 147
148(defun vc-sccs-workfile-version (file) 148(defun vc-sccs-working-revision (file)
149 "SCCS-specific version of `vc-workfile-version'." 149 "SCCS-specific version of `vc-working-revision'."
150 (with-temp-buffer 150 (with-temp-buffer
151 ;; The workfile version is always the latest version number. 151 ;; The working revision is always the latest revision number.
152 ;; To find this number, search the entire delta table, 152 ;; To find this number, search the entire delta table,
153 ;; rather than just the first entry, because the 153 ;; rather than just the first entry, because the
154 ;; first entry might be a deleted ("R") version. 154 ;; first entry might be a deleted ("R") revision.
155 (vc-insert-file (vc-name file) "^\001e\n\001[^s]") 155 (vc-insert-file (vc-name file) "^\001e\n\001[^s]")
156 (vc-parse-buffer "^\001d D \\([^ ]+\\)" 1))) 156 (vc-parse-buffer "^\001d D \\([^ ]+\\)" 1)))
157 157
@@ -163,7 +163,7 @@ For a description of possible values, see `vc-check-master-templates'."
163 "SCCS-specific implementation of `vc-workfile-unchanged-p'." 163 "SCCS-specific implementation of `vc-workfile-unchanged-p'."
164 (zerop (apply 'vc-do-command nil 1 "vcdiff" (vc-name file) 164 (zerop (apply 'vc-do-command nil 1 "vcdiff" (vc-name file)
165 (list "--brief" "-q" 165 (list "--brief" "-q"
166 (concat "-r" (vc-workfile-version file)))))) 166 (concat "-r" (vc-working-revision file))))))
167 167
168 168
169;;; 169;;;
@@ -219,7 +219,7 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
219 (if vc-keep-workfiles 219 (if vc-keep-workfiles
220 (vc-do-command nil 0 "get" (vc-name file))))) 220 (vc-do-command nil 0 "get" (vc-name file)))))
221 221
222(defun vc-sccs-find-version (file rev buffer) 222(defun vc-sccs-find-revision (file rev buffer)
223 (apply 'vc-do-command 223 (apply 'vc-do-command
224 buffer 0 "get" (vc-name file) 224 buffer 0 "get" (vc-name file)
225 "-s" ;; suppress diagnostic output 225 "-s" ;; suppress diagnostic output
@@ -230,7 +230,7 @@ expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
230 (vc-switches 'SCCS 'checkout))) 230 (vc-switches 'SCCS 'checkout)))
231 231
232(defun vc-sccs-checkout (file &optional editable rev) 232(defun vc-sccs-checkout (file &optional editable rev)
233 "Retrieve a copy of a saved version of SCCS controlled FILE. 233 "Retrieve a copy of a saved revision of SCCS controlled FILE.
234EDITABLE non-nil means that the file should be writable and 234EDITABLE non-nil means that the file should be writable and
235locked. REV is the revision to check out." 235locked. REV is the revision to check out."
236 (let ((file-buffer (get-file-buffer file)) 236 (let ((file-buffer (get-file-buffer file))
@@ -258,12 +258,12 @@ locked. REV is the revision to check out."
258 switches)))) 258 switches))))
259 (message "Checking out %s...done" file))) 259 (message "Checking out %s...done" file)))
260 260
261(defun vc-sccs-cancel-version (files) 261(defun vc-sccs-rollback (files)
262 "Roll back, undoing the most recent checkins of FILES." 262 "Roll back, undoing the most recent checkins of FILES."
263 (if (not files) 263 (if (not files)
264 (error "SCCS backend doesn't support directory-level rollback.")) 264 (error "SCCS backend doesn't support directory-level rollback."))
265 (dolist (file files) 265 (dolist (file files)
266 (let ((discard (vc-workfile-version file))) 266 (let ((discard (vc-working-revision file)))
267 (if (null (yes-or-no-p (format "Remove version %s from %s history? " 267 (if (null (yes-or-no-p (format "Remove version %s from %s history? "
268 discard file))) 268 discard file)))
269 (error "Aborted")) 269 (error "Aborted"))
@@ -275,10 +275,10 @@ locked. REV is the revision to check out."
275 "Revert FILE to the version it was based on." 275 "Revert FILE to the version it was based on."
276 (vc-do-command nil 0 "unget" (vc-name file)) 276 (vc-do-command nil 0 "unget" (vc-name file))
277 (vc-do-command nil 0 "get" (vc-name file)) 277 (vc-do-command nil 0 "get" (vc-name file))
278 ;; Checking out explicit versions is not supported under SCCS, yet. 278 ;; Checking out explicit revisions is not supported under SCCS, yet.
279 ;; We always "revert" to the latest version; therefore 279 ;; We always "revert" to the latest revision; therefore
280 ;; vc-workfile-version is cleared here so that it gets recomputed. 280 ;; vc-working-revision is cleared here so that it gets recomputed.
281 (vc-file-setprop file 'vc-workfile-version nil)) 281 (vc-file-setprop file 'vc-working-revision nil))
282 282
283(defun vc-sccs-steal-lock (file &optional rev) 283(defun vc-sccs-steal-lock (file &optional rev)
284 "Steal the lock on the current workfile for FILE and revision REV." 284 "Steal the lock on the current workfile for FILE and revision REV."
@@ -322,8 +322,8 @@ locked. REV is the revision to check out."
322;;; 322;;;
323 323
324(defun vc-sccs-assign-name (file name) 324(defun vc-sccs-assign-name (file name)
325 "Assign to FILE's latest version a given NAME." 325 "Assign to FILE's latest revision a given NAME."
326 (vc-sccs-add-triple name file (vc-workfile-version file))) 326 (vc-sccs-add-triple name file (vc-working-revision file)))
327 327
328 328
329;;; 329;;;
@@ -388,7 +388,7 @@ find any project directory."
388 388
389(defun vc-sccs-parse-locks () 389(defun vc-sccs-parse-locks ()
390 "Parse SCCS locks in current buffer. 390 "Parse SCCS locks in current buffer.
391The result is a list of the form ((VERSION . USER) (VERSION . USER) ...)." 391The result is a list of the form ((REVISION . USER) (REVISION . USER) ...)."
392 (let (master-locks) 392 (let (master-locks)
393 (goto-char (point-min)) 393 (goto-char (point-min))
394 (while (re-search-forward "^\\([0-9.]+\\) [0-9.]+ \\([^ ]+\\) .*\n?" 394 (while (re-search-forward "^\\([0-9.]+\\) [0-9.]+ \\([^ ]+\\) .*\n?"
@@ -409,8 +409,8 @@ The result is a list of the form ((VERSION . USER) (VERSION . USER) ...)."
409 (kill-buffer (current-buffer)))) 409 (kill-buffer (current-buffer))))
410 410
411(defun vc-sccs-lookup-triple (file name) 411(defun vc-sccs-lookup-triple (file name)
412 "Return the numeric version corresponding to a named snapshot of FILE. 412 "Return the numeric revision corresponding to a named snapshot of FILE.
413If NAME is nil or a version number string it's just passed through." 413If NAME is nil or a revision number string it's just passed through."
414 (if (or (null name) 414 (if (or (null name)
415 (let ((firstchar (aref name 0))) 415 (let ((firstchar (aref name 0)))
416 (and (>= firstchar ?0) (<= firstchar ?9)))) 416 (and (>= firstchar ?0) (<= firstchar ?9))))
diff --git a/lisp/vc-svn.el b/lisp/vc-svn.el
index bf003f2ac97..43643b931d9 100644
--- a/lisp/vc-svn.el
+++ b/lisp/vc-svn.el
@@ -160,13 +160,13 @@ If you want to force an empty list of arguments, use t."
160 (vc-svn-command t 0 nil "status" (if localp "-v" "-u")) 160 (vc-svn-command t 0 nil "status" (if localp "-v" "-u"))
161 (vc-svn-parse-status)))) 161 (vc-svn-parse-status))))
162 162
163(defun vc-svn-workfile-version (file) 163(defun vc-svn-working-revision (file)
164 "SVN-specific version of `vc-workfile-version'." 164 "SVN-specific version of `vc-working-revision'."
165 ;; There is no need to consult RCS headers under SVN, because we 165 ;; There is no need to consult RCS headers under SVN, because we
166 ;; get the workfile version for free when we recognize that a file 166 ;; get the workfile version for free when we recognize that a file
167 ;; is registered in SVN. 167 ;; is registered in SVN.
168 (vc-svn-registered file) 168 (vc-svn-registered file)
169 (vc-file-getprop file 'vc-workfile-version)) 169 (vc-file-getprop file 'vc-working-revision))
170 170
171(defun vc-svn-checkout-model (file) 171(defun vc-svn-checkout-model (file)
172 "SVN-specific version of `vc-checkout-model'." 172 "SVN-specific version of `vc-checkout-model'."
@@ -180,25 +180,25 @@ If you want to force an empty list of arguments, use t."
180 "SVN-specific version of `vc-dired-state-info'." 180 "SVN-specific version of `vc-dired-state-info'."
181 (let ((svn-state (vc-state file))) 181 (let ((svn-state (vc-state file)))
182 (cond ((eq svn-state 'edited) 182 (cond ((eq svn-state 'edited)
183 (if (equal (vc-workfile-version file) "0") 183 (if (equal (vc-working-revision file) "0")
184 "(added)" "(modified)")) 184 "(added)" "(modified)"))
185 ((eq svn-state 'needs-patch) "(patch)") 185 ((eq svn-state 'needs-patch) "(patch)")
186 ((eq svn-state 'needs-merge) "(merge)")))) 186 ((eq svn-state 'needs-merge) "(merge)"))))
187 187
188(defun vc-svn-previous-version (file rev) 188(defun vc-svn-previous-revision (file rev)
189 (let ((newrev (1- (string-to-number rev)))) 189 (let ((newrev (1- (string-to-number rev))))
190 (when (< 0 newrev) 190 (when (< 0 newrev)
191 (number-to-string newrev)))) 191 (number-to-string newrev))))
192 192
193(defun vc-svn-next-version (file rev) 193(defun vc-svn-next-revision (file rev)
194 (let ((newrev (1+ (string-to-number rev)))) 194 (let ((newrev (1+ (string-to-number rev))))
195 ;; The "workfile version" is an uneasy conceptual fit under Subversion; 195 ;; The "working revision" is an uneasy conceptual fit under Subversion;
196 ;; we use it as the upper bound until a better idea comes along. If the 196 ;; we use it as the upper bound until a better idea comes along. If the
197 ;; workfile version W coincides with the tree's latest revision R, then 197 ;; workfile version W coincides with the tree's latest revision R, then
198 ;; this check prevents a "no such revision: R+1" error. Otherwise, it 198 ;; this check prevents a "no such revision: R+1" error. Otherwise, it
199 ;; inhibits showing of W+1 through R, which could be considered anywhere 199 ;; inhibits showing of W+1 through R, which could be considered anywhere
200 ;; from gracious to impolite. 200 ;; from gracious to impolite.
201 (unless (< (string-to-number (vc-file-getprop file 'vc-workfile-version)) 201 (unless (< (string-to-number (vc-file-getprop file 'vc-working-revision))
202 newrev) 202 newrev)
203 (number-to-string newrev)))) 203 (number-to-string newrev))))
204 204
@@ -256,11 +256,11 @@ This is only possible if SVN is responsible for FILE's directory.")
256 (error "Check-in failed")))) 256 (error "Check-in failed"))))
257 ;; Update file properties 257 ;; Update file properties
258 ;; (vc-file-setprop 258 ;; (vc-file-setprop
259 ;; file 'vc-workfile-version 259 ;; file 'vc-working-revision
260 ;; (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2)) 260 ;; (vc-parse-buffer "^\\(new\\|initial\\) revision: \\([0-9.]+\\)" 2))
261 )) 261 ))
262 262
263(defun vc-svn-find-version (file rev buffer) 263(defun vc-svn-find-revision (file rev buffer)
264 "SVN-specific retrieval of a specified version into a buffer." 264 "SVN-specific retrieval of a specified version into a buffer."
265 (apply 'vc-svn-command 265 (apply 'vc-svn-command
266 buffer 0 file 266 buffer 0 file
@@ -281,7 +281,7 @@ This is only possible if SVN is responsible for FILE's directory.")
281 ;; If no revision was specified, there's nothing to do. 281 ;; If no revision was specified, there's nothing to do.
282 nil 282 nil
283 ;; Check out a particular version (or recreate the file). 283 ;; Check out a particular version (or recreate the file).
284 (vc-file-setprop file 'vc-workfile-version nil) 284 (vc-file-setprop file 'vc-working-revision nil)
285 (apply 'vc-svn-command nil 0 file 285 (apply 'vc-svn-command nil 0 file
286 "update" 286 "update"
287 ;; default for verbose checkout: clear the sticky tag so 287 ;; default for verbose checkout: clear the sticky tag so
@@ -321,18 +321,18 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
321(defun vc-svn-merge-news (file) 321(defun vc-svn-merge-news (file)
322 "Merge in any new changes made to FILE." 322 "Merge in any new changes made to FILE."
323 (message "Merging changes into %s..." file) 323 (message "Merging changes into %s..." file)
324 ;; (vc-file-setprop file 'vc-workfile-version nil) 324 ;; (vc-file-setprop file 'vc-working-revision nil)
325 (vc-file-setprop file 'vc-checkout-time 0) 325 (vc-file-setprop file 'vc-checkout-time 0)
326 (vc-svn-command nil 0 file "update") 326 (vc-svn-command nil 0 file "update")
327 ;; Analyze the merge result reported by SVN, and set 327 ;; Analyze the merge result reported by SVN, and set
328 ;; file properties accordingly. 328 ;; file properties accordingly.
329 (with-current-buffer (get-buffer "*vc*") 329 (with-current-buffer (get-buffer "*vc*")
330 (goto-char (point-min)) 330 (goto-char (point-min))
331 ;; get new workfile version 331 ;; get new working revision
332 (if (re-search-forward 332 (if (re-search-forward
333 "^\\(Updated to\\|At\\) revision \\([0-9]+\\)" nil t) 333 "^\\(Updated to\\|At\\) revision \\([0-9]+\\)" nil t)
334 (vc-file-setprop file 'vc-workfile-version (match-string 2)) 334 (vc-file-setprop file 'vc-working-revision (match-string 2))
335 (vc-file-setprop file 'vc-workfile-version nil)) 335 (vc-file-setprop file 'vc-working-revision nil))
336 ;; get file status 336 ;; get file status
337 (goto-char (point-min)) 337 (goto-char (point-min))
338 (prog1 338 (prog1
@@ -393,7 +393,7 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
393 buffer 393 buffer
394 (if (and (= (length files) 1) (vc-stay-local-p (car files)) (fboundp 'start-process)) 'async 0) 394 (if (and (= (length files) 1) (vc-stay-local-p (car files)) (fboundp 'start-process)) 'async 0)
395 files "log" 395 files "log"
396 ;; By default Subversion only shows the log upto the working version, 396 ;; By default Subversion only shows the log upto the working revision,
397 ;; whereas we also want the log of the subsequent commits. At least 397 ;; whereas we also want the log of the subsequent commits. At least
398 ;; that's what the vc-cvs.el code does. 398 ;; that's what the vc-cvs.el code does.
399 "-rHEAD:0"))) 399 "-rHEAD:0")))
@@ -404,11 +404,11 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
404 nil) 404 nil)
405 405
406(defun vc-svn-diff (files &optional oldvers newvers buffer) 406(defun vc-svn-diff (files &optional oldvers newvers buffer)
407 "Get a difference report using SVN between two versions of fileset FILES." 407 "Get a difference report using SVN between two revisions of fileset FILES."
408 (and oldvers 408 (and oldvers
409 (catch 'no 409 (catch 'no
410 (dolist (f files) 410 (dolist (f files)
411 (or (equal oldvers (vc-workfile-version f)) 411 (or (equal oldvers (vc-working-revision f))
412 (throw 'no nil))) 412 (throw 'no nil)))
413 t) 413 t)
414 ;; Use nil rather than the current revision because svn handles 414 ;; Use nil rather than the current revision because svn handles
@@ -446,7 +446,7 @@ The changes are between FIRST-VERSION and SECOND-VERSION."
446;;; 446;;;
447 447
448(defun vc-svn-create-snapshot (dir name branchp) 448(defun vc-svn-create-snapshot (dir name branchp)
449 "Assign to DIR's current version a given NAME. 449 "Assign to DIR's current revision a given NAME.
450If BRANCHP is non-nil, the name is created as a branch (and the current 450If BRANCHP is non-nil, the name is created as a branch (and the current
451workspace is immediately moved to that new branch). 451workspace is immediately moved to that new branch).
452NAME is assumed to be a URL." 452NAME is assumed to be a URL."
@@ -566,7 +566,7 @@ information about FILENAME and return its status."
566 (unless filename (vc-file-setprop file 'vc-backend 'SVN)) 566 (unless filename (vc-file-setprop file 'vc-backend 'SVN))
567 ;; Use the last-modified revision, so that searching in vc-print-log 567 ;; Use the last-modified revision, so that searching in vc-print-log
568 ;; output works. 568 ;; output works.
569 (vc-file-setprop file 'vc-workfile-version (match-string 3)) 569 (vc-file-setprop file 'vc-working-revision (match-string 3))
570 ;; Remember Svn's own status. 570 ;; Remember Svn's own status.
571 (vc-file-setprop file 'vc-svn-status status) 571 (vc-file-setprop file 'vc-svn-status status)
572 (vc-file-setprop 572 (vc-file-setprop
@@ -580,7 +580,7 @@ information about FILENAME and return its status."
580 'up-to-date)) 580 'up-to-date))
581 ((eq status ?A) 581 ((eq status ?A)
582 ;; If the file was actually copied, (match-string 2) is "-". 582 ;; If the file was actually copied, (match-string 2) is "-".
583 (vc-file-setprop file 'vc-workfile-version "0") 583 (vc-file-setprop file 'vc-working-revision "0")
584 (vc-file-setprop file 'vc-checkout-time 0) 584 (vc-file-setprop file 'vc-checkout-time 0)
585 'edited) 585 'edited)
586 ((memq status '(?M ?C)) 586 ((memq status '(?M ?C))
@@ -602,8 +602,8 @@ information about FILENAME and return its status."
602 (and (string-match "^[a-zA-Z]" tag) 602 (and (string-match "^[a-zA-Z]" tag)
603 (not (string-match "[^a-z0-9A-Z-_]" tag)))) 603 (not (string-match "[^a-z0-9A-Z-_]" tag))))
604 604
605(defun vc-svn-valid-version-number-p (tag) 605(defun vc-svn-valid-revision-number-p (tag)
606 "Return non-nil if TAG is a valid version number." 606 "Return non-nil if TAG is a valid revision number."
607 (and (string-match "^[0-9]" tag) 607 (and (string-match "^[0-9]" tag)
608 (not (string-match "[^0-9]" tag)))) 608 (not (string-match "[^0-9]" tag))))
609 609
diff --git a/lisp/vc.el b/lisp/vc.el
index bfcea833c9d..a0db56ce6d7 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -7,6 +7,8 @@
7;; Maintainer: Andre Spiegel <spiegel@gnu.org> 7;; Maintainer: Andre Spiegel <spiegel@gnu.org>
8;; Keywords: tools 8;; Keywords: tools
9 9
10;; $Id$
11
10;; This file is part of GNU Emacs. 12;; This file is part of GNU Emacs.
11 13
12;; GNU Emacs is free software; you can redistribute it and/or modify 14;; GNU Emacs is free software; you can redistribute it and/or modify
@@ -108,7 +110,7 @@
108;; VC keeps some per-file information in the form of properties (see 110;; VC keeps some per-file information in the form of properties (see
109;; vc-file-set/getprop in vc-hooks.el). The backend-specific functions 111;; vc-file-set/getprop in vc-hooks.el). The backend-specific functions
110;; do not generally need to be aware of these properties. For example, 112;; do not generally need to be aware of these properties. For example,
111;; `vc-sys-workfile-version' should compute the focus version and 113;; `vc-sys-working-revision' should compute the working revision and
112;; return it; it should not look it up in the property, and it needn't 114;; return it; it should not look it up in the property, and it needn't
113;; store it there either. However, if a backend-specific function does 115;; store it there either. However, if a backend-specific function does
114;; store a value in a property, that value takes precedence over any 116;; store a value in a property, that value takes precedence over any
@@ -162,19 +164,19 @@
162;; anything, but rather store the files' states into the corresponding 164;; anything, but rather store the files' states into the corresponding
163;; `vc-state' properties. 165;; `vc-state' properties.
164;; 166;;
165;; * workfile-version (file) 167;; * working-revision (file)
166;; 168;;
167;; Return the current focus version of FILE. This is the version fetched 169;; Return the working revision of FILE. This is the revision fetched
168;; by the last checkout or upate, not necessarily the same thing as the 170;; by the last checkout or upate, not necessarily the same thing as the
169;; head or tip version. Should return "0" for a file added but not yet 171;; head or tip revision. Should return "0" for a file added but not yet
170;; committed. 172;; committed.
171;; 173;;
172;; - latest-on-branch-p (file) 174;; - latest-on-branch-p (file)
173;; 175;;
174;; Return non-nil if the focus version of FILE is the latest version 176;; Return non-nil if the working revision of FILE is the latest revision
175;; on its branch (many VCSes call this the 'tip' or 'head' version). 177;; on its branch (many VCSes call this the 'tip' or 'head' revision).
176;; The default implementation always returns t, which means that 178;; The default implementation always returns t, which means that
177;; working with non-current versions is not supported by default. 179;; working with non-current revisions is not supported by default.
178;; 180;;
179;; * checkout-model (file) 181;; * checkout-model (file)
180;; 182;;
@@ -183,13 +185,13 @@
183;; 185;;
184;; - workfile-unchanged-p (file) 186;; - workfile-unchanged-p (file)
185;; 187;;
186;; Return non-nil if FILE is unchanged from the focus version. This 188;; Return non-nil if FILE is unchanged from the working revision.
187;; function should do a brief comparison of FILE's contents with 189;; This function should do a brief comparison of FILE's contents
188;; those of the repository version. If the backend does not have 190;; with those of the repository master of the working revision. If
189;; such a brief-comparison feature, the default implementation of 191;; the backend does not have such a brief-comparison feature, the
190;; this function can be used, which delegates to a full 192;; default implementation of this function can be used, which
191;; vc-BACKEND-diff. (Note that vc-BACKEND-diff must not run 193;; delegates to a full vc-BACKEND-diff. (Note that vc-BACKEND-diff
192;; asynchronously in this case, see variable 194;; must not run asynchronously in this case, see variable
193;; `vc-disable-async-diff'.) 195;; `vc-disable-async-diff'.)
194;; 196;;
195;; - mode-line-string (file) 197;; - mode-line-string (file)
@@ -224,11 +226,11 @@
224;; to the backend command. (Note: in older versions of VC, this 226;; to the backend command. (Note: in older versions of VC, this
225;; command took a single file argument and not a list.) 227;; command took a single file argument and not a list.)
226;; 228;;
227;; - init-version (file) 229;; - init-revision (file)
228;; 230;;
229;; The initial version to use when registering FILE if one is not 231;; The initial revision to use when registering FILE if one is not
230;; specified by the user. If not provided, the variable 232;; specified by the user. If not provided, the variable
231;; vc-default-init-version is used instead. 233;; vc-default-init-revision is used instead.
232;; 234;;
233;; - responsible-p (file) 235;; - responsible-p (file)
234;; 236;;
@@ -265,7 +267,7 @@
265;; the backend command. (Note: in older versions of VC, this 267;; the backend command. (Note: in older versions of VC, this
266;; command took a single file argument and not a list.) 268;; command took a single file argument and not a list.)
267;; 269;;
268;; * find-version (file rev buffer) 270;; * find-revision (file rev buffer)
269;; 271;;
270;; Fetch revision REV of file FILE and put it into BUFFER. 272;; Fetch revision REV of file FILE and put it into BUFFER.
271;; If REV is the empty string, fetch the head of the trunk. 273;; If REV is the empty string, fetch the head of the trunk.
@@ -277,7 +279,7 @@
277;; Check out revision REV of FILE into the working area. If EDITABLE 279;; Check out revision REV of FILE into the working area. If EDITABLE
278;; is non-nil, FILE should be writable by the user and if locking is 280;; is non-nil, FILE should be writable by the user and if locking is
279;; used for FILE, a lock should also be set. If REV is non-nil, that 281;; used for FILE, a lock should also be set. If REV is non-nil, that
280;; is the revision to check out (default is the focus version). 282;; is the revision to check out (default is the working revision).
281;; If REV is t, that means to check out the head of the current branch; 283;; If REV is t, that means to check out the head of the current branch;
282;; if it is the empty string, check out the head of the trunk. 284;; if it is the empty string, check out the head of the trunk.
283;; The implementation should pass the value of vc-checkout-switches 285;; The implementation should pass the value of vc-checkout-switches
@@ -285,15 +287,15 @@
285;; 287;;
286;; * revert (file &optional contents-done) 288;; * revert (file &optional contents-done)
287;; 289;;
288;; Revert FILE back to the current focus version. If optional 290;; Revert FILE back to the working revision. If optional
289;; arg CONTENTS-DONE is non-nil, then the contents of FILE have 291;; arg CONTENTS-DONE is non-nil, then the contents of FILE have
290;; already been reverted from a version backup, and this function 292;; already been reverted from a version backup, and this function
291;; only needs to update the status of FILE within the backend. 293;; only needs to update the status of FILE within the backend.
292;; 294;;
293;; - rollback (files) 295;; - rollback (files)
294;; 296;;
295;; Remove the tip version of each of FILES from the repository. If 297;; Remove the tip revision of each of FILES from the repository. If
296;; this function is not provided, trying to cancel a version is 298;; this function is not provided, trying to cancel a revision is
297;; caught as an error. (Most backends don't provide it.) (Also 299;; caught as an error. (Most backends don't provide it.) (Also
298;; note that older versions of this backend command were called 300;; note that older versions of this backend command were called
299;; 'cancel-version' and took a single file arg, not a list of 301;; 'cancel-version' and took a single file arg, not a list of
@@ -307,9 +309,9 @@
307;; 309;;
308;; Merge recent changes from the current branch into FILE. 310;; Merge recent changes from the current branch into FILE.
309;; 311;;
310;; - steal-lock (file &optional version) 312;; - steal-lock (file &optional revision)
311;; 313;;
312;; Steal any lock on the focus version of FILE, or on VERSION if 314;; Steal any lock on the working revision of FILE, or on REVISION if
313;; that is provided. This function is only needed if locking is 315;; that is provided. This function is only needed if locking is
314;; used for files under this backend, and if files can indeed be 316;; used for files under this backend, and if files can indeed be
315;; locked by other users. 317;; locked by other users.
@@ -328,9 +330,9 @@
328;; `log-view-mode' and is expected to be changed (if at all) to a derived 330;; `log-view-mode' and is expected to be changed (if at all) to a derived
329;; mode of `log-view-mode'. 331;; mode of `log-view-mode'.
330;; 332;;
331;; - show-log-entry (version) 333;; - show-log-entry (revision)
332;; 334;;
333;; If provided, search the log entry for VERSION in the current buffer, 335;; If provided, search the log entry for REVISION in the current buffer,
334;; and make sure it is displayed in the buffer's window. The default 336;; and make sure it is displayed in the buffer's window. The default
335;; implementation of this function works for RCS-style logs. 337;; implementation of this function works for RCS-style logs.
336;; 338;;
@@ -360,13 +362,13 @@
360;; default implementation runs rcs2log, which handles RCS- and 362;; default implementation runs rcs2log, which handles RCS- and
361;; CVS-style logs. 363;; CVS-style logs.
362;; 364;;
363;; * diff (file &optional rev1 rev2 buffer) 365;; * diff (files &optional rev1 rev2 buffer)
364;; 366;;
365;; Insert the diff for FILE into BUFFER, or the *vc-diff* buffer if 367;; Insert the diff for FILE into BUFFER, or the *vc-diff* buffer if
366;; BUFFER is nil. If REV1 and REV2 are non-nil, report differences 368;; BUFFER is nil. If REV1 and REV2 are non-nil, report differences
367;; from REV1 to REV2. If REV1 is nil, use the focus version (as 369;; from REV1 to REV2. If REV1 is nil, use the working revision (as
368;; found in the repository) as the older version; if REV2 is nil, 370;; found in the repository) as the older revision; if REV2 is nil,
369;; use the current working-copy contents as the newer version. This 371;; use the current working-copy contents as the newer revision. This
370;; function should pass the value of (vc-switches BACKEND 'diff) to 372;; function should pass the value of (vc-switches BACKEND 'diff) to
371;; the backend command. It should return a status of either 0 (no 373;; the backend command. It should return a status of either 0 (no
372;; differences found), or 1 (either non-empty diff or the diff is 374;; differences found), or 1 (either non-empty diff or the diff is
@@ -387,7 +389,7 @@
387;; - annotate-command (file buf &optional rev) 389;; - annotate-command (file buf &optional rev)
388;; 390;;
389;; If this function is provided, it should produce an annotated display 391;; If this function is provided, it should produce an annotated display
390;; of FILE in BUF, relative to version REV. Annotation means each line 392;; of FILE in BUF, relative to revision REV. Annotation means each line
391;; of FILE displayed is prefixed with version information associated with 393;; of FILE displayed is prefixed with version information associated with
392;; its addition (deleted lines leave no history) and that the text of the 394;; its addition (deleted lines leave no history) and that the text of the
393;; file is fontified according to age. 395;; file is fontified according to age.
@@ -435,7 +437,7 @@
435;; 437;;
436;; - assign-name (file name) 438;; - assign-name (file name)
437;; 439;;
438;; Give name NAME to the current version of FILE, assuming it is 440;; Give name NAME to the working revision of FILE, assuming it is
439;; up-to-date. Only used by the default version of `create-snapshot'. 441;; up-to-date. Only used by the default version of `create-snapshot'.
440;; 442;;
441;; - retrieve-snapshot (dir name update) 443;; - retrieve-snapshot (dir name update)
@@ -445,13 +447,13 @@
445;; snapshot that are currently visited. The default implementation 447;; snapshot that are currently visited. The default implementation
446;; does a sanity check whether there aren't any uncommitted changes at 448;; does a sanity check whether there aren't any uncommitted changes at
447;; or below DIR, and then performs a tree walk, using the `checkout' 449;; or below DIR, and then performs a tree walk, using the `checkout'
448;; function to retrieve the corresponding versions. 450;; function to retrieve the corresponding revisions.
449;; 451;;
450;; MISCELLANEOUS 452;; MISCELLANEOUS
451;; 453;;
452;; - make-version-backups-p (file) 454;; - make-version-backups-p (file)
453;; 455;;
454;; Return non-nil if unmodified repository versions of FILE should be 456;; Return non-nil if unmodified repository revisions of FILE should be
455;; backed up locally. If this is done, VC can perform `diff' and 457;; backed up locally. If this is done, VC can perform `diff' and
456;; `revert' operations itself, without calling the backend system. The 458;; `revert' operations itself, without calling the backend system. The
457;; default implementation always returns nil. 459;; default implementation always returns nil.
@@ -464,15 +466,15 @@
464;; This function is used in `vc-stay-local-p' which backends can use 466;; This function is used in `vc-stay-local-p' which backends can use
465;; for their convenience. 467;; for their convenience.
466;; 468;;
467;; - previous-version (file rev) 469;; - previous-revision (file rev)
468;; 470;;
469;; Return the version number that precedes REV for FILE, or nil if no such 471;; Return the revision number that precedes REV for FILE, or nil if no such
470;; version exists. 472;; revision exists.
471;; 473;;
472;; - next-version (file rev) 474;; - next-revision (file rev)
473;; 475;;
474;; Return the version number that follows REV for FILE, or nil if no such 476;; Return the revision number that follows REV for FILE, or nil if no such
475;; version exists. 477;; revision exists.
476;; 478;;
477;; - check-headers () 479;; - check-headers ()
478;; 480;;
@@ -557,8 +559,8 @@ preserve the setting."
557 :type 'boolean 559 :type 'boolean
558 :group 'vc) 560 :group 'vc)
559 561
560(defcustom vc-default-init-version "1.1" 562(defcustom vc-default-init-revision "1.1"
561 "A string used as the default version number when a new file is registered. 563 "A string used as the default revision number when a new file is registered.
562This can be overridden by giving a prefix argument to \\[vc-register]. This 564This can be overridden by giving a prefix argument to \\[vc-register]. This
563can also be overridden by a particular VC backend." 565can also be overridden by a particular VC backend."
564 :type 'string 566 :type 'string
@@ -776,9 +778,9 @@ List of factors, used to expand/compress the time scale. See `vc-annotate'."
776 (define-key m "D" 'vc-annotate-show-diff-revision-at-line) 778 (define-key m "D" 'vc-annotate-show-diff-revision-at-line)
777 (define-key m "J" 'vc-annotate-revision-at-line) 779 (define-key m "J" 'vc-annotate-revision-at-line)
778 (define-key m "L" 'vc-annotate-show-log-revision-at-line) 780 (define-key m "L" 'vc-annotate-show-log-revision-at-line)
779 (define-key m "N" 'vc-annotate-next-version) 781 (define-key m "N" 'vc-annotate-next-revision)
780 (define-key m "P" 'vc-annotate-prev-version) 782 (define-key m "P" 'vc-annotate-prev-revision)
781 (define-key m "W" 'vc-annotate-focus-version) 783 (define-key m "W" 'vc-annotate-working-revision)
782 m) 784 m)
783 "Local keymap used for VC-Annotate mode.") 785 "Local keymap used for VC-Annotate mode.")
784 786
@@ -835,8 +837,8 @@ and that its contents match what the master file says."
835Backends that offer asynchronous diffs should respect this variable 837Backends that offer asynchronous diffs should respect this variable
836in their implementation of vc-BACKEND-diff.") 838in their implementation of vc-BACKEND-diff.")
837 839
838(defvar vc-log-file) 840(defvar vc-log-fileset)
839(defvar vc-log-version) 841(defvar vc-log-revision)
840 842
841(defvar vc-dired-mode nil) 843(defvar vc-dired-mode nil)
842(make-variable-buffer-local 'vc-dired-mode) 844(make-variable-buffer-local 'vc-dired-mode)
@@ -848,20 +850,21 @@ in their implementation of vc-BACKEND-diff.")
848 (interactive) 850 (interactive)
849 (fillarray vc-file-prop-obarray 0)) 851 (fillarray vc-file-prop-obarray 0))
850 852
851(defmacro with-vc-properties (file form settings) 853(defmacro with-vc-properties (files form settings)
852 "Execute FORM, then maybe set per-file properties for FILE. 854 "Execute FORM, then maybe set per-file properties for FILES.
853SETTINGS is an association list of property/value pairs. After 855SETTINGS is an association list of property/value pairs. After
854executing FORM, set those properties from SETTINGS that have not yet 856executing FORM, set those properties from SETTINGS that have not yet
855been updated to their corresponding values." 857been updated to their corresponding values."
856 (declare (debug t)) 858 (declare (debug t))
857 `(let ((vc-touched-properties (list t))) 859 `(let ((vc-touched-properties (list t)))
858 ,form 860 ,form
859 (mapcar (lambda (setting) 861 (dolist (file ,files)
862 (mapc (lambda (setting)
860 (let ((property (car setting))) 863 (let ((property (car setting)))
861 (unless (memq property vc-touched-properties) 864 (unless (memq property vc-touched-properties)
862 (put (intern ,file vc-file-prop-obarray) 865 (put (intern file vc-file-prop-obarray)
863 property (cdr setting))))) 866 property (cdr setting)))))
864 ,settings))) 867 ,settings))))
865 868
866;; Two macros for elisp programming 869;; Two macros for elisp programming
867 870
@@ -885,7 +888,7 @@ somebody else, signal error."
885 (vc-checkout ,filevar t)))) 888 (vc-checkout ,filevar t))))
886 (save-excursion 889 (save-excursion
887 ,@body) 890 ,@body)
888 (vc-checkin ,filevar nil ,comment)))) 891 (vc-checkin (list ,filevar) nil ,comment))))
889 892
890;;;###autoload 893;;;###autoload
891(defmacro edit-vc-file (file comment &rest body) 894(defmacro edit-vc-file (file comment &rest body)
@@ -988,7 +991,7 @@ Else, add CODE to the process' sentinel."
988(defvar vc-post-command-functions nil 991(defvar vc-post-command-functions nil
989 "Hook run at the end of `vc-do-command'. 992 "Hook run at the end of `vc-do-command'.
990Each function is called inside the buffer in which the command was run 993Each function is called inside the buffer in which the command was run
991and is passed 3 arguments: the COMMAND, the FILE and the FLAGS.") 994and is passed 3 arguments: the COMMAND, the FILES and the FLAGS.")
992 995
993(defvar w32-quote-process-args) 996(defvar w32-quote-process-args)
994 997
@@ -1016,10 +1019,17 @@ that is inserted into the command line before the filename."
1016 (let* ((files 1019 (let* ((files
1017 (mapcar (lambda (f) (file-relative-name (expand-file-name f))) 1020 (mapcar (lambda (f) (file-relative-name (expand-file-name f)))
1018 (if (listp file-or-list) file-or-list (list file-or-list)))) 1021 (if (listp file-or-list) file-or-list (list file-or-list))))
1019 (full-command 1022 (full-command
1020 (concat command " " (vc-delistify flags) " " (vc-delistify files)))) 1023 ;; What we're doing here is preparing a version of the command
1021 (if vc-command-messages 1024 ;; for display in a debug-progess message. If it's fewer than
1022 (message "Running %s..." full-command)) 1025 ;; 20 characters display the entire command (without trailing
1026 ;; newline). Otherwise display the first 20 followed by an ellipsis.
1027 (concat (if (string= (substring command -1) "\n")
1028 (substring command 0 -1)
1029 command)
1030 " "
1031 (vc-delistify (mapcar (lambda (s) (if (> (length s) 20) (concat (substring s 0 2) "...") s)) flags))
1032 " " (vc-delistify files))))
1023 (save-current-buffer 1033 (save-current-buffer
1024 (unless (or (eq buffer t) 1034 (unless (or (eq buffer t)
1025 (and (stringp buffer) 1035 (and (stringp buffer)
@@ -1048,13 +1058,16 @@ that is inserted into the command line before the filename."
1048 (let ((process-connection-type nil)) 1058 (let ((process-connection-type nil))
1049 (apply 'start-process command (current-buffer) command 1059 (apply 'start-process command (current-buffer) command
1050 squeezed)))) 1060 squeezed))))
1051 (unless (active-minibuffer-window) 1061 (if vc-command-messages
1052 (message "Running %s in the background..." full-command)) 1062 (message "Running %s in background..." full-command))
1053 ;;(set-process-sentinel proc (lambda (p msg) (delete-process p))) 1063 ;;(set-process-sentinel proc (lambda (p msg) (delete-process p)))
1054 (set-process-filter proc 'vc-process-filter) 1064 (set-process-filter proc 'vc-process-filter)
1055 (vc-exec-after 1065 (vc-exec-after
1056 `(unless (active-minibuffer-window) 1066 `(if vc-command-messages
1057 (message "Running %s in the background... done" ',full-command)))) 1067 (message "Running %s in background... done" ',full-command))))
1068 ;; Run synchrously
1069 (if vc-command-messages
1070 (message "Running %s in foreground..." full-command))
1058 (let ((buffer-undo-list t)) 1071 (let ((buffer-undo-list t))
1059 (setq status (apply 'process-file command nil t nil squeezed))) 1072 (setq status (apply 'process-file command nil t nil squeezed)))
1060 (when (and (not (eq t okstatus)) 1073 (when (and (not (eq t okstatus))
@@ -1065,11 +1078,12 @@ that is inserted into the command line before the filename."
1065 (shrink-window-if-larger-than-buffer) 1078 (shrink-window-if-larger-than-buffer)
1066 (error "Running %s...FAILED (%s)" full-command 1079 (error "Running %s...FAILED (%s)" full-command
1067 (if (integerp status) (format "status %d" status) status)))) 1080 (if (integerp status) (format "status %d" status) status))))
1081 ;; We're done
1068 (if vc-command-messages 1082 (if vc-command-messages
1069 (message "Running %s...OK" full-command))) 1083 (message "Running %s...OK = %d" full-command status)))
1070 (vc-exec-after 1084 (vc-exec-after
1071 `(run-hook-with-args 'vc-post-command-functions 1085 `(run-hook-with-args 'vc-post-command-functions
1072 ',command ',file-or-list ',flags)) 1086 ',command ',file-or-list ',flags))
1073 status)))) 1087 status))))
1074 1088
1075(defun vc-position-context (posn) 1089(defun vc-position-context (posn)
@@ -1186,6 +1200,8 @@ CONTEXT is that which `vc-buffer-context' returns."
1186 (let ((new-mark (vc-find-position-by-context mark-context))) 1200 (let ((new-mark (vc-find-position-by-context mark-context)))
1187 (if new-mark (set-mark new-mark)))))) 1201 (if new-mark (set-mark new-mark))))))
1188 1202
1203;;; Code for deducing what fileset and backend to assume
1204
1189(defun vc-responsible-backend (file &optional register) 1205(defun vc-responsible-backend (file &optional register)
1190 "Return the name of a backend system that is responsible for FILE. 1206 "Return the name of a backend system that is responsible for FILE.
1191The optional argument REGISTER means that a backend suitable for 1207The optional argument REGISTER means that a backend suitable for
@@ -1234,6 +1250,49 @@ Only files already under version control are noticed."
1234 node (lambda (f) (if (vc-backend f) (push f flattened))))) 1250 node (lambda (f) (if (vc-backend f) (push f flattened)))))
1235 (nreverse flattened))) 1251 (nreverse flattened)))
1236 1252
1253(defun vc-deduce-fileset (&optional allow-directory-wildcard)
1254 "Deduce a set of files and a backend to apply an operation to.
1255
1256If we're in VC-dired-mode, the fileset is the list of marked
1257files. Otherwise, if we're looking at a buffer visiting a
1258version-controlled file. the fileset is a singleton containing
1259the relative filename, throw an error.
1260
1261If neither of these things is true, but allow-directory-wildcard is on,
1262select all files under version control at and below the current
1263directory.
1264
1265Otherwise, throw an error.
1266"
1267 (cond (vc-dired-mode
1268 (let ((regexp (dired-marker-regexp))
1269 (marked (dired-map-over-marks (dired-get-filename) nil)))
1270 (unless marked
1271 (error "No files have been selected."))
1272 ;; All members of the fileset must have the same backend
1273 (let ((firstbackend (vc-backend (car marked))))
1274 (mapc (lambda (f) (unless (eq (vc-backend f) firstbackend)
1275 (error "All members of a fileset must be under the same version-control system.")))
1276 (cdr marked)))
1277 marked))
1278 ((vc-backend buffer-file-name)
1279 (list buffer-file-name))
1280 ((and vc-parent-buffer (buffer-file-name vc-parent-buffer))
1281 (progn
1282 (set-buffer vc-parent-buffer)
1283 (vc-deduce-fileset)))
1284 ;; This is guarded by an enabling arg so users won't potentially
1285 ;; shoot themselves in the foot by modifying a fileset they can't
1286 ;; verify by eyeball. Allow it for nondestructive commands like
1287 ;; making diffs, or possibly for destructive ones that have
1288 ;; confirmation prompts.
1289 (allow-directory-wildcard
1290 (progn
1291 (message "All version-controlled files below %s selected."
1292 default-directory)
1293 (list default-directory)))
1294 (t (error "No fileset is available here."))))
1295
1237(defun vc-ensure-vc-buffer () 1296(defun vc-ensure-vc-buffer ()
1238 "Make sure that the current buffer visits a version-controlled file." 1297 "Make sure that the current buffer visits a version-controlled file."
1239 (if vc-dired-mode 1298 (if vc-dired-mode
@@ -1255,7 +1314,7 @@ Only files already under version control are noticed."
1255 1314
1256(defun vc-revert-buffer-internal (&optional arg no-confirm) 1315(defun vc-revert-buffer-internal (&optional arg no-confirm)
1257 "Revert buffer, keeping point and mark where user expects them. 1316 "Revert buffer, keeping point and mark where user expects them.
1258Try to be clever in the face of changes due to expanded version control 1317Try to be clever in the face of changes due to expanded version-control
1259key words. This is important for typeahead to work as expected. 1318key words. This is important for typeahead to work as expected.
1260ARG and NO-CONFIRM are passed on to `revert-buffer'." 1319ARG and NO-CONFIRM are passed on to `revert-buffer'."
1261 (interactive "P") 1320 (interactive "P")
@@ -1287,192 +1346,170 @@ NOT-URGENT means it is ok to continue if the user says not to save."
1287 1346
1288;;;###autoload 1347;;;###autoload
1289(defun vc-next-action (verbose) 1348(defun vc-next-action (verbose)
1290 "Do the next logical version control operation on the current file. 1349 "Do the next logical version control operation on the current fileset.
1291 1350This requires that all files in the fileset be in the same state.
1292If you call this from within a VC dired buffer with no files marked,
1293it will operate on the file in the current line.
1294
1295If you call this from within a VC dired buffer, and one or more
1296files are marked, it will accept a log message and then operate on
1297each one. The log message will be used as a comment for any register
1298or checkin operations, but ignored when doing checkouts. Attempted
1299lock steals will raise an error.
1300 1351
1301A prefix argument lets you specify the version number to use. 1352For locking systems:
1302 1353 If every file is not already registered, this registers each for version
1303For RCS and SCCS files:
1304 If the file is not already registered, this registers it for version
1305control. 1354control.
1306 If the file is registered and not locked by anyone, this checks out 1355 If every file is registered and not locked by anyone, this checks out
1307a writable and locked file ready for editing. 1356a writable and locked file of each ready for editing.
1308 If the file is checked out and locked by the calling user, this 1357 If every file is checked out and locked by the calling user, this
1309first checks to see if the file has changed since checkout. If not, 1358first checks to see if each file has changed since checkout. If not,
1310it performs a revert. 1359it performs a revert on that file.
1311 If the file has been changed, this pops up a buffer for entry 1360 If every file has been changed, this pops up a buffer for entry
1312of a log message; when the message has been entered, it checks in the 1361of a log message; when the message has been entered, it checks in the
1313resulting changes along with the log message as change commentary. If 1362resulting changes along with the log message as change commentary. If
1314the variable `vc-keep-workfiles' is non-nil (which is its default), a 1363the variable `vc-keep-workfiles' is non-nil (which is its default), a
1315read-only copy of the changed file is left in place afterwards. 1364read-only copy of each changed file is left in place afterwards.
1316 If the file is registered and locked by someone else, you are given 1365 If the affected file is registered and locked by someone else, you are
1317the option to steal the lock. 1366given the option to steal the lock(s).
1318 1367
1319For CVS files: 1368For merging systems:
1320 If the file is not already registered, this registers it for version 1369 If every file is not already registered, this registers each one for version
1321control. This does a \"cvs add\", but no \"cvs commit\". 1370control. This does an add, but not a commit.
1322 If the file is added but not committed, it is committed. 1371 If every file is added but not committed, each one is committed.
1323 If your working file is changed, but the repository file is 1372 If every working file is changed, but the corresponding repository file is
1324unchanged, this pops up a buffer for entry of a log message; when the 1373unchanged, this pops up a buffer for entry of a log message; when the
1325message has been entered, it checks in the resulting changes along 1374message has been entered, it checks in the resulting changes along
1326with the logmessage as change commentary. A writable file is retained. 1375with the logmessage as change commentary. A writable file is retained.
1327 If the repository file is changed, you are asked if you want to 1376 If the repository file is changed, you are asked if you want to
1328merge in the changes into your working copy." 1377merge in the changes into your working copy."
1329 (interactive "P") 1378 (interactive "P")
1330 (catch 'nogo 1379 (let* ((files (vc-deduce-fileset))
1331 (if vc-dired-mode 1380 (backend (vc-backend (car files)))
1332 (let ((files (dired-get-marked-files))) 1381 (state (vc-state (car files)))
1333 (set (make-local-variable 'vc-dired-window-configuration) 1382 (model (vc-checkout-model (car files)))
1334 (current-window-configuration)) 1383 revision)
1335 (if (string= "" 1384 ;; Verify that the fileset is homogenous
1336 (mapconcat 1385 (dolist (file (cdr files))
1337 (lambda (f) 1386 (if (not (eq (vc-state file) state))
1338 (if (not (vc-up-to-date-p f)) "@" "")) 1387 (error "Fileset is in a mixed-up state"))
1339 files "")) 1388 (if (not (eq (vc-checkout-model file) model))
1340 (vc-next-action-dired nil nil "dummy") 1389 (error "Fileset has mixed checkout models")))
1341 (vc-start-entry nil nil nil nil 1390 ;; Check for buffers in the fileset not matching the on-disk contents.
1342 "Enter a change comment for the marked files." 1391 (dolist (file files)
1343 'vc-next-action-dired)) 1392 (let ((visited (get-file-buffer file)))
1344 (throw 'nogo nil))) 1393 (when visited
1345 (while vc-parent-buffer 1394 (if vc-dired-mode
1346 (pop-to-buffer vc-parent-buffer)) 1395 (switch-to-buffer-other-window visited)
1347 (if buffer-file-name 1396 (set-buffer visited))
1348 (vc-next-action-on-file buffer-file-name verbose) 1397 ;; Check relation of buffer and file, and make sure
1349 (error "Buffer %s is not associated with a file" (buffer-name))))) 1398 ;; user knows what he's doing. First, finding the file
1350 1399 ;; will check whether the file on disk is newer.
1351;; These functions help the vc-next-action entry point 1400 ;; Ignore buffer-read-only during this test, and
1352 1401 ;; preserve find-file-literally.
1353(defun vc-next-action-on-file (file verbose &optional comment) 1402 (let ((buffer-read-only (not (file-writable-p file))))
1354 "Do The Right Thing for a given FILE under version control. 1403 (find-file-noselect file nil find-file-literally))
1355If COMMENT is specified, it will be used as an admin or checkin comment. 1404 (if (not (verify-visited-file-modtime (current-buffer)))
1356If VERBOSE is non-nil, query the user rather than using default parameters." 1405 (if (yes-or-no-p (format "Replace %s on disk with buffer contents? " file))
1357 (let ((visited (get-file-buffer file)) 1406 (write-file buffer-file-name)
1358 state version) 1407 (error "Aborted"))
1359 (when visited 1408 ;; Now, check if we have unsaved changes.
1360 (if vc-dired-mode 1409 (vc-buffer-sync t)
1361 (switch-to-buffer-other-window visited) 1410 (if (buffer-modified-p)
1362 (set-buffer visited)) 1411 (or (y-or-n-p (message "Use %s on disk, keeping modified buffer? " file))
1363 ;; Check relation of buffer and file, and make sure 1412 (error "Aborted")))))))
1364 ;; user knows what he's doing. First, finding the file
1365 ;; will check whether the file on disk is newer.
1366 ;; Ignore buffer-read-only during this test, and
1367 ;; preserve find-file-literally.
1368 (let ((buffer-read-only (not (file-writable-p file))))
1369 (find-file-noselect file nil find-file-literally))
1370 (if (not (verify-visited-file-modtime (current-buffer)))
1371 (if (yes-or-no-p "Replace file on disk with buffer contents? ")
1372 (write-file buffer-file-name)
1373 (error "Aborted"))
1374 ;; Now, check if we have unsaved changes.
1375 (vc-buffer-sync t)
1376 (if (buffer-modified-p)
1377 (or (y-or-n-p "Operate on disk file, keeping modified buffer? ")
1378 (error "Aborted")))))
1379
1380 ;; Do the right thing 1413 ;; Do the right thing
1381 (if (not (vc-registered file)) 1414 (cond
1382 (vc-register verbose comment) 1415 ;; Files aren't registered
1383 (vc-recompute-state file) 1416 ((not state)
1384 (if visited (vc-mode-line file)) 1417 (mapc 'vc-register files))
1385 (setq state (vc-state file)) 1418 ;; Files are up-to-date, or need a merge and user specified a revision
1419 ((or (eq state 'up-to-date) (and verbose (eq state 'needs-patch)))
1386 (cond 1420 (cond
1387 ;; up-to-date 1421 (verbose
1388 ((or (eq state 'up-to-date) 1422 ;; go to a different revision
1389 (and verbose (eq state 'needs-patch))) 1423 (setq revision (read-string "Branch, revision, or backend to move to: "))
1390 (cond 1424 (let ((vsym (intern-soft (upcase revision))))
1391 (verbose 1425 (if (member vsym vc-handled-backends)
1392 ;; go to a different version 1426 (mapc (lambda (file) (vc-transfer-file file vsym)) files)
1393 (setq version 1427 (mapc (lambda (file)
1394 (read-string "Branch, version, or backend to move to: ")) 1428 (vc-checkout file (eq model 'implicit) revision))))))
1395 (let ((vsym (intern-soft (upcase version)))) 1429 ((not (eq model 'implicit))
1396 (if (member vsym vc-handled-backends) 1430 ;; check the files out
1397 (vc-transfer-file file vsym) 1431 (mapc (lambda (file) (vc-checkout file t)) files))
1398 (vc-checkout file (eq (vc-checkout-model file) 'implicit) 1432 (t
1399 version)))) 1433 ;; do nothing
1400 ((not (eq (vc-checkout-model file) 'implicit)) 1434 (message "Fileset is up-to-date"))))
1401 ;; check the file out 1435 ;; Files have local changes
1402 (vc-checkout file t)) 1436 ((eq state 'edited)
1403 (t 1437 (let ((ready-for-commit files))
1404 ;; do nothing 1438 ;; If files are edited but read-only, give user a chance to correct
1405 (message "%s is up-to-date" file)))) 1439 (dolist (file files)
1406 1440 (if (not (file-writable-p file))
1407 ;; Abnormal: edited but read-only 1441 (progn
1408 ((and visited (eq state 'edited) 1442 ;; Make the file+buffer read-write.
1409 buffer-read-only (not (file-writable-p file))) 1443 (unless (y-or-n-p (format "%s is edited but read-only; make it writable and continue?" file))
1410 ;; Make the file+buffer read-write. If the user really wanted to 1444 (error "Aborted"))
1411 ;; commit, he'll get a chance to do that next time around, anyway. 1445 (set-file-modes file (logior (file-modes file) 128))
1412 (message "File is edited but read-only; making it writable") 1446 (let ((visited (get-file-buffer file)))
1413 (set-file-modes buffer-file-name 1447 (if visited
1414 (logior (file-modes buffer-file-name) 128)) 1448 (save-excursion
1415 (toggle-read-only -1)) 1449 (set-buffer visited)
1416 1450 (toggle-read-only -1)))))))
1417 ;; edited 1451 ;; Allow user to revert files with no changes
1418 ((eq state 'edited) 1452 (save-excursion
1419 (cond 1453 (let ((revertlist '()))
1420 ;; For files with locking, if the file does not contain 1454 (dolist (file files)
1421 ;; any changes, just let go of the lock, i.e. revert. 1455 (let ((visited (get-file-buffer file)))
1422 ((and (not (eq (vc-checkout-model file) 'implicit)) 1456 ;; For files with locking, if the file does not contain
1423 (vc-workfile-unchanged-p file) 1457 ;; any changes, just let go of the lock, i.e. revert.
1424 ;; If buffer is modified, that means the user just 1458 (if (and (not (eq model 'implicit))
1425 ;; said no to saving it; in that case, don't revert, 1459 (vc-workfile-unchanged-p file)
1426 ;; because the user might intend to save after 1460 ;; If buffer is modified, that means the user just
1427 ;; finishing the log entry. 1461 ;; said no to saving it; in that case, don't revert,
1428 (not (and visited (buffer-modified-p)))) 1462 ;; because the user might intend to save after
1429 ;; DO NOT revert the file without asking the user! 1463 ;; finishing the log entry and committing.
1430 (if (not visited) (find-file-other-window file)) 1464 (not (and visited (buffer-modified-p))))
1431 (if (yes-or-no-p "Revert to master version? ") 1465 (progn
1432 (vc-revert))) 1466 (vc-revert-file file)
1433 (t ;; normal action 1467 (delete file ready-for-commit)))))))
1468 ;; Remaining files need to be committed
1469 (if (not ready-for-commit)
1470 (message "No files remain to be committed")
1434 (if (not verbose) 1471 (if (not verbose)
1435 (vc-checkin file nil comment) 1472 (vc-checkin ready-for-commit)
1436 (setq version (read-string "New version or backend: ")) 1473 (progn
1437 (let ((vsym (intern (upcase version)))) 1474 (setq revision (read-string "New revision or backend: "))
1438 (if (member vsym vc-handled-backends) 1475 (let ((vsym (intern (upcase revision))))
1439 (vc-transfer-file file vsym) 1476 (if (member vsym vc-handled-backends)
1440 (vc-checkin file version comment))))))) 1477 (vc-transfer-file file vsym)
1441 1478 (vc-checkin ready-for-commit revision))))))))
1442 ;; locked by somebody else 1479 ;; locked by somebody else (locking VCSes only)
1443 ((stringp state) 1480 ((stringp state)
1444 (if comment 1481 (let ((revision
1445 (error "Sorry, you can't steal the lock on %s this way" 1482 (if verbose
1446 (file-name-nondirectory file))) 1483 (read-string "Revision to steal: ")
1447 (vc-steal-lock file 1484 (vc-working-revision file))))
1448 (if verbose (read-string "Version to steal: ") 1485 (mapc (lambda (file) (vc-steal-lock file revision state) files))))
1449 (vc-workfile-version file)) 1486 ;; needs-patch
1450 state)) 1487 ((eq state 'needs-patch)
1451 1488 (dolist (file files)
1452 ;; needs-patch
1453 ((eq state 'needs-patch)
1454 (if (yes-or-no-p (format 1489 (if (yes-or-no-p (format
1455 "%s is not up-to-date. Get latest version? " 1490 "%s is not up-to-date. Get latest revision? "
1456 (file-name-nondirectory file))) 1491 (file-name-nondirectory file)))
1457 (vc-checkout file (eq (vc-checkout-model file) 'implicit) t) 1492 (vc-checkout file (eq model 'implicit) t)
1458 (if (and (not (eq (vc-checkout-model file) 'implicit)) 1493 (if (and (not (eq model 'implicit))
1459 (yes-or-no-p "Lock this version? ")) 1494 (yes-or-no-p "Lock this revision? "))
1460 (vc-checkout file t) 1495 (vc-checkout file t)))))
1461 (error "Aborted")))) 1496 ;; needs-merge
1462 1497 ((eq state 'needs-merge)
1463 ;; needs-merge 1498 (dolist (file files)
1464 ((eq state 'needs-merge)
1465 (if (yes-or-no-p (format 1499 (if (yes-or-no-p (format
1466 "%s is not up-to-date. Merge in changes now? " 1500 "%s is not up-to-date. Merge in changes now? "
1467 (file-name-nondirectory file))) 1501 (file-name-nondirectory file)))
1468 (vc-maybe-resolve-conflicts file (vc-call merge-news file)) 1502 (vc-maybe-resolve-conflicts file (vc-call merge-news file)))))
1469 (error "Aborted")))
1470 1503
1471 ;; unlocked-changes 1504 ;; unlocked-changes
1472 ((eq state 'unlocked-changes) 1505 ((eq state 'unlocked-changes)
1473 (if (not visited) (find-file-other-window file)) 1506 (dolist (file files)
1507 (if (not (equal buffer-file-name file))
1508 (find-file-other-window file))
1474 (if (save-window-excursion 1509 (if (save-window-excursion
1475 (vc-version-diff file (vc-workfile-version file) nil) 1510 (vc-diff-internal
1511 (vc-backend file) nil (list file)
1512 (vc-working-revision file) nil)
1476 (goto-char (point-min)) 1513 (goto-char (point-min))
1477 (let ((inhibit-read-only t)) 1514 (let ((inhibit-read-only t))
1478 (insert 1515 (insert
@@ -1488,25 +1525,11 @@ If VERBOSE is non-nil, query the user rather than using default parameters."
1488 (write-file buffer-file-name) 1525 (write-file buffer-file-name)
1489 (vc-mode-line file)) 1526 (vc-mode-line file))
1490 (if (not (yes-or-no-p 1527 (if (not (yes-or-no-p
1491 "Revert to checked-in version, instead? ")) 1528 "Revert to checked-in revision, instead? "))
1492 (error "Checkout aborted") 1529 (error "Checkout aborted")
1493 (vc-revert-buffer-internal t t) 1530 (vc-revert-buffer-internal t t)
1494 (vc-checkout file t)))))))) 1531 (vc-checkout file t))))))))
1495 1532
1496(defun vc-next-action-dired (file rev comment)
1497 "Call `vc-next-action-on-file' on all the marked files.
1498Ignores FILE and REV, but passes on COMMENT."
1499 (let ((dired-buffer (current-buffer)))
1500 (dired-map-over-marks
1501 (let ((file (dired-get-filename)))
1502 (message "Processing %s..." file)
1503 (vc-next-action-on-file file nil comment)
1504 (set-buffer dired-buffer)
1505 (set-window-configuration vc-dired-window-configuration)
1506 (message "Processing %s...done" file))
1507 nil t))
1508 (dired-move-to-filename))
1509
1510(defun vc-create-repo (backend) 1533(defun vc-create-repo (backend)
1511 "Create an empty repository in the current directory." 1534 "Create an empty repository in the current directory."
1512 (interactive 1535 (interactive
@@ -1520,9 +1543,9 @@ Ignores FILE and REV, but passes on COMMENT."
1520 (vc-call-backend backend 'create-repo)) 1543 (vc-call-backend backend 'create-repo))
1521 1544
1522;;;###autoload 1545;;;###autoload
1523(defun vc-register (&optional set-version comment) 1546(defun vc-register (&optional set-revision comment)
1524 "Register the current file into a version control system. 1547 "Register the current file into a version control system.
1525With prefix argument SET-VERSION, allow user to specify initial version 1548With prefix argument SET-REVISION, allow user to specify initial revision
1526level. If COMMENT is present, use that as an initial comment. 1549level. If COMMENT is present, use that as an initial comment.
1527 1550
1528The version control system to use is found by cycling through the list 1551The version control system to use is found by cycling through the list
@@ -1546,26 +1569,34 @@ first backend that could register the file is used."
1546 (set-buffer-modified-p t)) 1569 (set-buffer-modified-p t))
1547 (vc-buffer-sync) 1570 (vc-buffer-sync)
1548 1571
1549 (vc-start-entry buffer-file-name 1572 (vc-start-entry (list buffer-file-name)
1550 (if set-version 1573 (if set-revision
1551 (read-string (format "Initial version level for %s: " 1574 (read-string (format "Initial revision level for %s: "
1552 (buffer-name))) 1575 (buffer-name)))
1553 (vc-call-backend (vc-responsible-backend buffer-file-name) 1576 (vc-call-backend (vc-responsible-backend buffer-file-name)
1554 'init-version)) 1577 'init-revision))
1555 (or comment (not vc-initial-comment)) 1578 (or comment (not vc-initial-comment))
1556 nil 1579 nil
1557 "Enter initial comment." 1580 "Enter initial comment."
1558 (lambda (file rev comment) 1581 (lambda (files rev comment)
1559 (message "Registering %s... " file) 1582 (dolist (file files)
1560 (let ((backend (vc-responsible-backend file t))) 1583 (message "Registering %s... " file)
1561 (vc-file-clearprops file) 1584 (let ((backend (vc-responsible-backend file t)))
1562 (vc-call-backend backend 'register (list file) rev comment) 1585 (vc-file-clearprops file)
1563 (vc-file-setprop file 'vc-backend backend) 1586 (vc-call-backend backend 'register (list file) rev comment)
1564 (unless vc-make-backup-files 1587 (vc-file-setprop file 'vc-backend backend)
1565 (make-local-variable 'backup-inhibited) 1588 (unless vc-make-backup-files
1566 (setq backup-inhibited t))) 1589 (make-local-variable 'backup-inhibited)
1567 (message "Registering %s... done" file)))) 1590 (setq backup-inhibited t)))
1568 1591 (message "Registering %s... done" file)))))
1592
1593(defun vc-register-with (backend)
1594 "Register the current file with a specified back end."
1595 (interactive "SBackend: ")
1596 (if (not (member backend vc-handled-backends))
1597 (error "Unknown back end."))
1598 (let ((vc-handled-backends (list backend)))
1599 (call-interactively 'vc-register)))
1569 1600
1570(defun vc-resynch-window (file &optional keep noquery) 1601(defun vc-resynch-window (file &optional keep noquery)
1571 "If FILE is in the current buffer, either revert or unvisit it. 1602 "If FILE is in the current buffer, either revert or unvisit it.
@@ -1602,8 +1633,8 @@ rather than user editing!"
1602 (vc-resynch-window file keep noquery))))) 1633 (vc-resynch-window file keep noquery)))))
1603 (vc-dired-resynch-file file)) 1634 (vc-dired-resynch-file file))
1604 1635
1605(defun vc-start-entry (file rev comment initial-contents msg action &optional after-hook) 1636(defun vc-start-entry (files rev comment initial-contents msg action &optional after-hook)
1606 "Accept a comment for an operation on FILE revision REV. 1637 "Accept a comment for an operation on FILES revision REV.
1607If COMMENT is nil, pop up a VC-log buffer, emit MSG, and set the 1638If COMMENT is nil, pop up a VC-log buffer, emit MSG, and set the
1608action on close to ACTION. If COMMENT is a string and 1639action on close to ACTION. If COMMENT is a string and
1609INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial 1640INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial
@@ -1613,9 +1644,12 @@ entered COMMENT. If COMMENT is t, also do action immediately with an
1613empty comment. Remember the file's buffer in `vc-parent-buffer' 1644empty comment. Remember the file's buffer in `vc-parent-buffer'
1614\(current one if no file). AFTER-HOOK specifies the local value 1645\(current one if no file). AFTER-HOOK specifies the local value
1615for vc-log-operation-hook." 1646for vc-log-operation-hook."
1616 (let ((parent (or (and file (get-file-buffer file)) (current-buffer)))) 1647 (let ((parent
1648 (if (and files (equal (length files) 1))
1649 (get-file-buffer (car files))
1650 (current-buffer))))
1617 (if vc-before-checkin-hook 1651 (if vc-before-checkin-hook
1618 (if file 1652 (if files
1619 (with-current-buffer parent 1653 (with-current-buffer parent
1620 (run-hooks 'vc-before-checkin-hook)) 1654 (run-hooks 'vc-before-checkin-hook))
1621 (run-hooks 'vc-before-checkin-hook))) 1655 (run-hooks 'vc-before-checkin-hook)))
@@ -1625,13 +1659,13 @@ for vc-log-operation-hook."
1625 (set (make-local-variable 'vc-parent-buffer) parent) 1659 (set (make-local-variable 'vc-parent-buffer) parent)
1626 (set (make-local-variable 'vc-parent-buffer-name) 1660 (set (make-local-variable 'vc-parent-buffer-name)
1627 (concat " from " (buffer-name vc-parent-buffer))) 1661 (concat " from " (buffer-name vc-parent-buffer)))
1628 (if file (vc-mode-line file)) 1662 ;;(if file (vc-mode-line file))
1629 (vc-log-edit file) 1663 (vc-log-edit files)
1630 (make-local-variable 'vc-log-after-operation-hook) 1664 (make-local-variable 'vc-log-after-operation-hook)
1631 (if after-hook 1665 (if after-hook
1632 (setq vc-log-after-operation-hook after-hook)) 1666 (setq vc-log-after-operation-hook after-hook))
1633 (setq vc-log-operation action) 1667 (setq vc-log-operation action)
1634 (setq vc-log-version rev) 1668 (setq vc-log-revision rev)
1635 (when comment 1669 (when comment
1636 (erase-buffer) 1670 (erase-buffer)
1637 (when (stringp comment) (insert comment))) 1671 (when (stringp comment) (insert comment)))
@@ -1651,7 +1685,7 @@ After check-out, runs the normal hook `vc-checkout-hook'."
1651 (vc-up-to-date-p file) 1685 (vc-up-to-date-p file)
1652 (vc-make-version-backup file)) 1686 (vc-make-version-backup file))
1653 (with-vc-properties 1687 (with-vc-properties
1654 file 1688 (list file)
1655 (condition-case err 1689 (condition-case err
1656 (vc-call checkout file writable rev) 1690 (vc-call checkout file writable rev)
1657 (file-error 1691 (file-error
@@ -1681,7 +1715,7 @@ After check-out, runs the normal hook `vc-checkout-hook'."
1681 (error "Steal canceled")) 1715 (error "Steal canceled"))
1682 (message "Stealing lock on %s..." file) 1716 (message "Stealing lock on %s..." file)
1683 (with-vc-properties 1717 (with-vc-properties
1684 file 1718 (list file)
1685 (vc-call steal-lock file rev) 1719 (vc-call steal-lock file rev)
1686 `((vc-state . edited))) 1720 `((vc-state . edited)))
1687 (vc-resynch-buffer file t t) 1721 (vc-resynch-buffer file t t)
@@ -1697,9 +1731,9 @@ After check-out, runs the normal hook `vc-checkout-hook'."
1697 ".\n") 1731 ".\n")
1698 (message "Please explain why you stole the lock. Type C-c C-c when done."))) 1732 (message "Please explain why you stole the lock. Type C-c C-c when done.")))
1699 1733
1700(defun vc-checkin (file &optional rev comment initial-contents) 1734(defun vc-checkin (files &optional rev comment initial-contents)
1701 "Check in FILE. 1735 "Check in FILES.
1702The optional argument REV may be a string specifying the new version 1736The optional argument REV may be a string specifying the new revision
1703level (if nil increment the current level). COMMENT is a comment 1737level (if nil increment the current level). COMMENT is a comment
1704string; if omitted, a buffer is popped up to accept a comment. If 1738string; if omitted, a buffer is popped up to accept a comment. If
1705INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial contents 1739INITIAL-CONTENTS is non-nil, then COMMENT is used as the initial contents
@@ -1710,29 +1744,27 @@ that the version control system supports this mode of operation.
1710 1744
1711Runs the normal hook `vc-checkin-hook'." 1745Runs the normal hook `vc-checkin-hook'."
1712 (vc-start-entry 1746 (vc-start-entry
1713 file rev comment initial-contents 1747 files rev comment initial-contents
1714 "Enter a change comment." 1748 "Enter a change comment."
1715 (lambda (file rev comment) 1749 (lambda (files rev comment)
1716 (message "Checking in %s..." file) 1750 (message "Checking in %s..." (vc-delistify files))
1717 ;; "This log message intentionally left almost blank". 1751 ;; "This log message intentionally left almost blank".
1718 ;; RCS 5.7 gripes about white-space-only comments too. 1752 ;; RCS 5.7 gripes about white-space-only comments too.
1719 (or (and comment (string-match "[^\t\n ]" comment)) 1753 (or (and comment (string-match "[^\t\n ]" comment))
1720 (setq comment "*** empty log message ***")) 1754 (setq comment "*** empty log message ***"))
1721 (with-vc-properties 1755 (with-vc-properties
1722 file 1756 files
1723 ;; Change buffers to get local value of vc-checkin-switches. 1757 ;; We used to change buffers to get local value of vc-checkin-switches,
1724 (with-current-buffer (or (get-file-buffer file) (current-buffer)) 1758 ;; but 'the' local buffer is not a well-defined concept for filesets.
1725 (progn 1759 (progn
1726 (vc-call checkin (list file) rev comment) 1760 (vc-call checkin files rev comment)
1727 (vc-delete-automatic-version-backups file))) 1761 (mapc 'vc-delete-automatic-version-backups files))
1728 `((vc-state . up-to-date) 1762 `((vc-state . up-to-date)
1729 (vc-checkout-time . ,(nth 5 (file-attributes file))) 1763 (vc-checkout-time . ,(nth 5 (file-attributes file)))
1730 (vc-workfile-version . nil))) 1764 (vc-working-revision . nil)))
1731 (message "Checking in %s...done" file)) 1765 (message "Checking in %s...done" (vc-delistify files)))
1732 'vc-checkin-hook)) 1766 'vc-checkin-hook))
1733 1767
1734;; Code for access to the comment ring
1735
1736(defun vc-finish-logentry (&optional nocomment) 1768(defun vc-finish-logentry (&optional nocomment)
1737 "Complete the operation implied by the current log entry. 1769 "Complete the operation implied by the current log entry.
1738Use the contents of the current buffer as a check-in or registration 1770Use the contents of the current buffer as a check-in or registration
@@ -1742,7 +1774,7 @@ the buffer contents as a comment."
1742 ;; Check and record the comment, if any. 1774 ;; Check and record the comment, if any.
1743 (unless nocomment 1775 (unless nocomment
1744 ;; Comment too long? 1776 ;; Comment too long?
1745 (vc-call-backend (or (and vc-log-file (vc-backend vc-log-file)) 1777 (vc-call-backend (or (and vc-log-fileset (vc-backend (car vc-log-fileset)))
1746 (vc-responsible-backend default-directory)) 1778 (vc-responsible-backend default-directory))
1747 'logentry-check) 1779 'logentry-check)
1748 (run-hooks 'vc-logentry-check-hook)) 1780 (run-hooks 'vc-logentry-check-hook))
@@ -1754,8 +1786,8 @@ the buffer contents as a comment."
1754 (error "No log operation is pending")) 1786 (error "No log operation is pending"))
1755 ;; save the parameters held in buffer-local variables 1787 ;; save the parameters held in buffer-local variables
1756 (let ((log-operation vc-log-operation) 1788 (let ((log-operation vc-log-operation)
1757 (log-file vc-log-file) 1789 (log-fileset vc-log-fileset)
1758 (log-version vc-log-version) 1790 (log-revision vc-log-revision)
1759 (log-entry (buffer-string)) 1791 (log-entry (buffer-string))
1760 (after-hook vc-log-after-operation-hook) 1792 (after-hook vc-log-after-operation-hook)
1761 (tmp-vc-parent-buffer vc-parent-buffer)) 1793 (tmp-vc-parent-buffer vc-parent-buffer))
@@ -1763,8 +1795,8 @@ the buffer contents as a comment."
1763 ;; OK, do it to it 1795 ;; OK, do it to it
1764 (save-excursion 1796 (save-excursion
1765 (funcall log-operation 1797 (funcall log-operation
1766 log-file 1798 log-fileset
1767 log-version 1799 log-revision
1768 log-entry)) 1800 log-entry))
1769 ;; Remove checkin window (after the checkin so that if that fails 1801 ;; Remove checkin window (after the checkin so that if that fails
1770 ;; we don't zap the *VC-log* buffer and the typing therein). 1802 ;; we don't zap the *VC-log* buffer and the typing therein).
@@ -1777,8 +1809,10 @@ the buffer contents as a comment."
1777 (bury-buffer) 1809 (bury-buffer)
1778 (pop-to-buffer tmp-vc-parent-buffer)))) 1810 (pop-to-buffer tmp-vc-parent-buffer))))
1779 ;; Now make sure we see the expanded headers 1811 ;; Now make sure we see the expanded headers
1780 (if log-file 1812 (if log-fileset
1781 (vc-resynch-buffer log-file vc-keep-workfiles t)) 1813 (mapc
1814 (lambda (file) (vc-resynch-buffer file vc-keep-workfiles t))
1815 log-fileset))
1782 (if vc-dired-mode 1816 (if vc-dired-mode
1783 (dired-move-to-filename)) 1817 (dired-move-to-filename))
1784 (run-hooks after-hook 'vc-finish-logentry-hook))) 1818 (run-hooks after-hook 'vc-finish-logentry-hook)))
@@ -1787,7 +1821,7 @@ the buffer contents as a comment."
1787 1821
1788(defun vc-default-diff-tree (backend dir rev1 rev2) 1822(defun vc-default-diff-tree (backend dir rev1 rev2)
1789 "List differences for all registered files at and below DIR. 1823 "List differences for all registered files at and below DIR.
1790The meaning of REV1 and REV2 is the same as for `vc-version-diff'." 1824The meaning of REV1 and REV2 is the same as for `vc-revision-diff'."
1791 ;; This implementation does an explicit tree walk, and calls 1825 ;; This implementation does an explicit tree walk, and calls
1792 ;; vc-BACKEND-diff directly for each file. An optimization 1826 ;; vc-BACKEND-diff directly for each file. An optimization
1793 ;; would be to use `vc-diff-internal', so that diffs can be local, 1827 ;; would be to use `vc-diff-internal', so that diffs can be local,
@@ -1838,192 +1872,182 @@ The meaning of REV1 and REV2 is the same as for `vc-version-diff'."
1838(defmacro vc-diff-switches-list (backend) `(vc-switches ',backend 'diff)) 1872(defmacro vc-diff-switches-list (backend) `(vc-switches ',backend 'diff))
1839(make-obsolete 'vc-diff-switches-list 'vc-switches "22.1") 1873(make-obsolete 'vc-diff-switches-list 'vc-switches "22.1")
1840 1874
1841(defun vc-diff-internal (file rev1 rev2) 1875(defun vc-diff-sentinel (verbose rev1-name rev2-name)
1842 "Run diff to compare FILE's revisions REV1 and REV2. 1876 ;; Did changes get generated into the buffer?
1843Diff output goes to the *vc-diff* buffer. The exit status of the diff 1877 (if (not (zerop (buffer-size (get-buffer "*vc-diff*"))))
1844command is returned. 1878 (progn
1845 1879 (pop-to-buffer "*vc-diff*")
1846This function takes care to set up a proper coding system for diff output. 1880 ;; Gnus-5.8.5 sets up an autoload for diff-mode, even if it's
1847If both revisions are available as local files, then it also does not 1881 ;; not available. Work around that.
1848actually call the backend, but performs a local diff." 1882 (if (require 'diff-mode nil t) (diff-mode))
1849 (if (or (not rev1) (string-equal rev1 "")) 1883 (when verbose
1850 (setq rev1 (vc-workfile-version file))) 1884 (let (buffer-read-only)
1851 (if (string-equal rev2 "") 1885 (goto-char (point-max))
1852 (setq rev2 nil)) 1886 (insert (format "\n\nDiffs between %s and %s end here." rev1-name rev2-name))
1853 (let ((file-rev1 (vc-version-backup-file file rev1)) 1887 (goto-char (point-min))
1854 (file-rev2 (if (not rev2) 1888 (insert (format "Diffs between %s and %s:\n\n" rev1-name rev2-name))))
1855 file 1889 (shrink-window-if-larger-than-buffer)
1856 (vc-version-backup-file file rev2))) 1890 t)
1857 (coding-system-for-read (vc-coding-system-for-diff file))) 1891 (progn
1858 (if (and file-rev1 file-rev2) 1892 (message "No changes between %s and %s" rev1-name rev2-name)
1859 (let ((status 1893 nil)))
1860 (if (eq vc-diff-knows-L 'no) 1894
1861 (apply 'vc-do-command "*vc-diff*" 1 "diff" nil 1895(defun vc-diff-internal (backend async files rev1 rev2 &optional verbose)
1862 (append (vc-switches nil 'diff) 1896 "Report diffs between two revisions of a fileset.
1863 (list (file-relative-name file-rev1) 1897Diff output goes to the *vc-diff* buffer. The function
1864 (file-relative-name file-rev2)))) 1898returns t if the buffer had changes, nil otherwise."
1865 (apply 'vc-do-command "*vc-diff*" 2 "diff" nil 1899 (let* ((filenames (vc-delistify files))
1866 (append (vc-switches nil 'diff) 1900 (rev1-name (or rev1 "working revision"))
1867 ;; Provide explicit labels like RCS or 1901 (rev2-name (or rev2 "workfile"))
1868 ;; CVS would do so diff-mode refers to 1902 ;; Set coding system based on the first file. It's a kluge,
1869 ;; `file' rather than to `file-rev1' 1903 ;; but the only way to set it for each file included would
1870 ;; when trying to find/apply/undo 1904 ;; be to call the back end separately for each file.
1871 ;; hunks. 1905 (coding-system-for-read
1872 (list "-L" (vc-diff-label file file-rev1 rev1) 1906 (if files (vc-coding-system-for-diff (car files)) 'undecided)))
1873 "-L" (vc-diff-label file file-rev2 rev2) 1907 (vc-setup-buffer "*vc-diff*")
1874 (file-relative-name file-rev1) 1908 (message "Finding changes in %s..." filenames)
1875 (file-relative-name file-rev2))))))) 1909 ;; Many backends don't handle well the case of a file that has been
1876 (if (eq status 2) 1910 ;; added but not yet committed to the repo (notably CVS and Subversion).
1877 (if (not vc-diff-knows-L) 1911 ;; Do that work here so the backends don't have to futz with it.
1878 (setq vc-diff-knows-L 'no 1912 (let ((filtered '()))
1879 status (apply 'vc-do-command "*vc-diff*" 1 "diff" nil 1913 (dolist (file files)
1880 (append 1914 (cond ((and (not (file-directory-p file)) (string= (vc-working-revision file) "0"))
1881 (vc-switches nil 'diff) 1915 (progn
1882 (list (file-relative-name file-rev1) 1916 ;; This file is added but not yet committed;
1883 (file-relative-name file-rev2))))) 1917 ;; there is no master file to diff against.
1884 (error "diff failed")) 1918 (if (or rev1 rev2)
1885 (if (not vc-diff-knows-L) (setq vc-diff-knows-L 'yes))) 1919 (error "No revisions of %s exist" file)
1886 status) 1920 ;; We regard this as "changed".
1887 (vc-call diff (list file) rev1 rev2 "*vc-diff*")))) 1921 ;; Diff it against /dev/null.
1922 (apply 'vc-do-command "*vc-diff*"
1923 1 "diff" file
1924 (append (vc-switches nil 'diff) '("/dev/null"))))))
1925 (t
1926 (add-to-list 'filtered file t))))
1927 (let ((vc-disable-async-diff (not async)))
1928 (vc-call-backend backend 'diff filtered rev1 rev2 "*vc-diff*")))
1929 (set-buffer "*vc-diff*")
1930 ;; This odd-looking code is because in the non-async case we
1931 ;; actually want to pass the return value from vc-diff-sentinel
1932 ;; back to the caller.
1933 (if async
1934 (vc-exec-after `(vc-diff-sentinel ,verbose ,rev1-name ,rev2-name))
1935 (vc-diff-sentinel verbose rev1-name rev2-name))))
1888 1936
1889;;;###autoload 1937;;;###autoload
1890(defun vc-diff (historic &optional not-urgent) 1938(defun vc-history-diff (backend files rev1 rev2)
1891 "Display diffs between file versions. 1939 "Report diffs between revisions of the fileset in the repository history."
1892Normally this compares the current file and buffer with the most
1893recent checked in version of that file. This uses no arguments. With
1894a prefix argument HISTORIC, it reads the file name to use and two
1895version designators specifying which versions to compare. The
1896optional argument NOT-URGENT non-nil means it is ok to say no to
1897saving the buffer."
1898 (interactive (list current-prefix-arg t))
1899 (if historic
1900 (call-interactively 'vc-version-diff)
1901 (vc-ensure-vc-buffer)
1902 (let ((file buffer-file-name))
1903 (vc-buffer-sync not-urgent)
1904 (if (vc-workfile-unchanged-p buffer-file-name)
1905 (message "No changes to %s since latest version" file)
1906 (vc-version-diff file nil nil)))))
1907
1908(defun vc-version-diff (file rev1 rev2)
1909 "List the differences between FILE's versions REV1 and REV2.
1910If REV1 is empty or nil it means to use the focus version;
1911REV2 empty or nil means the working-copy contents. FILE may also be
1912a directory, in that case, generate diffs between the correponding
1913versions of all registered files in or below it."
1914 (interactive 1940 (interactive
1915 (let* ((file (expand-file-name 1941 (let* ((files (vc-deduce-fileset t))
1916 (read-file-name (if buffer-file-name 1942 (first (car files))
1917 "File or dir to diff (default visited file): " 1943 (backend (vc-backend first))
1918 "File or dir to diff: ") 1944 (completion-table
1919 default-directory buffer-file-name t))) 1945 (vc-call-backend backend 'revision-completion-table first))
1920 (rev1-default nil) (rev2-default nil) 1946 (rev1-default nil)
1921 (completion-table (vc-call revision-completion-table file))) 1947 (rev2-default nil))
1922 ;; compute default versions based on the file state
1923 (cond 1948 (cond
1924 ;; if it's a directory, don't supply any version default 1949 ;; someday we may be able to do revision completion on non-singleton
1925 ((file-directory-p file) 1950 ;; filesets, but not yet.
1951 ((/= (length files) 1)
1952 nil)
1953 ;; if it's a directory, don't supply any revision default
1954 ((file-directory-p first)
1926 nil) 1955 nil)
1927 ;; if the file is not up-to-date, use current version as older version 1956 ;; if the file is not up-to-date, use working revision as older revision
1928 ((not (vc-up-to-date-p file)) 1957 ((not (vc-up-to-date-p first))
1929 (setq rev1-default (vc-workfile-version file))) 1958 (setq rev1-default (vc-working-revision first)))
1930 ;; if the file is not locked, use last and previous version as default 1959 ;; if the file is not locked, use last and previous revisions as defaults
1931 (t 1960 (t
1932 (setq rev1-default (vc-call previous-version file 1961 (setq rev1-default (vc-call previous-revision first
1933 (vc-workfile-version file))) 1962 (vc-working-revision first)))
1934 (if (string= rev1-default "") (setq rev1-default nil)) 1963 (if (string= rev1-default "") (setq rev1-default nil))
1935 (setq rev2-default (vc-workfile-version file)))) 1964 (setq rev2-default (vc-working-revision first))))
1936 ;; construct argument list 1965 ;; construct argument list
1937 (let* ((rev1-prompt (if rev1-default 1966 (let* ((rev1-prompt (if rev1-default
1938 (concat "Older version (default " 1967 (concat "Older revision (default "
1939 rev1-default "): ") 1968 rev1-default "): ")
1940 "Older version: ")) 1969 "Older revision: "))
1941 (rev2-prompt (concat "Newer version (default " 1970 (rev2-prompt (concat "Newer revision (default "
1942 (or rev2-default "current source") "): ")) 1971 (or rev2-default "current source") "): "))
1943 (rev1 (if completion-table 1972 (rev1 (if completion-table
1944 (completing-read rev1-prompt completion-table 1973 (completing-read rev1-prompt completion-table
1945 nil nil nil nil rev1-default) 1974 nil nil nil nil rev1-default)
1946 (read-string rev1-prompt nil nil rev1-default))) 1975 (read-string rev1-prompt nil nil rev1-default)))
1947 (rev2 (if completion-table 1976 (rev2 (if completion-table
1948 (completing-read rev2-prompt completion-table 1977 (completing-read rev2-prompt completion-table
1949 nil nil nil nil rev2-default) 1978 nil nil nil nil rev2-default)
1950 (read-string rev2-prompt nil nil rev2-default)))) 1979 (read-string rev2-prompt nil nil rev2-default))))
1951 (list file rev1 rev2)))) 1980 (if (string= rev1 "") (setq rev1 nil))
1952 (if (file-directory-p file) 1981 (if (string= rev2 "") (setq rev2 nil))
1953 ;; recursive directory diff 1982 (list backend files rev1 rev2))))
1954 (progn 1983 (if (and (not rev1) rev2)
1955 (vc-setup-buffer "*vc-diff*") 1984 (error "Not a valid revision range."))
1956 (if (string-equal rev1 "") (setq rev1 nil)) 1985 (vc-diff-internal backend t files rev1 rev2 (interactive-p)))
1957 (if (string-equal rev2 "") (setq rev2 nil)) 1986
1958 (let ((inhibit-read-only t)) 1987(defun vc-contains-version-controlled-file (dir)
1959 (insert "Diffs between " 1988 "Return t if DIR contains a version-controlled file, nil otherwise."
1960 (or rev1 "last version checked in") 1989 (catch 'found
1961 " and " 1990 (mapc (lambda (f) (and (not (file-directory-p f)) (vc-backend f) (throw 'found 't))) (directory-files dir))
1962 (or rev2 "working copy") 1991 nil))
1963 ":\n\n")) 1992
1964 (let ((dir (file-name-as-directory file))) 1993;;;###autoload
1965 (vc-call-backend (vc-responsible-backend dir) 1994(defun vc-diff (historic)
1966 'diff-tree dir rev1 rev2)) 1995 "Display diffs between file revisions.
1967 (vc-exec-after `(let ((inhibit-read-only t)) 1996Normally this compares the currently selected fileset with their
1968 (insert "\nEnd of diffs.\n")))) 1997working revisions. With a prefix argument HISTORIC, it reads two revision
1969 ;; Single file diff. It is important that the vc-controlled buffer 1998designators specifying which revisions to compare.
1970 ;; is still current at this time, because any local settings in that 1999
1971 ;; buffer should affect the diff command. 2000If no current fileset is available (that is, we are not in
1972 (vc-diff-internal file rev1 rev2)) 2001VC-Dired mode and the visited file of the current buffer is not
1973 (set-buffer "*vc-diff*") 2002under version control) behave specially; if there are
1974 (if (and (zerop (buffer-size)) 2003version-controlled files in the current directory, treat all
1975 (not (get-buffer-process (current-buffer)))) 2004version-controlled files recursively beneath the current
1976 (progn 2005directory as the selected fileset.
1977 (if rev1 2006"
1978 (if rev2 2007
1979 (message "No changes to %s between %s and %s" file rev1 rev2) 2008 (interactive "P")
1980 (message "No changes to %s since %s" file rev1)) 2009 (cond
1981 (message "No changes to %s since latest version" file)) 2010 ;;((not (vc-contains-version-controlled-file default-directory))
1982 nil) 2011 ;;(error "No version-controlled files directly beneath default directory"))
1983 (pop-to-buffer (current-buffer)) 2012 (historic
1984 ;; Gnus-5.8.5 sets up an autoload for diff-mode, even if it's 2013 (call-interactively 'vc-history-diff))
1985 ;; not available. Work around that. 2014 (t
1986 (if (require 'diff-mode nil t) (diff-mode)) 2015 (let* ((files (vc-deduce-fileset t))
1987 (vc-exec-after '(let ((inhibit-read-only t)) 2016 (first (car files))
1988 (if (eq (buffer-size) 0) 2017 (backend
1989 (insert "No differences found.\n")) 2018 (cond ((file-directory-p first)
1990 (goto-char (point-min)) 2019 (vc-responsible-backend first))
1991 (shrink-window-if-larger-than-buffer))) 2020 (t
1992 t)) 2021 (vc-backend first)))))
1993 2022 (vc-diff-internal backend t files nil nil (interactive-p))))))
1994(defun vc-diff-label (file file-rev rev)
1995 (concat (file-relative-name file)
1996 (format-time-string "\t%d %b %Y %T %z\t"
1997 (nth 5 (file-attributes file-rev)))
1998 rev))
1999 2023
2000;;;###autoload 2024;;;###autoload
2001(defun vc-version-other-window (rev) 2025(defun vc-revision-other-window (rev)
2002 "Visit version REV of the current file in another window. 2026 "Visit revision REV of the current file in another window.
2003If the current file is named `F', the version is named `F.~REV~'. 2027If the current file is named `F', the revision is named `F.~REV~'.
2004If `F.~REV~' already exists, use it instead of checking it out again." 2028If `F.~REV~' already exists, use it instead of checking it out again."
2005 (interactive 2029 (interactive
2006 (save-current-buffer 2030 (save-current-buffer
2007 (vc-ensure-vc-buffer) 2031 (vc-ensure-vc-buffer)
2008 (let ((completion-table 2032 (let ((completion-table
2009 (vc-call revision-completion-table buffer-file-name)) 2033 (vc-call revision-completion-table buffer-file-name))
2010 (prompt "Version to visit (default is focus version): ")) 2034 (prompt "Revision to visit (default is working revision): "))
2011 (list 2035 (list
2012 (if completion-table 2036 (if completion-table
2013 (completing-read prompt completion-table) 2037 (completing-read prompt completion-table)
2014 (read-string prompt)))))) 2038 (read-string prompt))))))
2015 (vc-ensure-vc-buffer) 2039 (vc-ensure-vc-buffer)
2016 (let* ((file buffer-file-name) 2040 (let* ((file buffer-file-name)
2017 (version (if (string-equal rev "") 2041 (revision (if (string-equal rev "")
2018 (vc-workfile-version file) 2042 (vc-working-revision file)
2019 rev))) 2043 rev)))
2020 (switch-to-buffer-other-window (vc-find-version file version)))) 2044 (switch-to-buffer-other-window (vc-find-revision file revision))))
2021 2045
2022(defun vc-find-version (file version) 2046(defun vc-find-revision (file revision)
2023 "Read VERSION of FILE into a buffer and return the buffer." 2047 "Read REVISION of FILE into a buffer and return the buffer."
2024 (let ((automatic-backup (vc-version-backup-file-name file version)) 2048 (let ((automatic-backup (vc-version-backup-file-name file revision))
2025 (filebuf (or (get-file-buffer file) (current-buffer))) 2049 (filebuf (or (get-file-buffer file) (current-buffer)))
2026 (filename (vc-version-backup-file-name file version 'manual))) 2050 (filename (vc-version-backup-file-name file revision 'manual)))
2027 (unless (file-exists-p filename) 2051 (unless (file-exists-p filename)
2028 (if (file-exists-p automatic-backup) 2052 (if (file-exists-p automatic-backup)
2029 (rename-file automatic-backup filename nil) 2053 (rename-file automatic-backup filename nil)
@@ -2038,7 +2062,7 @@ If `F.~REV~' already exists, use it instead of checking it out again."
2038 ;; Change buffer to get local value of 2062 ;; Change buffer to get local value of
2039 ;; vc-checkout-switches. 2063 ;; vc-checkout-switches.
2040 (with-current-buffer filebuf 2064 (with-current-buffer filebuf
2041 (vc-call find-version file version outbuf)))) 2065 (vc-call find-revision file revision outbuf))))
2042 (setq failed nil)) 2066 (setq failed nil))
2043 (if (and failed (file-exists-p filename)) 2067 (if (and failed (file-exists-p filename))
2044 (delete-file filename)))) 2068 (delete-file filename))))
@@ -2095,10 +2119,10 @@ The headers are reset to their non-expanded form."
2095 2119
2096;;;###autoload 2120;;;###autoload
2097(defun vc-merge () 2121(defun vc-merge ()
2098 "Merge changes between two versions into the current buffer's file. 2122 "Merge changes between two revisions into the current buffer's file.
2099This asks for two versions to merge from in the minibuffer. If the 2123This asks for two revisions to merge from in the minibuffer. If the
2100first version is a branch number, then merge all changes from that 2124first revision is a branch number, then merge all changes from that
2101branch. If the first version is empty, merge news, i.e. recent changes 2125branch. If the first revision is empty, merge news, i.e. recent changes
2102from the current branch. 2126from the current branch.
2103 2127
2104See Info node `Merging'." 2128See Info node `Merging'."
@@ -2108,7 +2132,7 @@ See Info node `Merging'."
2108 (let* ((file buffer-file-name) 2132 (let* ((file buffer-file-name)
2109 (backend (vc-backend file)) 2133 (backend (vc-backend file))
2110 (state (vc-state file)) 2134 (state (vc-state file))
2111 first-version second-version status) 2135 first-revision second-revision status)
2112 (cond 2136 (cond
2113 ((stringp state) ;; Locking VCses only 2137 ((stringp state) ;; Locking VCses only
2114 (error "File is locked by %s" state)) 2138 (error "File is locked by %s" state))
@@ -2117,25 +2141,25 @@ See Info node `Merging'."
2117 "File must be checked out for merging. Check out now? ") 2141 "File must be checked out for merging. Check out now? ")
2118 (vc-checkout file t) 2142 (vc-checkout file t)
2119 (error "Merge aborted")))) 2143 (error "Merge aborted"))))
2120 (setq first-version 2144 (setq first-revision
2121 (read-string (concat "Branch or version to merge from " 2145 (read-string (concat "Branch or revision to merge from "
2122 "(default news on current branch): "))) 2146 "(default news on current branch): ")))
2123 (if (string= first-version "") 2147 (if (string= first-revision "")
2124 (if (not (vc-find-backend-function backend 'merge-news)) 2148 (if (not (vc-find-backend-function backend 'merge-news))
2125 (error "Sorry, merging news is not implemented for %s" backend) 2149 (error "Sorry, merging news is not implemented for %s" backend)
2126 (setq status (vc-call merge-news file))) 2150 (setq status (vc-call merge-news file)))
2127 (if (not (vc-find-backend-function backend 'merge)) 2151 (if (not (vc-find-backend-function backend 'merge))
2128 (error "Sorry, merging is not implemented for %s" backend) 2152 (error "Sorry, merging is not implemented for %s" backend)
2129 (if (not (vc-branch-p first-version)) 2153 (if (not (vc-branch-p first-revision))
2130 (setq second-version 2154 (setq second-revision
2131 (read-string "Second version: " 2155 (read-string "Second revision: "
2132 (concat (vc-branch-part first-version) "."))) 2156 (concat (vc-branch-part first-revision) ".")))
2133 ;; We want to merge an entire branch. Set versions 2157 ;; We want to merge an entire branch. Set revisions
2134 ;; accordingly, so that vc-BACKEND-merge understands us. 2158 ;; accordingly, so that vc-BACKEND-merge understands us.
2135 (setq second-version first-version) 2159 (setq second-revision first-revision)
2136 ;; first-version must be the starting point of the branch 2160 ;; first-revision must be the starting point of the branch
2137 (setq first-version (vc-branch-part first-version))) 2161 (setq first-revision (vc-branch-part first-revision)))
2138 (setq status (vc-call merge file first-version second-version)))) 2162 (setq status (vc-call merge file first-revision second-revision))))
2139 (vc-maybe-resolve-conflicts file status "WORKFILE" "MERGE SOURCE"))) 2163 (vc-maybe-resolve-conflicts file status "WORKFILE" "MERGE SOURCE")))
2140 2164
2141(defun vc-maybe-resolve-conflicts (file status &optional name-A name-B) 2165(defun vc-maybe-resolve-conflicts (file status &optional name-A name-B)
@@ -2417,10 +2441,10 @@ Otherwise, return nil."
2417;;;###autoload 2441;;;###autoload
2418(defun vc-create-snapshot (dir name branchp) 2442(defun vc-create-snapshot (dir name branchp)
2419 "Descending recursively from DIR, make a snapshot called NAME. 2443 "Descending recursively from DIR, make a snapshot called NAME.
2420For each registered file, the version level of its latest version 2444For each registered file, the working revision becomes part of
2421becomes part of the named configuration. If the prefix argument 2445the named configuration. If the prefix argument BRANCHP is
2422BRANCHP is given, the snapshot is made as a new branch and the files 2446given, the snapshot is made as a new branch and the files are
2423are checked out in that new branch." 2447checked out in that new branch."
2424 (interactive 2448 (interactive
2425 (list (read-file-name "Directory: " default-directory default-directory t) 2449 (list (read-file-name "Directory: " default-directory default-directory t)
2426 (read-string "New snapshot name: ") 2450 (read-string "New snapshot name: ")
@@ -2434,13 +2458,13 @@ are checked out in that new branch."
2434;;;###autoload 2458;;;###autoload
2435(defun vc-retrieve-snapshot (dir name) 2459(defun vc-retrieve-snapshot (dir name)
2436 "Descending recursively from DIR, retrieve the snapshot called NAME. 2460 "Descending recursively from DIR, retrieve the snapshot called NAME.
2437If NAME is empty, it refers to the latest versions. 2461If NAME is empty, it refers to the latest revisions.
2438If locking is used for the files in DIR, then there must not be any 2462If locking is used for the files in DIR, then there must not be any
2439locked files at or below DIR (but if NAME is empty, locked files are 2463locked files at or below DIR (but if NAME is empty, locked files are
2440allowed and simply skipped)." 2464allowed and simply skipped)."
2441 (interactive 2465 (interactive
2442 (list (read-file-name "Directory: " default-directory default-directory t) 2466 (list (read-file-name "Directory: " default-directory default-directory t)
2443 (read-string "Snapshot name to retrieve (default latest versions): "))) 2467 (read-string "Snapshot name to retrieve (default latest revisions): ")))
2444 (let ((update (yes-or-no-p "Update any affected buffers? ")) 2468 (let ((update (yes-or-no-p "Update any affected buffers? "))
2445 (msg (if (or (not name) (string= name "")) 2469 (msg (if (or (not name) (string= name ""))
2446 (format "Updating %s... " (abbreviate-file-name dir)) 2470 (format "Updating %s... " (abbreviate-file-name dir))
@@ -2454,37 +2478,21 @@ allowed and simply skipped)."
2454;; Miscellaneous other entry points 2478;; Miscellaneous other entry points
2455 2479
2456;;;###autoload 2480;;;###autoload
2457(defun vc-print-log (&optional focus-rev) 2481(defun vc-print-log (&optional working-revision)
2458 "List the change log of the current buffer in a window. 2482 "List the change log of the current fileset in a window.
2459If FOCUS-REV is non-nil, leave the point at that revision." 2483If WORKING-REVISION is non-nil, leave the point at that revision."
2460 (interactive) 2484 (interactive)
2461 (vc-ensure-vc-buffer) 2485 (let* ((files (vc-deduce-fileset))
2462 (let ((file buffer-file-name)) 2486 (backend (vc-backend (car files)))
2463 (or focus-rev (setq focus-rev (vc-workfile-version file))) 2487 (working-revision (or working-revision (vc-working-revision (car files)))))
2464 ;; Don't switch to the output buffer before running the command, 2488 ;; Don't switch to the output buffer before running the command,
2465 ;; so that any buffer-local settings in the vc-controlled 2489 ;; so that any buffer-local settings in the vc-controlled
2466 ;; buffer can be accessed by the command. 2490 ;; buffer can be accessed by the command.
2467 (condition-case err 2491 (vc-call-backend backend 'print-log files "*vc-change-log*")
2468 (progn 2492 (pop-to-buffer "*vc-change-log*")
2469 (vc-call print-log (list file) "*vc-change-log*")
2470 (set-buffer "*vc-change-log*"))
2471 (wrong-number-of-arguments
2472 ;; If this error came from the above call to print-log, try again
2473 ;; without the optional buffer argument (for backward compatibility).
2474 ;; Otherwise, resignal.
2475 (if (or (not (eq (cadr err)
2476 (indirect-function
2477 (vc-find-backend-function (vc-backend file)
2478 'print-log))))
2479 (not (eq (caddr err) 2)))
2480 (signal (car err) (cdr err))
2481 ;; for backward compatibility
2482 (vc-call print-log (list file))
2483 (set-buffer "*vc*"))))
2484 (pop-to-buffer (current-buffer))
2485 (vc-exec-after 2493 (vc-exec-after
2486 `(let ((inhibit-read-only t)) 2494 `(let ((inhibit-read-only t))
2487 (vc-call-backend ',(vc-backend file) 'log-view-mode) 2495 (vc-call-backend ',backend 'log-view-mode)
2488 (goto-char (point-max)) (forward-line -1) 2496 (goto-char (point-max)) (forward-line -1)
2489 (while (looking-at "=*\n") 2497 (while (looking-at "=*\n")
2490 (delete-char (- (match-end 0) (match-beginning 0))) 2498 (delete-char (- (match-end 0) (match-beginning 0)))
@@ -2492,139 +2500,129 @@ If FOCUS-REV is non-nil, leave the point at that revision."
2492 (goto-char (point-min)) 2500 (goto-char (point-min))
2493 (if (looking-at "[\b\t\n\v\f\r ]+") 2501 (if (looking-at "[\b\t\n\v\f\r ]+")
2494 (delete-char (- (match-end 0) (match-beginning 0)))) 2502 (delete-char (- (match-end 0) (match-beginning 0))))
2495 ;; (shrink-window-if-larger-than-buffer) 2503 (shrink-window-if-larger-than-buffer)
2496 ;; move point to the log entry for the current version 2504 ;; move point to the log entry for the working revision
2497 (vc-call-backend ',(vc-backend file) 2505 (vc-call-backend ',backend 'show-log-entry ',working-revision)
2498 'show-log-entry
2499 ',focus-rev)
2500 (setq vc-sentinel-movepoint (point)) 2506 (setq vc-sentinel-movepoint (point))
2501 (set-buffer-modified-p nil))))) 2507 (set-buffer-modified-p nil)))))
2502 2508
2503;;;###autoload 2509;;;###autoload
2504(defun vc-revert () 2510(defun vc-revert ()
2505 "Revert the current buffer's file to the version it was based on. 2511 "Revert working copies of the selected fileset to their repository contents.
2506This asks for confirmation if the buffer contents are not identical 2512This asks for confirmation if the buffer contents are not identical
2507to that version. This function does not automatically pick up newer 2513to the working revision (except for keyword expansion)."
2508changes found in the master file; use \\[universal-argument] \\[vc-next-action] to do so."
2509 (interactive) 2514 (interactive)
2510 (vc-ensure-vc-buffer) 2515 (let* ((files (vc-deduce-fileset))
2511 ;; Make sure buffer is saved. If the user says `no', abort since 2516 (backend (vc-backend (car files))))
2512 ;; we cannot show the changes and ask for confirmation to discard them. 2517 ;; If any of the files is visited by the current buffer, make
2513 (vc-buffer-sync nil) 2518 ;; sure buffer is saved. If the user says `no', abort since
2514 (let ((file buffer-file-name) 2519 ;; we cannot show the changes and ask for confirmation to
2515 ;; This operation should always ask for confirmation. 2520 ;; discard them.
2516 (vc-suppress-confirm nil) 2521 (if (or (not files) (memq (buffer-file-name) files))
2517 (obuf (current-buffer)) 2522 (vc-buffer-sync nil))
2518 status) 2523 (dolist (file files)
2519 (if (vc-up-to-date-p file) 2524 (let (buf (get-file-buffer file))
2520 (unless (yes-or-no-p "File seems up-to-date. Revert anyway? ") 2525 (if (and buf (buffer-modified-p buf))
2521 (error "Revert canceled"))) 2526 (error "Please kill or save all modified buffers before reverting.")))
2522 (unless (vc-workfile-unchanged-p file) 2527 (if (vc-up-to-date-p file)
2523 (message "Finding changes...") 2528 (unless (yes-or-no-p (format "%s seems up-to-date. Revert anyway? " file))
2524 ;; vc-diff selects the new window, which is not what we want: 2529 (error "Revert canceled"))))
2525 ;; if the new window is on another frame, that'd require the user 2530 (if (vc-diff-internal backend vc-allow-async-revert files nil nil)
2526 ;; moving her mouse to answer the yes-or-no-p question. 2531 (progn
2527 (let* ((vc-disable-async-diff (not vc-allow-async-revert)) 2532 (unless (yes-or-no-p (format "Discard changes in %s? " (vc-delistify files)))
2528 (win (save-selected-window 2533 (error "Revert canceled"))
2529 (setq status (vc-diff nil t)) (selected-window)))) 2534 (delete-windows-on "*vc-diff*")
2530 (vc-exec-after `(message nil)) 2535 (kill-buffer "*vc-diff*")))
2531 (when status 2536 (dolist (file files)
2532 (unwind-protect 2537 (progn
2533 (unless (yes-or-no-p "Discard changes? ") 2538 (message "Reverting %s..." (vc-delistify files))
2534 (error "Revert canceled")) 2539 (vc-revert-file file)
2535 (select-window win) 2540 (message "Reverting %s...done" (vc-delistify files))))))
2536 (if (one-window-p t)
2537 (if (window-dedicated-p (selected-window))
2538 (make-frame-invisible))
2539 (delete-window))))))
2540 (set-buffer obuf)
2541 ;; Do the reverting
2542 (message "Reverting %s..." file)
2543 (vc-revert-file file)
2544 (message "Reverting %s...done" file)))
2545 2541
2546;;;###autoload 2542;;;###autoload
2547(defun vc-rollback (&optional norevert) 2543(defun vc-rollback ()
2548 "Get rid of most recently checked in version of this file. 2544 "Roll back (remove) the most recent changeset committed to the repository.
2549A prefix argument NOREVERT means do not revert the buffer afterwards." 2545This may be either a file-level or a repository-level operation,
2550 (interactive "P") 2546depending on the underlying version-control system."
2551 (vc-ensure-vc-buffer) 2547 (interactive)
2552 (let* ((file buffer-file-name) 2548 (let* ((files (vc-deduce-fileset))
2553 (backend (vc-backend file)) 2549 (backend (vc-backend (car files)))
2554 (target (vc-workfile-version file))) 2550 (granularity (vc-call-backend backend 'revision-granularity)))
2555 (cond 2551 (unless (vc-find-backend-function backend 'rollback)
2556 ((not (vc-find-backend-function backend 'rollback)) 2552 (error "Rollback is not supported in %s" backend))
2557 (error "Sorry, canceling versions is not supported under %s" backend)) 2553 (if (and (not (eq granularity 'repository)) (/= (length files) 1))
2558 ((not (vc-call latest-on-branch-p file)) 2554 (error "Rollback requires a singleton fileset or repository versioning"))
2559 (error "This is not the latest version; VC cannot cancel it")) 2555 (if (not (vc-call latest-on-branch-p (car files)))
2560 ((not (vc-up-to-date-p file)) 2556 (error "Rollback is only possible at the tip revision."))
2561 (error "%s" (substitute-command-keys "File is not up to date; use \\[vc-revert] to discard changes")))) 2557 ;; If any of the files is visited by the current buffer, make
2562 (if (null (yes-or-no-p (format "Remove version %s from master? " target))) 2558 ;; sure buffer is saved. If the user says `no', abort since
2563 (error "Aborted") 2559 ;; we cannot show the changes and ask for confirmation to
2564 (setq norevert (or norevert (not 2560 ;; discard them.
2565 (yes-or-no-p "Revert buffer to most recent remaining version? ")))) 2561 (if (or (not files) (memq (buffer-file-name) files))
2566 2562 (vc-buffer-sync nil))
2567 (message "Removing last change from %s..." file) 2563 (dolist (file files)
2568 (with-vc-properties 2564 (if (buffer-modified-p (get-file-buffer file))
2569 file 2565 (error "Please kill or save all modified buffers before rollback."))
2570 (vc-call rollback (list file)) 2566 (if (not (vc-up-to-date-p file))
2571 `((vc-state . ,(if norevert 'edited 'up-to-date)) 2567 (error "Please revert all modified workfiles before rollback.")))
2572 (vc-checkout-time . ,(if norevert 2568 ;; Accumulate changes associated with the fileset
2573 0 2569 (vc-setup-buffer "*vc-diff*")
2574 (nth 5 (file-attributes file)))) 2570 (not-modified)
2575 (vc-workfile-version . nil))) 2571 (message "Finding changes...")
2576 (message "Removing last change from %s...done" file) 2572 (let* ((tip (vc-working-revision (car files)))
2577 2573 (previous (vc-call previous-revision (car files) tip)))
2578 (cond 2574 (vc-diff-internal backend nil files previous tip))
2579 (norevert ;; clear version headers and mark the buffer modified 2575 ;; Display changes
2580 (set-visited-file-name file) 2576 (unless (yes-or-no-p "Discard these revisions? ")
2581 (when (not vc-make-backup-files) 2577 (error "Rollback canceled"))
2582 ;; inhibit backup for this buffer 2578 (delete-windows-on "*vc-diff*")
2583 (make-local-variable 'backup-inhibited) 2579 (kill-buffer"*vc-diff*")
2584 (setq backup-inhibited t)) 2580 ;; Do the actual reversions
2585 (setq buffer-read-only nil) 2581 (message "Rolling back %s..." (vc-delistify files))
2586 (vc-clear-headers) 2582 (with-vc-properties
2587 (vc-mode-line file) 2583 files
2588 (vc-dired-resynch-file file)) 2584 (vc-call-backend backend 'rollback files)
2589 (t ;; revert buffer to file on disk 2585 `((vc-state . ,'up-to-date)
2590 (vc-resynch-buffer file t t))) 2586 (vc-checkout-time . , (nth 5 (file-attributes file)))
2591 (message "Version %s has been removed from the master" target)))) 2587 (vc-working-revision . nil)))
2588 (mapc (lambda (f) (vc-resynch-buffer f t t)) files)
2589 (message "Rolling back %s...done" (vc-delistify files))))
2592 2590
2593;;;###autoload 2591;;;###autoload
2594(define-obsolete-function-alias 'vc-revert-buffer 'vc-revert "23.1") 2592(define-obsolete-function-alias 'vc-revert-buffer 'vc-revert "23.1")
2595 2593
2596;;;###autoload 2594;;;###autoload
2597(defun vc-update () 2595(defun vc-update ()
2598 "Update the current buffer's file to the latest version on its branch. 2596 "Update the current fileset's files to their tip revisions.
2599If the file contains no changes, and is not locked, then this simply replaces 2597For each one that contains no changes, and is not locked, then this simply
2600the working file with the latest version on its branch. If the file contains 2598replaces the work file with the latest revision on its branch. If the file
2601changes, and the backend supports merging news, then any recent changes from 2599contains changes, and the backend supports merging news, then any recent
2602the current branch are merged into the working file." 2600changes from the current branch are merged into the working file."
2603 (interactive) 2601 (interactive)
2604 (vc-ensure-vc-buffer) 2602 (dolist (file (vc-deduce-fileset))
2605 (vc-buffer-sync nil) 2603 (if (buffer-modified-p (get-file-buffer file))
2606 (let ((file buffer-file-name)) 2604 (error "Please kill or save all modified buffers before updating."))
2607 (if (vc-up-to-date-p file) 2605 (if (vc-up-to-date-p file)
2608 (vc-checkout file nil "") 2606 (vc-checkout file nil "")
2609 (if (eq (vc-checkout-model file) 'locking) 2607 (if (eq (vc-checkout-model file) 'locking)
2610 (if (eq (vc-state file) 'edited) 2608 (if (eq (vc-state file) 'edited)
2611 (error 2609 (error
2612 (substitute-command-keys 2610 (substitute-command-keys
2613 "File is locked--type \\[vc-revert] to discard changes")) 2611 "File is locked--type \\[vc-revert] to discard changes"))
2614 (error 2612 (error
2615 (substitute-command-keys 2613 (substitute-command-keys
2616 "Unexpected file state (%s)--type \\[vc-next-action] to correct") 2614 "Unexpected file state (%s)--type \\[vc-next-action] to correct")
2617 (vc-state file))) 2615 (vc-state file)))
2618 (if (not (vc-find-backend-function (vc-backend file) 'merge-news)) 2616 (if (not (vc-find-backend-function (vc-backend file) 'merge-news))
2619 (error "Sorry, merging news is not implemented for %s" 2617 (error "Sorry, merging news is not implemented for %s"
2620 (vc-backend file)) 2618 (vc-backend file))
2621 (vc-call merge-news file) 2619 (vc-call merge-news file)
2622 (vc-resynch-window file t t)))))) 2620 (vc-resynch-buffer file t t))))))
2623 2621
2624(defun vc-version-backup-file (file &optional rev) 2622(defun vc-version-backup-file (file &optional rev)
2625 "Return name of backup file for revision REV of FILE. 2623 "Return name of backup file for revision REV of FILE.
2626If version backups should be used for FILE, and there exists 2624If version backups should be used for FILE, and there exists
2627such a backup for REV or the focus version of file, return 2625such a backup for REV or the working revision of file, return
2628its name; otherwise return nil." 2626its name; otherwise return nil."
2629 (when (vc-call make-version-backups-p file) 2627 (when (vc-call make-version-backups-p file)
2630 (let ((backup-file (vc-version-backup-file-name file rev))) 2628 (let ((backup-file (vc-version-backup-file-name file rev)))
@@ -2636,9 +2634,9 @@ its name; otherwise return nil."
2636 backup-file))))) 2634 backup-file)))))
2637 2635
2638(defun vc-revert-file (file) 2636(defun vc-revert-file (file)
2639 "Revert FILE back to the repository version it was based on." 2637 "Revert FILE back to the repository working revision it was based on."
2640 (with-vc-properties 2638 (with-vc-properties
2641 file 2639 (list file)
2642 (let ((backup-file (vc-version-backup-file file))) 2640 (let ((backup-file (vc-version-backup-file file)))
2643 (when backup-file 2641 (when backup-file
2644 (copy-file backup-file file 'ok-if-already-exists 'keep-date) 2642 (copy-file backup-file file 'ok-if-already-exists 'keep-date)
@@ -2662,32 +2660,25 @@ To get a prompt, use a prefix argument."
2662 (error "There is no version-controlled file in this buffer")) 2660 (error "There is no version-controlled file in this buffer"))
2663 (let ((backend (vc-backend buffer-file-name)) 2661 (let ((backend (vc-backend buffer-file-name))
2664 (backends nil)) 2662 (backends nil))
2665 (unwind-protect 2663 (unless backend
2666 (progn 2664 (error "File %s is not under version control" buffer-file-name))
2667 (unless backend 2665 ;; Find the registered backends.
2668 (error "File %s is not under version control" buffer-file-name)) 2666 (dolist (backend vc-handled-backends)
2669 ;; Find the registered backends. 2667 (when (vc-call-backend backend 'registered buffer-file-name)
2670 (dolist (backend vc-handled-backends) 2668 (push backend backends)))
2671 (when (vc-call-backend backend 'registered buffer-file-name) 2669 ;; Find the next backend.
2672 (push backend backends))) 2670 (let ((def (car (delq backend (append (memq backend backends) backends))))
2673 ;; Find the next backend. 2671 (others (delete backend backends)))
2674 (let ((def (car (delq backend 2672 (cond
2675 (append (memq backend backends) backends)))) 2673 ((null others) (error "No other backend to switch to"))
2676 (others (delete backend backends))) 2674 (current-prefix-arg
2677 (cond 2675 (intern
2678 ((null others) (error "No other backend to switch to")) 2676 (upcase
2679 (current-prefix-arg 2677 (completing-read
2680 (intern 2678 (format "Switch to backend [%s]: " def)
2681 (upcase 2679 (mapcar (lambda (b) (list (downcase (symbol-name b)))) backends)
2682 (completing-read 2680 nil t nil nil (downcase (symbol-name def))))))
2683 (format "Switch to backend [%s]: " def) 2681 (t def))))))
2684 (mapcar (lambda (b) (list (downcase (symbol-name b)))) backends)
2685 nil t nil nil (downcase (symbol-name def))))))
2686 (t def))))
2687 ;; Calling the `registered' method can mess up the file
2688 ;; properties, so we want to revert them to what they were.
2689 (if (and backend (delete backend backends))
2690 (vc-call-backend backend 'registered buffer-file-name))))))
2691 (unless (eq backend (vc-backend file)) 2682 (unless (eq backend (vc-backend file))
2692 (vc-file-clearprops file) 2683 (vc-file-clearprops file)
2693 (vc-file-setprop file 'vc-backend backend) 2684 (vc-file-setprop file 'vc-backend backend)
@@ -2702,7 +2693,7 @@ To get a prompt, use a prefix argument."
2702 "Transfer FILE to another version control system NEW-BACKEND. 2693 "Transfer FILE to another version control system NEW-BACKEND.
2703If NEW-BACKEND has a higher precedence than FILE's current backend 2694If NEW-BACKEND has a higher precedence than FILE's current backend
2704\(i.e. it comes earlier in `vc-handled-backends'), then register FILE in 2695\(i.e. it comes earlier in `vc-handled-backends'), then register FILE in
2705NEW-BACKEND, using the version number from the current backend as the 2696NEW-BACKEND, using the revision number from the current backend as the
2706base level. If NEW-BACKEND has a lower precedence than the current 2697base level. If NEW-BACKEND has a lower precedence than the current
2707backend, then commit all changes that were made under the current 2698backend, then commit all changes that were made under the current
2708backend to NEW-BACKEND, and unregister FILE from the current backend. 2699backend to NEW-BACKEND, and unregister FILE from the current backend.
@@ -2722,7 +2713,7 @@ backend to NEW-BACKEND, and unregister FILE from the current backend.
2722 (set-file-modes file (logior (file-modes file) 128)) 2713 (set-file-modes file (logior (file-modes file) 128))
2723 ;; `registered' might have switched under us. 2714 ;; `registered' might have switched under us.
2724 (vc-switch-backend file old-backend) 2715 (vc-switch-backend file old-backend)
2725 (let* ((rev (vc-workfile-version file)) 2716 (let* ((rev (vc-working-revision file))
2726 (modified-file (and edited (make-temp-file file))) 2717 (modified-file (and edited (make-temp-file file)))
2727 (unmodified-file (and modified-file (vc-version-backup-file file)))) 2718 (unmodified-file (and modified-file (vc-version-backup-file file))))
2728 ;; Go back to the base unmodified file. 2719 ;; Go back to the base unmodified file.
@@ -2736,7 +2727,7 @@ backend to NEW-BACKEND, and unregister FILE from the current backend.
2736 (if unmodified-file 2727 (if unmodified-file
2737 (copy-file unmodified-file file 2728 (copy-file unmodified-file file
2738 'ok-if-already-exists 'keep-date) 2729 'ok-if-already-exists 'keep-date)
2739 (if (y-or-n-p "Get base version from master? ") 2730 (if (y-or-n-p "Get base revision from master? ")
2740 (vc-revert-file file)))) 2731 (vc-revert-file file))))
2741 (vc-call-backend new-backend 'receive-file file rev)) 2732 (vc-call-backend new-backend 'receive-file file rev))
2742 (when modified-file 2733 (when modified-file
@@ -2826,7 +2817,7 @@ backend to NEW-BACKEND, and unregister FILE from the current backend.
2826 (if (file-exists-p old) (rename-file old new)) 2817 (if (file-exists-p old) (rename-file old new))
2827 ;; ?? Renaming a file might change its contents due to keyword expansion. 2818 ;; ?? Renaming a file might change its contents due to keyword expansion.
2828 ;; We should really check out a new copy if the old copy was precisely equal 2819 ;; We should really check out a new copy if the old copy was precisely equal
2829 ;; to some checked in version. However, testing for this is tricky.... 2820 ;; to some checked-in revision. However, testing for this is tricky....
2830 (if oldbuf 2821 (if oldbuf
2831 (with-current-buffer oldbuf 2822 (with-current-buffer oldbuf
2832 (let ((buffer-read-only buffer-read-only)) 2823 (let ((buffer-read-only buffer-read-only))
@@ -2873,7 +2864,7 @@ log entries should be gathered."
2873 (vc-call-backend (vc-responsible-backend default-directory) 2864 (vc-call-backend (vc-responsible-backend default-directory)
2874 'update-changelog args)) 2865 'update-changelog args))
2875 2866
2876;;; The default back end. Assumes RCS-like version numbering. 2867;;; The default back end. Assumes RCS-like revision numbering.
2877 2868
2878(defun vc-default-revision-granularity () 2869(defun vc-default-revision-granularity ()
2879 (error "Your backend will not work with this version of VC mode.")) 2870 (error "Your backend will not work with this version of VC mode."))
@@ -2898,35 +2889,35 @@ log entries should be gathered."
2898 (substring rev 0 index)))) 2889 (substring rev 0 index))))
2899 2890
2900(defun vc-minor-part (rev) 2891(defun vc-minor-part (rev)
2901 "Return the minor version number of a revision number REV." 2892 "Return the minor revision number of a revision number REV."
2902 (string-match "[0-9]+\\'" rev) 2893 (string-match "[0-9]+\\'" rev)
2903 (substring rev (match-beginning 0) (match-end 0))) 2894 (substring rev (match-beginning 0) (match-end 0)))
2904 2895
2905(defun vc-default-previous-version (backend file rev) 2896(defun vc-default-previous-revision (backend file rev)
2906 "Return the version number immediately preceding REV for FILE, 2897 "Return the revision number immediately preceding REV for FILE,
2907or nil if there is no previous version. This default 2898or nil if there is no previous revision. This default
2908implementation works for MAJOR.MINOR-style version numbers as 2899implementation works for MAJOR.MINOR-style revision numbers as
2909used by RCS and CVS." 2900used by RCS and CVS."
2910 (let ((branch (vc-branch-part rev)) 2901 (let ((branch (vc-branch-part rev))
2911 (minor-num (string-to-number (vc-minor-part rev)))) 2902 (minor-num (string-to-number (vc-minor-part rev))))
2912 (when branch 2903 (when branch
2913 (if (> minor-num 1) 2904 (if (> minor-num 1)
2914 ;; version does probably not start a branch or release 2905 ;; revision does probably not start a branch or release
2915 (concat branch "." (number-to-string (1- minor-num))) 2906 (concat branch "." (number-to-string (1- minor-num)))
2916 (if (vc-trunk-p rev) 2907 (if (vc-trunk-p rev)
2917 ;; we are at the beginning of the trunk -- 2908 ;; we are at the beginning of the trunk --
2918 ;; don't know anything to return here 2909 ;; don't know anything to return here
2919 nil 2910 nil
2920 ;; we are at the beginning of a branch -- 2911 ;; we are at the beginning of a branch --
2921 ;; return version of starting point 2912 ;; return revision of starting point
2922 (vc-branch-part branch)))))) 2913 (vc-branch-part branch))))))
2923 2914
2924(defun vc-default-next-version (backend file rev) 2915(defun vc-default-next-revision (backend file rev)
2925 "Return the version number immediately following REV for FILE, 2916 "Return the revision number immediately following REV for FILE,
2926or nil if there is no next version. This default implementation 2917or nil if there is no next revision. This default implementation
2927works for MAJOR.MINOR-style version numbers as used by RCS 2918works for MAJOR.MINOR-style revision numbers as used by RCS
2928and CVS." 2919and CVS."
2929 (when (not (string= rev (vc-workfile-version file))) 2920 (when (not (string= rev (vc-working-revision file)))
2930 (let ((branch (vc-branch-part rev)) 2921 (let ((branch (vc-branch-part rev))
2931 (minor-num (string-to-number (vc-minor-part rev)))) 2922 (minor-num (string-to-number (vc-minor-part rev))))
2932 (concat branch "." (number-to-string (1+ minor-num)))))) 2923 (concat branch "." (number-to-string (1+ minor-num))))))
@@ -2944,16 +2935,16 @@ The default implementation returns t for all files."
2944(defun vc-default-latest-on-branch-p (backend file) 2935(defun vc-default-latest-on-branch-p (backend file)
2945 "Return non-nil if FILE is the latest on its branch. 2936 "Return non-nil if FILE is the latest on its branch.
2946This default implementation always returns non-nil, which means that 2937This default implementation always returns non-nil, which means that
2947editing non-current versions is not supported by default." 2938editing non-current revisions is not supported by default."
2948 t) 2939 t)
2949 2940
2950(defun vc-default-init-version (backend) vc-default-init-version) 2941(defun vc-default-init-revision (backend) vc-default-init-revision)
2951 2942
2952(defalias 'vc-cvs-update-changelog 'vc-update-changelog-rcs2log) 2943(defalias 'vc-cvs-update-changelog 'vc-update-changelog-rcs2log)
2953(defalias 'vc-rcs-update-changelog 'vc-update-changelog-rcs2log) 2944(defalias 'vc-rcs-update-changelog 'vc-update-changelog-rcs2log)
2954;; FIXME: This should probably be moved to vc-rcs.el and replaced in 2945;; FIXME: This should probably be moved to vc-rcs.el and replaced in
2955;; vc-cvs.el by code using cvs2cl. 2946;; vc-cvs.el by code using cvs2cl.
2956(defun vc-update-changelog-rcs2log (files) 2947(defun vc-update-changelog-rcs2log (backend files)
2957 "Default implementation of update-changelog. 2948 "Default implementation of update-changelog.
2958Uses `rcs2log' which only works for RCS and CVS." 2949Uses `rcs2log' which only works for RCS and CVS."
2959 ;; FIXME: We (c|sh)ould add support for cvs2cl 2950 ;; FIXME: We (c|sh)ould add support for cvs2cl
@@ -2994,7 +2985,7 @@ Uses `rcs2log' which only works for RCS and CVS."
2994 (mapcar 2985 (mapcar
2995 (lambda (f) 2986 (lambda (f)
2996 (file-relative-name 2987 (file-relative-name
2997 (expand-file-name f odefault))) 2988 (expand-file-name f odefault)))
2998 files))) 2989 files)))
2999 "done" 2990 "done"
3000 (pop-to-buffer (get-buffer-create "*vc*")) 2991 (pop-to-buffer (get-buffer-create "*vc*"))
@@ -3004,10 +2995,10 @@ Uses `rcs2log' which only works for RCS and CVS."
3004 (setq default-directory (file-name-directory changelog)) 2995 (setq default-directory (file-name-directory changelog))
3005 (delete-file tempfile))))) 2996 (delete-file tempfile)))))
3006 2997
3007(defun vc-default-find-version (backend file rev buffer) 2998(defun vc-default-find-revision (backend file rev buffer)
3008 "Provide the new `find-version' op based on the old `checkout' op. 2999 "Provide the new `find-revision' op based on the old `checkout' op.
3009This is only for compatibility with old backends. They should be updated 3000This is only for compatibility with old backends. They should be updated
3010to provide the `find-version' operation instead." 3001to provide the `find-revision' operation instead."
3011 (let ((tmpfile (make-temp-file (expand-file-name file)))) 3002 (let ((tmpfile (make-temp-file (expand-file-name file))))
3012 (unwind-protect 3003 (unwind-protect
3013 (progn 3004 (progn
@@ -3017,13 +3008,19 @@ to provide the `find-version' operation instead."
3017 (delete-file tmpfile)))) 3008 (delete-file tmpfile))))
3018 3009
3019(defun vc-default-dired-state-info (backend file) 3010(defun vc-default-dired-state-info (backend file)
3020 (let ((state (vc-state file))) 3011 (let* ((state (vc-state file))
3021 (cond 3012 (statestring
3022 ((stringp state) (concat "(" state ")")) 3013 (cond
3023 ((eq state 'edited) (concat "(" (vc-user-login-name file) ")")) 3014 ((stringp state) (concat "(" state ")"))
3024 ((eq state 'needs-merge) "(merge)") 3015 ((eq state 'edited) (concat "(" (vc-user-login-name file) ")"))
3025 ((eq state 'needs-patch) "(patch)") 3016 ((eq state 'needs-merge) "(merge)")
3026 ((eq state 'unlocked-changes) "(stale)")))) 3017 ((eq state 'needs-patch) "(patch)")
3018 ((eq state 'unlocked-changes) "(stale)")))
3019 (buffer
3020 (get-file-buffer file))
3021 (modflag
3022 (if (and buffer (buffer-modified-p buffer)) "+" "")))
3023 (concat statestring modflag)))
3027 3024
3028(defun vc-default-rename-file (backend old new) 3025(defun vc-default-rename-file (backend old new)
3029 (condition-case nil 3026 (condition-case nil
@@ -3094,7 +3091,7 @@ to provide the `find-version' operation instead."
3094 3091
3095(defun vc-default-revert (backend file contents-done) 3092(defun vc-default-revert (backend file contents-done)
3096 (unless contents-done 3093 (unless contents-done
3097 (let ((rev (vc-workfile-version file)) 3094 (let ((rev (vc-working-revision file))
3098 (file-buffer (or (get-file-buffer file) (current-buffer)))) 3095 (file-buffer (or (get-file-buffer file) (current-buffer))))
3099 (message "Checking out %s..." file) 3096 (message "Checking out %s..." file)
3100 (let ((failed t) 3097 (let ((failed t)
@@ -3111,7 +3108,7 @@ to provide the `find-version' operation instead."
3111 ;; Change buffer to get local value of vc-checkout-switches. 3108 ;; Change buffer to get local value of vc-checkout-switches.
3112 (with-current-buffer file-buffer 3109 (with-current-buffer file-buffer
3113 (let ((default-directory (file-name-directory file))) 3110 (let ((default-directory (file-name-directory file)))
3114 (vc-call find-version file rev outbuf))))) 3111 (vc-call find-revision file rev outbuf)))))
3115 (setq failed nil)) 3112 (setq failed nil))
3116 (when backup-name 3113 (when backup-name
3117 (if failed 3114 (if failed
@@ -3233,11 +3230,11 @@ cover the range from the oldest annotation to the newest."
3233 :style toggle :selected 3230 :style toggle :selected
3234 (eq vc-annotate-display-mode 'fullscale)] 3231 (eq vc-annotate-display-mode 'fullscale)]
3235 "--" 3232 "--"
3236 ["Annotate previous revision" vc-annotate-prev-version] 3233 ["Annotate previous revision" vc-annotate-prev-revision]
3237 ["Annotate next revision" vc-annotate-next-version] 3234 ["Annotate next revision" vc-annotate-next-revision]
3238 ["Annotate revision at line" vc-annotate-revision-at-line] 3235 ["Annotate revision at line" vc-annotate-revision-at-line]
3239 ["Annotate revision previous to line" vc-annotate-revision-previous-to-line] 3236 ["Annotate revision previous to line" vc-annotate-revision-previous-to-line]
3240 ["Annotate latest revision" vc-annotate-focus-version] 3237 ["Annotate latest revision" vc-annotate-working-revision]
3241 ["Show log of revision at line" vc-annotate-show-log-revision-at-line] 3238 ["Show log of revision at line" vc-annotate-show-log-revision-at-line]
3242 ["Show diff of revision at line" vc-annotate-show-diff-revision-at-line])) 3239 ["Show diff of revision at line" vc-annotate-show-diff-revision-at-line]))
3243 3240
@@ -3277,8 +3274,8 @@ default, the time scale stretches back one year into the past;
3277everything that is older than that is shown in blue. 3274everything that is older than that is shown in blue.
3278 3275
3279With a prefix argument, this command asks two questions in the 3276With a prefix argument, this command asks two questions in the
3280minibuffer. First, you may enter a version number; then the buffer 3277minibuffer. First, you may enter a revision number; then the buffer
3281displays and annotates that version instead of the current version 3278displays and annotates that revision instead of the working revision
3282\(type RET in the minibuffer to leave that default unchanged). Then, 3279\(type RET in the minibuffer to leave that default unchanged). Then,
3283you are prompted for the time span in days which the color range 3280you are prompted for the time span in days which the color range
3284should cover. For example, a time span of 20 days means that changes 3281should cover. For example, a time span of 20 days means that changes
@@ -3295,10 +3292,10 @@ colors. `vc-annotate-background' specifies the background color."
3295 (save-current-buffer 3292 (save-current-buffer
3296 (vc-ensure-vc-buffer) 3293 (vc-ensure-vc-buffer)
3297 (list buffer-file-name 3294 (list buffer-file-name
3298 (let ((def (vc-workfile-version buffer-file-name))) 3295 (let ((def (vc-working-revision buffer-file-name)))
3299 (if (null current-prefix-arg) def 3296 (if (null current-prefix-arg) def
3300 (read-string 3297 (read-string
3301 (format "Annotate from version (default %s): " def) 3298 (format "Annotate from revision (default %s): " def)
3302 nil nil def))) 3299 nil nil def)))
3303 (if (null current-prefix-arg) 3300 (if (null current-prefix-arg)
3304 vc-annotate-display-mode 3301 vc-annotate-display-mode
@@ -3347,31 +3344,31 @@ colors. `vc-annotate-background' specifies the background color."
3347 (unless (active-minibuffer-window) 3344 (unless (active-minibuffer-window)
3348 (message "Annotating... done"))))))) 3345 (message "Annotating... done")))))))
3349 3346
3350(defun vc-annotate-prev-version (prefix) 3347(defun vc-annotate-prev-revision (prefix)
3351 "Visit the annotation of the version previous to this one. 3348 "Visit the annotation of the revision previous to this one.
3352 3349
3353With a numeric prefix argument, annotate the version that many 3350With a numeric prefix argument, annotate the revision that many
3354versions previous." 3351revisions previous."
3355 (interactive "p") 3352 (interactive "p")
3356 (vc-annotate-warp-version (- 0 prefix))) 3353 (vc-annotate-warp-revision (- 0 prefix)))
3357 3354
3358(defun vc-annotate-next-version (prefix) 3355(defun vc-annotate-next-revision (prefix)
3359 "Visit the annotation of the version after this one. 3356 "Visit the annotation of the revision after this one.
3360 3357
3361With a numeric prefix argument, annotate the version that many 3358With a numeric prefix argument, annotate the revision that many
3362versions after." 3359revisions after."
3363 (interactive "p") 3360 (interactive "p")
3364 (vc-annotate-warp-version prefix)) 3361 (vc-annotate-warp-revision prefix))
3365 3362
3366(defun vc-annotate-focus-version () 3363(defun vc-annotate-working-revision ()
3367 "Visit the annotation of the focus version of this file." 3364 "Visit the annotation of the working revision of this file."
3368 (interactive) 3365 (interactive)
3369 (if (not (equal major-mode 'vc-annotate-mode)) 3366 (if (not (equal major-mode 'vc-annotate-mode))
3370 (message "Cannot be invoked outside of a vc annotate buffer") 3367 (message "Cannot be invoked outside of a vc annotate buffer")
3371 (let ((warp-rev (vc-workfile-version vc-annotate-parent-file))) 3368 (let ((warp-rev (vc-working-revision vc-annotate-parent-file)))
3372 (if (equal warp-rev vc-annotate-parent-rev) 3369 (if (equal warp-rev vc-annotate-parent-rev)
3373 (message "Already at version %s" warp-rev) 3370 (message "Already at revision %s" warp-rev)
3374 (vc-annotate-warp-version warp-rev))))) 3371 (vc-annotate-warp-revision warp-rev)))))
3375 3372
3376(defun vc-annotate-extract-revision-at-line () 3373(defun vc-annotate-extract-revision-at-line ()
3377 "Extract the revision number of the current line." 3374 "Extract the revision number of the current line."
@@ -3379,7 +3376,7 @@ versions after."
3379 (vc-call-backend vc-annotate-backend 'annotate-extract-revision-at-line)) 3376 (vc-call-backend vc-annotate-backend 'annotate-extract-revision-at-line))
3380 3377
3381(defun vc-annotate-revision-at-line () 3378(defun vc-annotate-revision-at-line ()
3382 "Visit the annotation of the version identified in the current line." 3379 "Visit the annotation of the revision identified in the current line."
3383 (interactive) 3380 (interactive)
3384 (if (not (equal major-mode 'vc-annotate-mode)) 3381 (if (not (equal major-mode 'vc-annotate-mode))
3385 (message "Cannot be invoked outside of a vc annotate buffer") 3382 (message "Cannot be invoked outside of a vc annotate buffer")
@@ -3387,11 +3384,11 @@ versions after."
3387 (if (not rev-at-line) 3384 (if (not rev-at-line)
3388 (message "Cannot extract revision number from the current line") 3385 (message "Cannot extract revision number from the current line")
3389 (if (equal rev-at-line vc-annotate-parent-rev) 3386 (if (equal rev-at-line vc-annotate-parent-rev)
3390 (message "Already at version %s" rev-at-line) 3387 (message "Already at revision %s" rev-at-line)
3391 (vc-annotate-warp-version rev-at-line)))))) 3388 (vc-annotate-warp-revision rev-at-line))))))
3392 3389
3393(defun vc-annotate-revision-previous-to-line () 3390(defun vc-annotate-revision-previous-to-line ()
3394 "Visit the annotation of the version before the version at line." 3391 "Visit the annotation of the revision before the revision at line."
3395 (interactive) 3392 (interactive)
3396 (if (not (equal major-mode 'vc-annotate-mode)) 3393 (if (not (equal major-mode 'vc-annotate-mode))
3397 (message "Cannot be invoked outside of a vc annotate buffer") 3394 (message "Cannot be invoked outside of a vc annotate buffer")
@@ -3400,11 +3397,11 @@ versions after."
3400 (if (not rev-at-line) 3397 (if (not rev-at-line)
3401 (message "Cannot extract revision number from the current line") 3398 (message "Cannot extract revision number from the current line")
3402 (setq prev-rev 3399 (setq prev-rev
3403 (vc-call previous-version vc-annotate-parent-file rev-at-line)) 3400 (vc-call previous-revision vc-annotate-parent-file rev-at-line))
3404 (vc-annotate-warp-version prev-rev))))) 3401 (vc-annotate-warp-revision prev-rev)))))
3405 3402
3406(defun vc-annotate-show-log-revision-at-line () 3403(defun vc-annotate-show-log-revision-at-line ()
3407 "Visit the log of the version at line." 3404 "Visit the log of the revision at line."
3408 (interactive) 3405 (interactive)
3409 (if (not (equal major-mode 'vc-annotate-mode)) 3406 (if (not (equal major-mode 'vc-annotate-mode))
3410 (message "Cannot be invoked outside of a vc annotate buffer") 3407 (message "Cannot be invoked outside of a vc annotate buffer")
@@ -3414,7 +3411,7 @@ versions after."
3414 (vc-print-log rev-at-line))))) 3411 (vc-print-log rev-at-line)))))
3415 3412
3416(defun vc-annotate-show-diff-revision-at-line () 3413(defun vc-annotate-show-diff-revision-at-line ()
3417 "Visit the diff of the version at line from its previous version." 3414 "Visit the diff of the revision at line from its previous revision."
3418 (interactive) 3415 (interactive)
3419 (if (not (equal major-mode 'vc-annotate-mode)) 3416 (if (not (equal major-mode 'vc-annotate-mode))
3420 (message "Cannot be invoked outside of a vc annotate buffer") 3417 (message "Cannot be invoked outside of a vc annotate buffer")
@@ -3423,19 +3420,23 @@ versions after."
3423 (if (not rev-at-line) 3420 (if (not rev-at-line)
3424 (message "Cannot extract revision number from the current line") 3421 (message "Cannot extract revision number from the current line")
3425 (setq prev-rev 3422 (setq prev-rev
3426 (vc-call previous-version vc-annotate-parent-file rev-at-line)) 3423 (vc-call previous-revision vc-annotate-parent-file rev-at-line))
3427 (if (not prev-rev) 3424 (if (not prev-rev)
3428 (message "Cannot diff from any version prior to %s" rev-at-line) 3425 (message "Cannot diff from any revision prior to %s" rev-at-line)
3429 (save-window-excursion 3426 (save-window-excursion
3430 (vc-version-diff vc-annotate-parent-file prev-rev rev-at-line)) 3427 (vc-diff-internal
3428 (vc-backend vc-annotate-parent-file)
3429 nil
3430 (list vc-annotate-parent-file)
3431 prev-rev rev-at-line))
3431 (switch-to-buffer "*vc-diff*")))))) 3432 (switch-to-buffer "*vc-diff*"))))))
3432 3433
3433(defun vc-annotate-warp-version (revspec) 3434(defun vc-annotate-warp-revision (revspec)
3434 "Annotate the version described by REVSPEC. 3435 "Annotate the revision described by REVSPEC.
3435 3436
3436If REVSPEC is a positive integer, warp that many versions 3437If REVSPEC is a positive integer, warp that many revisions
3437forward, if possible, otherwise echo a warning message. If 3438forward, if possible, otherwise echo a warning message. If
3438REVSPEC is a negative integer, warp that many versions backward, 3439REVSPEC is a negative integer, warp that many revisions backward,
3439if possible, otherwise echo a warning message. If REVSPEC is a 3440if possible, otherwise echo a warning message. If REVSPEC is a
3440string, then it describes a revision number, so warp to that 3441string, then it describes a revision number, so warp to that
3441revision." 3442revision."
@@ -3449,23 +3450,23 @@ revision."
3449 ((and (integerp revspec) (> revspec 0)) 3450 ((and (integerp revspec) (> revspec 0))
3450 (setq newrev vc-annotate-parent-rev) 3451 (setq newrev vc-annotate-parent-rev)
3451 (while (and (> revspec 0) newrev) 3452 (while (and (> revspec 0) newrev)
3452 (setq newrev (vc-call next-version 3453 (setq newrev (vc-call next-revision
3453 vc-annotate-parent-file newrev)) 3454 vc-annotate-parent-file newrev))
3454 (setq revspec (1- revspec))) 3455 (setq revspec (1- revspec)))
3455 (if (not newrev) 3456 (if (not newrev)
3456 (message "Cannot increment %d versions from version %s" 3457 (message "Cannot increment %d revisions from revision %s"
3457 revspeccopy vc-annotate-parent-rev))) 3458 revspeccopy vc-annotate-parent-rev)))
3458 ((and (integerp revspec) (< revspec 0)) 3459 ((and (integerp revspec) (< revspec 0))
3459 (setq newrev vc-annotate-parent-rev) 3460 (setq newrev vc-annotate-parent-rev)
3460 (while (and (< revspec 0) newrev) 3461 (while (and (< revspec 0) newrev)
3461 (setq newrev (vc-call previous-version 3462 (setq newrev (vc-call previous-revision
3462 vc-annotate-parent-file newrev)) 3463 vc-annotate-parent-file newrev))
3463 (setq revspec (1+ revspec))) 3464 (setq revspec (1+ revspec)))
3464 (if (not newrev) 3465 (if (not newrev)
3465 (message "Cannot decrement %d versions from version %s" 3466 (message "Cannot decrement %d revisions from revision %s"
3466 (- 0 revspeccopy) vc-annotate-parent-rev))) 3467 (- 0 revspeccopy) vc-annotate-parent-rev)))
3467 ((stringp revspec) (setq newrev revspec)) 3468 ((stringp revspec) (setq newrev revspec))
3468 (t (error "Invalid argument to vc-annotate-warp-version"))) 3469 (t (error "Invalid argument to vc-annotate-warp-revision")))
3469 (when newrev 3470 (when newrev
3470 (vc-annotate vc-annotate-parent-file newrev 3471 (vc-annotate vc-annotate-parent-file newrev
3471 vc-annotate-parent-display-mode 3472 vc-annotate-parent-display-mode
@@ -3548,19 +3549,13 @@ The annotations are relative to the current time, unless overridden by OFFSET."
3548 3549
3549;; Set up key bindings for use while editing log messages 3550;; Set up key bindings for use while editing log messages
3550 3551
3551(defun vc-log-edit (file) 3552(defun vc-log-edit (fileset)
3552 "Set up `log-edit' for use with VC on FILE." 3553 "Set up `log-edit' for use with VC on FILE."
3553 (setq default-directory 3554 (setq default-directory
3554 (if file (file-name-directory file) 3555 (with-current-buffer vc-parent-buffer default-directory))
3555 (with-current-buffer vc-parent-buffer default-directory))) 3556 (log-edit 'vc-finish-logentry nil `(lambda () ',fileset))
3556 (log-edit 'vc-finish-logentry nil 3557 (set (make-local-variable 'vc-log-fileset) fileset)
3557 (if file `(lambda () ',(list (file-name-nondirectory file))) 3558 (make-local-variable 'vc-log-revision)
3558 ;; If FILE is nil, we were called from vc-dired.
3559 (lambda ()
3560 (with-current-buffer vc-parent-buffer
3561 (dired-get-marked-files t)))))
3562 (set (make-local-variable 'vc-log-file) file)
3563 (make-local-variable 'vc-log-version)
3564 (set-buffer-modified-p nil) 3559 (set-buffer-modified-p nil)
3565 (setq buffer-file-name nil)) 3560 (setq buffer-file-name nil))
3566 3561
diff --git a/lisp/window.el b/lisp/window.el
index 41aa5aea06b..0f6ae8ab763 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -1019,10 +1019,6 @@ active. This function is run by `mouse-autoselect-window-timer'."
1019 (when mouse-autoselect-window 1019 (when mouse-autoselect-window
1020 ;; Reset state of delayed autoselection. 1020 ;; Reset state of delayed autoselection.
1021 (setq mouse-autoselect-window-state nil) 1021 (setq mouse-autoselect-window-state nil)
1022 ;; Set input focus to handle cross-frame movement. Bind
1023 ;; `focus-follows-mouse' to avoid moving the mouse cursor.
1024 (let (focus-follows-mouse)
1025 (select-frame-set-input-focus (window-frame window)))
1026 ;; Run `mouse-leave-buffer-hook' when autoselecting window. 1022 ;; Run `mouse-leave-buffer-hook' when autoselecting window.
1027 (run-hooks 'mouse-leave-buffer-hook)) 1023 (run-hooks 'mouse-leave-buffer-hook))
1028 (select-window window)))) 1024 (select-window window))))
diff --git a/lisp/woman.el b/lisp/woman.el
index c4f922f38e7..fc0100b31da 100644
--- a/lisp/woman.el
+++ b/lisp/woman.el
@@ -2716,7 +2716,7 @@ If DELETE is non-nil then delete from point."
2716(defun woman0-rename () 2716(defun woman0-rename ()
2717 "Effect renaming required by .rn requests." 2717 "Effect renaming required by .rn requests."
2718 ;; For now, do this backwards AFTER all macro expansion. 2718 ;; For now, do this backwards AFTER all macro expansion.
2719 (dolist ((new woman0-rename-alist)) 2719 (dolist (new woman0-rename-alist)
2720 (let ((old (cdr new)) 2720 (let ((old (cdr new))
2721 (new (car new))) 2721 (new (car new)))
2722 (goto-char (point-min)) 2722 (goto-char (point-min))