aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMiles Bader2006-07-06 08:59:39 +0000
committerMiles Bader2006-07-06 08:59:39 +0000
commit6a46b0188332c8007c23014bd0ba97441be6abe8 (patch)
treee6bad7efe8102d87934fbae8f1b34341cd4e4957 /lisp
parent5ed089581a49f8f0eba2d911203ff5db57eac322 (diff)
parent978db1472a9d4bbaafbc93b9176f7c409ac209bd (diff)
downloademacs-6a46b0188332c8007c23014bd0ba97441be6abe8.tar.gz
emacs-6a46b0188332c8007c23014bd0ba97441be6abe8.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 320-342) - Update from CVS - Merge from gnus--rel--5.10 - lisp/play/cookie1.el (cookie): Work properly when there's only one entry - Add note about "link" button-class to etc/TODO * gnus--rel--5.10 (patch 108-112) - Merge from emacs--devo--0 - Clean up merge mistakes - Update from CVS - Update from CVS: texi/gnus.texi (Summary Buffer Lines): Fix typo. Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-86
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog439
-rw-r--r--lisp/allout.el4
-rw-r--r--lisp/buff-menu.el2
-rw-r--r--lisp/calendar/appt.el4
-rw-r--r--lisp/calendar/calendar.el6
-rw-r--r--lisp/complete.el74
-rw-r--r--lisp/cus-edit.el23
-rw-r--r--lisp/desktop.el102
-rw-r--r--lisp/diff-mode.el54
-rw-r--r--lisp/dos-w32.el2
-rw-r--r--lisp/emacs-lisp/lisp-mode.el2
-rw-r--r--lisp/emulation/viper-init.el14
-rw-r--r--lisp/facemenu.el71
-rw-r--r--lisp/faces.el9
-rw-r--r--lisp/files.el128
-rw-r--r--lisp/generic-x.el3
-rw-r--r--lisp/gnus/ChangeLog14
-rw-r--r--lisp/gnus/gnus-diary.el2
-rw-r--r--lisp/gnus/gnus-group.el5
-rw-r--r--lisp/gnus/rfc2231.el14
-rw-r--r--lisp/help-mode.el6
-rw-r--r--lisp/help.el6
-rw-r--r--lisp/ibuffer.el5
-rw-r--r--lisp/info.el2
-rw-r--r--lisp/international/mule-cmds.el88
-rw-r--r--lisp/locate.el40
-rw-r--r--lisp/mh-e/ChangeLog45
-rw-r--r--lisp/mh-e/mh-e.el10
-rw-r--r--lisp/mh-e/mh-mime.el4
-rw-r--r--lisp/mh-e/mh-search.el9
-rw-r--r--lisp/mh-e/mh-tool-bar.el51
-rw-r--r--lisp/msb.el20
-rw-r--r--lisp/net/goto-addr.el1
-rw-r--r--lisp/net/rcirc.el8
-rw-r--r--lisp/net/rcompile.el40
-rw-r--r--lisp/net/tramp.el5
-rw-r--r--lisp/play/cookie1.el4
-rw-r--r--lisp/play/dunnet.el4
-rw-r--r--lisp/play/landmark.el2
-rw-r--r--lisp/progmodes/ada-mode.el20
-rw-r--r--lisp/progmodes/gdb-ui.el5
-rw-r--r--lisp/progmodes/grep.el6
-rw-r--r--lisp/progmodes/gud.el6
-rw-r--r--lisp/progmodes/make-mode.el22
-rw-r--r--lisp/simple.el4
-rw-r--r--lisp/term.el6
-rw-r--r--lisp/term/mac-win.el26
-rw-r--r--lisp/term/xterm.el5
-rw-r--r--lisp/textmodes/org.el1410
-rw-r--r--lisp/thingatpt.el95
-rw-r--r--lisp/tooltip.el6
-rw-r--r--lisp/vc.el45
-rw-r--r--lisp/window.el6
53 files changed, 2143 insertions, 841 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 1869e0a33f7..cb454f9a4db 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,7 +1,313 @@
12006-07-05 Richard Stallman <rms@gnu.org>
2
3 * files.el (abbreviate-file-name): Add save-match-data.
4
52006-07-03 Richard Stallman <rms@gnu.org>
6
7 * faces.el (read-face-name): Doc fix.
8
92006-07-05 Chong Yidong <cyd@stupidchicken.com>
10
11 * net/goto-addr.el (goto-address): Mark as safe for local evals.
12
132006-07-05 Andre Spiegel <spiegel@gnu.org>
14
15 * vc.el (vc-diff-internal): Fix prev change.
16
172006-07-05 Thien-Thi Nguyen <ttn@gnu.org>
18
19 * emacs-lisp/lisp-mode.el (emacs-lisp-mode-map): Use eval-buffer.
20 * play/dunnet.el (dun-load-d, dun-eval): Likewise.
21
222006-07-04 Stefan Monnier <monnier@iro.umontreal.ca>
23
24 * thingatpt.el (symbol-at-point): Don't use `form-at-point' which
25 fails if the symbol contains chars like ( or '.
26 (bounds-of-thing-at-point): Remove unused vars `end' and `beg'.
27 (thing-at-point-bounds-of-url-at-point): Remove unused vars `url' and
28 `short'.
29
302006-07-04 Kenichi Handa <handa@m17n.org>
31
32 * international/mule-cmds.el (set-language-info): If LANG-ENV is
33 the current one, don't call set-language-environment, but call one
34 of set-language-environment-XXX to make INFO effective now.
35 (set-language-environment): Call set-language-environment-XXX
36 functions instead of doing the various setups directly.
37 (set-language-environment-coding-systems): Delete argument eol-type.
38 (set-language-environment-input-method)
39 (set-language-environment-nonascii-translation)
40 (set-language-environment-charset)
41 (set-language-environment-fontset)
42 (set-language-environment-unibyte): New functions.
43
442006-07-03 Luc Teirlinck <teirllm@auburn.edu>
45
46 * locate.el (locate-update-when-revert): New option.
47 (locate-update-path): New option (suggested by Michael Albinus).
48 (locate-prompt-for-command): Whitespace change.
49 (locate-update): No longer offer to update the locate database by
50 default. Implement the two new options.
51
522006-07-04 Nick Roberts <nickrob@snap.net.nz>
53
54 * tooltip.el: Move comment about track-mouse...
55
56 * progmodes/gud.el: ...to here.
57
582006-07-03 Chong Yidong <cyd@stupidchicken.com>
59
60 * facemenu.el (facemenu-listed-faces): New var.
61 (facemenu-unlisted-faces): Variable deleted.
62 (facemenu-add-new-face): Use facemenu-listed-faces.
63
64 * emulation/viper-init.el, calendar/calendar.el:
65 * progmodes/make-mode.el: Delete calls to facemenu-unlisted-faces.
66
672006-07-03 Carsten Dominik <dominik@science.uva.nl>
68
69 * textmodes/org.el (org-mode): Remove no invalid settings for
70 calc embedded mode.
71 (org-mode-p): New defsubst.
72 (org-save-all-org-buffers): New function.
73 (org-first-headline-recenter): Enclose outline-regexp in group
74 delimiters.
75 (org-set-tags): Keep single space after stars.
76
772006-07-02 Stefan Monnier <monnier@iro.umontreal.ca>
78
79 * window.el (set-window-text-height): Only set window-min-height to
80 1 if that's the requested size.
81
82 * diff-mode.el (diff-find-file-name): Obey cvs-pcl-cvs-dirchange-re.
83 (diff-unified->context, diff-context->unified)
84 (diff-reverse-direction): Make sure the end marker stays at the end.
85 (diff-mode): Add the keymap table at the end of docstring.
86 Use lexical-let rather than constructing a closure manually.
87
88 * files.el (find-file-noselect-1): Remove unused var assignment.
89 (hack-local-variables-confirm): Print lists of strings as lists of
90 strings rather than lists of symbols.
91 (abbreviate-file-name, hack-local-variables-prop-line):
92 Use match-string.
93 (hack-one-local-variable): Move `make-local-variable' nearer its use.
94 (recover-session-finish): Use line-end-position.
95
962006-07-02 Michael Albinus <michael.albinus@gmx.de>
97
98 * net/tramp.el (tramp-handle-shell-command): Preserve current-buffer.
99
1002006-07-02 Daniel Pfeiffer <occitan@esperanto.org>
101
102 * progmodes/make-mode.el (makefile-macroassign-regex):
103 Accept preceding keyword.
104 (makefile-gmake-statements): Reorganize, now that makepp has
105 "override" and also handle forgotten "override define".
106 (makefile-makepp-statements): Add new "global", "override export"
107 and "override global".
108
1092006-06-30 Juanma Barranquero <lekktu@gmail.com>
110
111 * progmodes/ada-mode.el (ada-which-compiler, ada-mode-menu)
112 (ada-compile-mouse-goto-error, ada-deactivate-properties)
113 (ada-no-auto-case): Fix typos in docstrings.
114
1152006-06-30 Nick Roberts <nickrob@snap.net.nz>
116
117 * info.el (Info-find-node-2): Search for makeinfo version more
118 carefully.
119
1202006-06-29 Carsten Dominik <dominik@science.uva.nl>
121
122 * textmodes/org.el (org-prepare-agenda-buffers):
123 Use `invisible-OK' argument for `org-end-of-subtree'.
124 (org-export-cleanup-toc-line): Rename from `org-html-cleanup-toc-line'.
125 (org-beginning-of-item): Fix bug in regular expression for white line.
126 (org-export-as-html): Enforce space after bullet in plain list items.
127 (org-set-autofill-regexps): Require space after plain list bullet
128 for paragraph-start.
129 (org-ts-regexp3): New constant.
130 (org-at-timestamp-p): New optional argument ALSO-INACTIVE.
131 (org-timestamp-up-day, org-timestamp-down-day)
132 (org-timestamp-change): Work with inactive timestamps.
133 (org-ts-regexp1): Don't allow brackets in time stamps.
134
1352006-06-29 Nick Roberts <nickrob@snap.net.nz>
136
137 * help-mode.el (help-xref-symbol-regexp): Add property as a keyword
138 for ignoring links.
139
140 * faces.el (read-face-name): Use it.
141
1422006-06-28 Juri Linkov <juri@jurta.org>
143
144 * buff-menu.el (list-buffers-noselect): Compare Info file
145 with the string "dir" to detect Info directory.
146
147 * complete.el (partial-completion-mode): In lambda for
148 `choose-completion-string-functions' use full function signature
149 with 4 args, and move point to the end of the minibuffer only if arg
150 `mini-p' is non-nil.
151
1522006-06-28 John Paul Wallington <jpw@pobox.com>
153
154 * ibuffer.el (ibuffer-mode): Doc fix.
155
1562006-06-28 Carsten Dominik <dominik@science.uva.nl>
157
158 * textmodes/org.el (org-context): New contexts :item-bullet,
159 :latex-fragment, :latex-preview.
160 (org-overlays-at, org-overlay-start, org-overlay-end):
161 New compatibility functions.
162 (org-inside-LaTeX-fragment-p): More accurate matching, using the
163 exact regexp that will be used during export.
164 (org-latex-regexps): New variable.
165 (org-cdlatex-mode): Improve advice for `texmathp'.
166 (turn-on-org-cdlatex): New function.
167
1682006-06-28 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
169
170 * term/mac-win.el (mac-handle-font-selection): Change keys of
171 mac-atsu-font-table from strings to numbers.
172 (mac-ts-caret-position): Use also when cursor-type is nil.
173 (mac-ts-update-active-input-area): Add Mac OS Classic support.
174 Relax condition for using overlay strings.
175 Use mac-ts-caret-position face when cursor-type is nil.
176
1772006-06-26 Kim F. Storm <storm@cua.dk>
178
179 * help.el (view-emacs-news): Declare `res' in the right let* form.
180
1812006-06-25 Michael Albinus <michael.albinus@gmx.de>
182
183 * net/rcompile.el (remote-compile): Replace ange-ftp based
184 implementation by Tramp functions. Based on a patch published by
185 Marc Abramowitz <msabramo@gmail.com>.
186
187 * net/tramp.el (tramp-unload-tramp): Provide a doc string.
188
1892006-06-24 Yoshinori Koseki <kose@meadowy.org>
190
191 * international/fontset.el (setup-default-fontset): Fix a typo in
192 the "Oriya-Akruti" registry name.
193
1942006-06-23 Lars Hansen <larsh@soem.dk>
195
196 * desktop.el (desktop-full-file-name): New function.
197 (desktop-kill, desktop-save, desktop-remove, desktop-read)
198 (desktop-revert): Use it.
199 (desktop-clear, desktop-save, desktop-remove): Add autoload cookie.
200 (desktop-after-read-hook): Add option list-buffers.
201 (desktop-locals-to-save): Add tab-width.
202 (desktop-save-mode, desktop-no-desktop-file-hook, desktop-save-hook):
203 Fix docstring.
204
2052006-06-23 Carsten Dominik <dominik@science.uva.nl>
206
207 * textmodes/org.el (org-cdlatex-mode-map)
208 (org-cdlatex-texmathp-advice-is-done): New variables.
209 (org-cdlatex-mode): New minor mode.
210 (org-inside-LaTeX-fragment-p, org-try-cdlatex-tab): New functions.
211 (org-cdlatex-underscore-caret, org-cdlatex-math-modify): New commands.
212 (org-export-with-archived-trees): New option.
213 (org-open-file): Remove the call to `convert-standard-filename'.
214 (org-archive-tag, org-agenda-skip-archived-trees)
215 (org-cycle-open-archived-trees)
216 (org-sparse-tree-open-archived-trees): New options.
217 (org-cycle-hide-archived-subtrees, org-hide-archived-subtrees)
218 (org-toggle-tag, org-prepare-agenda-buffers, org-agenda-skip):
219 New functions.
220 (org-agenda-toggle-archive-tag, org-toggle-archive-tag): New commands.
221 (org-agenda-mode-map): Add binding of `org-agenda-toggle-archive-tag'.
222 (org-mode-map): Add binding for `org-toggle-archive-tag'.
223 (org-timeline, org-agenda-list, org-todo-list, org-tags-view):
224 Call `org-prepare-agenda-buffers'.
225 (org-occur, org-scan-tags): Call `org-hide-archived-subtrees'.
226 (org-file-apps, org-file-apps-defaults-gnu)
227 (org-file-apps-defaults-macosx, org-file-apps-defaults-windowsnt):
228 Handle remote files by forcing them to be opened in Emacs.
229
2302006-06-23 Andre Spiegel <spiegel@gnu.org>
231
232 * vc.el (vc-diff-knows-L): New variable.
233 (vc-diff-internal): Use it to handle "diff" programs that don't
234 understand -L. This works automatically, no user action is necessary.
235
2362006-06-23 Daniel Brockman <daniel@brockman.se>
237
238 * net/rcirc.el (rcirc-default-user-full-name): Default to
239 `rcirc-default-user-name' instead of `rcirc-user-name' (which no
240 longer exists).
241 (rcirc-process-list): Check `buffer-live-p' before attempting to
242 switch to a buffer.
243
2442006-06-23 Ryan Yeske <rcyeske@gmail.com>
245
246 * net/rcirc.el (rcirc-mode): Fix initialization of coding systems
247 based on rcirc-coding-system-alist.
248
2492006-06-23 Martin Rudalics <rudalics@gmx.at>
250
251 * cus-edit.el (customize-apropos): A better error message.
252 (top level) <debug-ignored-errors>: Extend and update the list of
253 ignored error messages.
254
2552006-06-23 Michael Ernst <mernst@alum.mit.edu>
256
257 * complete.el (PC-do-completion): Retain capitalization of user
258 input, when possible, even if completion-ignore-case is set.
259
2602006-06-23 Eli Zaretskii <eliz@gnu.org>
261
262 * generic-x.el (bat-generic-mode): Support .cmd files.
263
264 * dos-w32.el (top level): Use find-file-not-found-functions
265 instead of the obsolete find-file-not-found-hooks.
266
2672006-06-22 Kim F. Storm <storm@cua.dk>
268
269 * progmodes/grep.el (grep-mode-font-lock-keywords): Correct regexps
270 to recognize mode name containing submodes, such as Grep/lw.
271
2722006-06-21 Kim F. Storm <storm@cua.dk>
273
274 * simple.el (line-move-1): Check for move-end-of-line instead of
275 end-of-line when setting temporary-goal-column.
276
2772006-06-21 Miles Bader <miles@gnu.org>
278
279 * play/cookie1.el (cookie): Work properly when there's only one entry.
280
2812006-06-21 Nick Roberts <nickrob@snap.net.nz>
282
283 * progmodes/gdb-ui.el (gdb-exited): Ensure overlay arrow gets killed.
284 (gdb-frame-handler): Generalize frame regexp for templates.
285
2862006-06-20 Glenn Morris <rgm@gnu.org>
287
288 * calendar/appt.el (appt-display-format): Default value must be
289 one of the customize options.
290
2912006-06-20 Dan Nicolaescu <dann@ics.uci.edu>
292
293 * term/xterm.el (terminal-init-xterm): Update key availability info.
294 Bind C-return.
295
296 * term.el (term-delete-lines, term-insert-lines): Clarify comments.
297
2982006-06-20 Chong Yidong <cyd@stupidchicken.com>
299
300 * files.el (hack-local-variables): Run `hack-local-variables-hook'
301 whether or not a local variables list is defined.
302
303 * msb.el (msb): Move `sit-for' hack here to handle both
304 "mouse-down and drag" and "mouse-up and select" situations.
305 (mouse-select-buffer): Move `sit-for' hack to `msb'.
306
12006-06-20 Kenichi Handa <handa@m17n.org> 3072006-06-20 Kenichi Handa <handa@m17n.org>
2 308
3 * international/characters.el (word-combining-categories): Add 309 * international/characters.el (word-combining-categories):
4 entries for 2-byte Han characters. 310 Add entries for 2-byte Han characters.
5 311
62006-06-19 Richard Stallman <rms@gnu.org> 3122006-06-19 Richard Stallman <rms@gnu.org>
7 313
@@ -13,7 +319,7 @@
13 * mouse.el (mouse-drag-vertical-line-rightward-window): New function. 319 * mouse.el (mouse-drag-vertical-line-rightward-window): New function.
14 (mouse-drag-vertical-line): Call it. 320 (mouse-drag-vertical-line): Call it.
15 321
16 * cus-edit.el (customize-option, customize-option-other-window): 322 * cus-edit.el (customize-option, customize-option-other-window):
17 Error if SYMBOL is nil. 323 Error if SYMBOL is nil.
18 324
192006-06-19 Carsten Dominik <dominik@science.uva.nl> 3252006-06-19 Carsten Dominik <dominik@science.uva.nl>
@@ -26,72 +332,67 @@
26 (org-update-all-dblocks, org-find-dblock): New functions. 332 (org-update-all-dblocks, org-find-dblock): New functions.
27 (org-collect-clock-time-entries): New function. 333 (org-collect-clock-time-entries): New function.
28 (org-html-handle-time-stamps): Never export CLOCK timeranges. 334 (org-html-handle-time-stamps): Never export CLOCK timeranges.
29 (org-fixup-indentation): Modified to deadl correctly with lines 335 (org-fixup-indentation): Modify to deal correctly with lines
30 starting with TAB. Only one argument DIFF now. 336 starting with TAB. Only one argument DIFF now.
31 (org-demote, org-promote): Call `org-fixup-indentation' with just 337 (org-demote, org-promote): Call `org-fixup-indentation' with just
32 one argument, DIFF. 338 one argument, DIFF.
33 (org-mode): Don't mark buffer as modified when aligning tables. 339 (org-mode): Don't mark buffer as modified when aligning tables.
34 (org-clock-sum): Don't makr buffer modified when adding time sum 340 (org-clock-sum): Don't mark buffer modified when adding time sum
35 properties. 341 properties.
36 (org-export-as-html): Added support for a link validation 342 (org-export-as-html): Add support for a link validation function.
37 function.
38 (org-archive-all-done): New function. 343 (org-archive-all-done): New function.
39 (org-archive-subtree): New prefix argument. When set, archive all 344 (org-archive-subtree): New prefix argument. When set, archive all
40 done subtrees in this buffer. 345 done subtrees in this buffer.
41 (org-remove-clock-overlays) 346 (org-remove-clock-overlays)
42 (org-remove-occur-highlights): Use 347 (org-remove-occur-highlights): Use `org-inhibit-highlight-removal'.
43 `org-inhibit-highlight-removal'. 348 (org-inhibit-highlight-removal): New variable, for dynamic scoping.
44 (org-inhibit-highlight-removal): New variable, for dynamic
45 scoping.
46 (org-put-clock-overlay): Don't swallow last headline character 349 (org-put-clock-overlay): Don't swallow last headline character
47 when displaying overlay. 350 when displaying overlay.
48 (org-store-link): Link to `image-mode' with just the file name. 351 (org-store-link): Link to `image-mode' with just the file name.
49
50 352
512006-06-18 Michael Kifer <kifer@cs.stonybrook.edu> 3532006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
52 354
53 * viper-cmd.el (viper-special-read-and-insert-char): use 355 * viper-cmd.el (viper-special-read-and-insert-char):
54 read-key-sequence. 356 Use read-key-sequence.
55 (viper-after-change-undo-hook): enhancements. 357 (viper-after-change-undo-hook): Misc enhancements.
56 (viper-after-change-undo-hook): new hook. 358 (viper-after-change-undo-hook): New hook.
57 (viper-undo): use viper-after-change-undo-hook. 359 (viper-undo): Use viper-after-change-undo-hook.
58 (viper-add-newline-at-eob-if-necessary): widen before making changes. 360 (viper-add-newline-at-eob-if-necessary): Widen before making changes.
59 (viper-next-line-at-bol): If point is on a widget or a button, simulate 361 (viper-next-line-at-bol): If point is on a widget or a button, simulate
60 clicking on that widget/button. 362 clicking on that widget/button.
61 363
62 * viper.el (viper-mode): allow for a separate cursor color in Emacs 364 * viper.el (viper-mode): Allow a separate cursor color in Emacs state.
63 state. 365
64 366 * ediff-diff (ediff-test-patch-utility): Catch errors.
65 * ediff-diff (ediff-test-patch-utility): catch errors. 367 (ediff-actual-diff-options, ediff-actual-diff3-options): New variables.
66 (ediff-actual-diff-options, ediff-actual-diff3-options): new variables. 368 (ediff-set-actual-diff-options): New function.
67 (ediff-set-actual-diff-options): new function.
68 (ediff-reset-diff-options, ediff-toggle-ignore-case): 369 (ediff-reset-diff-options, ediff-toggle-ignore-case):
69 use ediff-set-actual-diff-options. 370 Use ediff-set-actual-diff-options.
70 (ediff-extract-diffs): catch errors. 371 (ediff-extract-diffs): Catch errors.
71 (ediff-whitespace): add nonbreakable space. 372 (ediff-whitespace): Add non-breakable space.
72 (ediff-same-file-contents): catch errors. 373 (ediff-same-file-contents): Catch errors.
73 374
74 * ediff-mult.el (ediff-collect-custom-diffs): save 375 * ediff-mult.el (ediff-collect-custom-diffs):
75 coding-system-for-read. 376 Save coding-system-for-read.
76 377
77 * ediff-vers.el (ediff-keep-tmp-versions): new var. 378 * ediff-vers.el (ediff-keep-tmp-versions): New variable.
78 (ediff-vc-internal, ediff-vc-merge-internal): use 379 (ediff-vc-internal, ediff-vc-merge-internal):
79 ediff-delete-version-file. 380 Use ediff-delete-version-file.
80 (ediff-delete-version-file): new function. 381 (ediff-delete-version-file): New function.
81 382
82 * ediff-wind.el (ediff-control-frame-parameters): set frame fringes. 383 * ediff-wind.el (ediff-control-frame-parameters): Set frame fringes.
83 384
84 * ediff.el (ediff-directories, ediff-directory-revisions, 385 * ediff.el (ediff-directories, ediff-directory-revisions)
85 ediff-merge-directories, ediff-merge-directories-with-ancestor, 386 (ediff-merge-directories, ediff-merge-directories-with-ancestor)
86 ediff-directories-internal, ediff-merge-directory-revisions, 387 (ediff-directories-internal, ediff-merge-directory-revisions)
87 ediff-merge-directory-revisions-with-ancestor, 388 (ediff-merge-directory-revisions-with-ancestor)
88 ediff-directories3): use read-directory-name. 389 (ediff-directories3): Use read-directory-name.
89 390
902006-06-18 Ralf Angeli <angeli@caeruleus.net> 3912006-06-18 Ralf Angeli <angeli@caeruleus.net>
91 392
92 * textmodes/tex-mode.el (tex-font-lock-match-suscript): Remove 393 * textmodes/tex-mode.el (tex-font-lock-match-suscript):
93 superfluous part of regexp for brace matching which is handled by 394 Remove superfluous part of regexp for brace matching which is handled
94 `scan-lists' call. 395 by `scan-lists' call.
95 396
962006-06-16 Richard Stallman <rms@gnu.org> 3972006-06-16 Richard Stallman <rms@gnu.org>
97 398
@@ -164,7 +465,7 @@
164 465
1652006-06-10 Carsten Dominik <dominik@science.uva.nl> 4662006-06-10 Carsten Dominik <dominik@science.uva.nl>
166 467
167 * textmodes/org.el: (org-agenda-mode-map): Add bindings for 468 * textmodes/org.el (org-agenda-mode-map): Add bindings for
168 clocking functions. 469 clocking functions.
169 470
170 (org-agenda-clock-in, org-check-running-clock) 471 (org-agenda-clock-in, org-check-running-clock)
@@ -241,7 +542,7 @@
2412006-06-06 Chong Yidong <cyd@stupidchicken.com> 5422006-06-06 Chong Yidong <cyd@stupidchicken.com>
242 543
243 * diff-mode.el (diff-mode): Set buffer-read-only to t when 544 * diff-mode.el (diff-mode): Set buffer-read-only to t when
244 diff-default-read-only is non-nill. 545 diff-default-read-only is non-nil.
245 (diff-hunk-kill, diff-file-kill, diff-split-hunk) 546 (diff-hunk-kill, diff-file-kill, diff-split-hunk)
246 (diff-refine-hunk): Set inhibit-read-only to t. 547 (diff-refine-hunk): Set inhibit-read-only to t.
247 548
@@ -252,7 +553,7 @@
252 553
2532006-06-06 Carsten Dominik <dominik@science.uva.nl> 5542006-06-06 Carsten Dominik <dominik@science.uva.nl>
254 555
255 * textmodes/org.el: (org-archive-subtree): Use end-of-subtree as 556 * textmodes/org.el (org-archive-subtree): Use end-of-subtree as
256 insertion point and control the number of empty lines. 557 insertion point and control the number of empty lines.
257 (org-paste-subtree): Limit the number of empty lines at the end of 558 (org-paste-subtree): Limit the number of empty lines at the end of
258 the inserted tree. 559 the inserted tree.
@@ -318,9 +619,9 @@
318 (authors-canonical-file-name): Don't report error for wildcards. 619 (authors-canonical-file-name): Don't report error for wildcards.
319 620
320 * help.el (view-emacs-news): Rewrite to support new NEWS, 621 * help.el (view-emacs-news): Rewrite to support new NEWS,
321 NEWS.major, and NEWS.1-17 file naming. Add more intelligense, 622 NEWS.major, and NEWS.1-17 file naming. Add more intelligence,
322 e.g. version 10 matches 1.10, and don't be confused by version 1.1 623 e.g. version 10 matches 1.10, and don't be confused by version 1.1
323 begin a prefix of 1.12 (etc). A numeric prefix arg also works. 624 being a prefix of 1.12 (etc). A numeric prefix arg also works.
324 625
3252006-06-03 Vivek Dasmohapatra <vivek@etla.org> 6262006-06-03 Vivek Dasmohapatra <vivek@etla.org>
326 627
@@ -394,7 +695,7 @@
3942006-06-02 Masatake YAMATO <jet@gyve.org> 6952006-06-02 Masatake YAMATO <jet@gyve.org>
395 696
396 * progmodes/compile.el (compilation-error-regexp-alist-alist::gcov-*): 697 * progmodes/compile.el (compilation-error-regexp-alist-alist::gcov-*):
397 Almost rewrite. Underlines over all lines of gcov output are too 698 Almost rewrite. Underlines over all lines of gcov output are too
398 uncomfortable to read. Suggested by Dan Nicolaescu. 699 uncomfortable to read. Suggested by Dan Nicolaescu.
399 700
4002006-06-01 Luc Teirlinck <teirllm@auburn.edu> 7012006-06-01 Luc Teirlinck <teirllm@auburn.edu>
@@ -438,7 +739,7 @@
4382006-05-31 Nick Roberts <nickrob@snap.net.nz> 7392006-05-31 Nick Roberts <nickrob@snap.net.nz>
439 740
440 * progmodes/gud.el (gud-query-cmdline, gud-common-init): 741 * progmodes/gud.el (gud-query-cmdline, gud-common-init):
441 Revert inadvertant changes made with last commit. 742 Revert inadvertent changes made with last commit.
442 743
4432006-05-30 Reiner Steib <Reiner.Steib@gmx.de> 7442006-05-30 Reiner Steib <Reiner.Steib@gmx.de>
444 745
@@ -449,7 +750,7 @@
449 750
4502006-05-30 Carsten Dominik <dominik@science.uva.nl> 7512006-05-30 Carsten Dominik <dominik@science.uva.nl>
451 752
452 * textmodes/org.el: (org-agenda-highlight-todo): Make sure regexp 753 * textmodes/org.el (org-agenda-highlight-todo): Make sure regexp
453 only matches in the right place. 754 only matches in the right place.
454 (org-upcoming-deadline): New face. 755 (org-upcoming-deadline): New face.
455 (org-agenda-get-deadlines): Use new face `org-upcoming-deadline'. 756 (org-agenda-get-deadlines): Use new face `org-upcoming-deadline'.
@@ -459,9 +760,10 @@
459 (org-export-as-html): Many changes to emit valid XHTML. 760 (org-export-as-html): Many changes to emit valid XHTML.
460 (org-par-open): New variable. 761 (org-par-open): New variable.
461 (org-open-par, org-close-par-maybe, org-close-li-maybe): New functions. 762 (org-open-par, org-close-par-maybe, org-close-li-maybe): New functions.
462 (org-html-do-expand, org-section-number): Fixedcase in `replace-match'. 763 (org-html-do-expand, org-section-number): Fix case in `replace-match'.
463 (org-timeline): Pass `org-timeline-show-empty-dates' to 764 (org-timeline): Pass `org-timeline-show-empty-dates' to
464 `org-get-all-dates'. Interpret empty dates returned by `org-get-all-dates'. 765 `org-get-all-dates'. Interpret empty dates returned by
766 `org-get-all-dates'.
465 (org-get-all-dates): New argument EMPTY. Add dates without 767 (org-get-all-dates): New argument EMPTY. Add dates without
466 entries to the list, mark large ranges of empty dates. 768 entries to the list, mark large ranges of empty dates.
467 (org-point-in-group, org-context): New functions. 769 (org-point-in-group, org-context): New functions.
@@ -687,7 +989,7 @@
687 989
6882006-05-26 Carsten Dominik <dominik@science.uva.nl> 9902006-05-26 Carsten Dominik <dominik@science.uva.nl>
689 991
690 * textmodes/org.el: (org-next-item, org-previous-item): Emit more 992 * textmodes/org.el (org-next-item, org-previous-item): Emit more
691 compact error message. 993 compact error message.
692 (org-tags-view): Refresh category table in each file. 994 (org-tags-view): Refresh category table in each file.
693 (org-table-justify-field-maybe): Remove superfluous arguments to 995 (org-table-justify-field-maybe): Remove superfluous arguments to
@@ -809,7 +1111,7 @@
809 1111
8102006-05-24 Carsten Dominik <dominik@science.uva.nl> 11122006-05-24 Carsten Dominik <dominik@science.uva.nl>
811 1113
812 * textmodes/org.el: (org-open-at-point): Use renamed variable 1114 * textmodes/org.el (org-open-at-point): Use renamed variable
813 `org-confirm-shell-link-function'. 1115 `org-confirm-shell-link-function'.
814 (org-confirm-shell-link-function): Rename from 1116 (org-confirm-shell-link-function): Rename from
815 `org-confirm-shell-links'. 1117 `org-confirm-shell-links'.
@@ -885,7 +1187,6 @@
885 make command. 1187 make command.
886 (org-shiftup, org-shiftdown): Accommodate the item-navigation commands. 1188 (org-shiftup, org-shiftdown): Accommodate the item-navigation commands.
887 1189
888
8892006-05-23 Thien-Thi Nguyen <ttn@gnu.org> 11902006-05-23 Thien-Thi Nguyen <ttn@gnu.org>
890 1191
891 * emacs-lisp/ewoc.el (ewoc-delete): New function. 1192 * emacs-lisp/ewoc.el (ewoc-delete): New function.
@@ -1212,7 +1513,7 @@
1212 1513
12132006-05-12 Ken Manheimer <ken.manheimer@gmail.com> 15142006-05-12 Ken Manheimer <ken.manheimer@gmail.com>
1214 1515
1215 * allout.el: (allout-view-change-hook): Mark as being deprecated, 1516 * allout.el (allout-view-change-hook): Mark as being deprecated,
1216 to be replaced by `allout-exposure-change-hook'. 1517 to be replaced by `allout-exposure-change-hook'.
1217 (allout-exposure-change-hook): New, replacing 1518 (allout-exposure-change-hook): New, replacing
1218 `allout-view-change-hook'. 1519 `allout-view-change-hook'.
@@ -1488,7 +1789,7 @@
1488 1789
14892006-05-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 17902006-05-06 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
1490 1791
1491 * term/mac-win.el: (mac-utxt-to-string): Don't make adjustment for 1792 * term/mac-win.el (mac-utxt-to-string): Don't make adjustment for
1492 MacJapanese if text is ASCII-only. 1793 MacJapanese if text is ASCII-only.
1493 1794
14942006-05-06 Nick Roberts <nickrob@snap.net.nz> 17952006-05-06 Nick Roberts <nickrob@snap.net.nz>
@@ -1575,7 +1876,7 @@
1575 1876
1576 * cus-start.el (all): Add mac-dnd-known-types. 1877 * cus-start.el (all): Add mac-dnd-known-types.
1577 1878
1578 * term/mac-win.el: (mac-utxt-to-string, mac-string-to-utxt) 1879 * term/mac-win.el (mac-utxt-to-string, mac-string-to-utxt)
1579 (mac-TEXT-to-string, mac-string-to-TEXT, mac-furl-to-string) 1880 (mac-TEXT-to-string, mac-string-to-TEXT, mac-furl-to-string)
1580 (mac-TIFF-to-string): New functions. 1881 (mac-TIFF-to-string): New functions.
1581 (x-get-selection, x-selection-value) 1882 (x-get-selection, x-selection-value)
@@ -1620,7 +1921,7 @@
16202006-05-03 Dan Nicolaescu <dann@ics.uci.edu> 19212006-05-03 Dan Nicolaescu <dann@ics.uci.edu>
1621 1922
1622 * isearch.el (isearch-update-ring): Take history-delete-duplicates 1923 * isearch.el (isearch-update-ring): Take history-delete-duplicates
1623 into consideration. Replace one arm ifs with whens. 1924 into consideration. Replace one arm ifs with whens.
1624 1925
16252006-05-03 Nick Roberts <nickrob@snap.net.nz> 19262006-05-03 Nick Roberts <nickrob@snap.net.nz>
1626 1927
@@ -1633,7 +1934,7 @@
1633 1934
16342006-05-02 Jay Belanger <belanger@truman.edu> 19352006-05-02 Jay Belanger <belanger@truman.edu>
1635 1936
1636 * calc/calc-embed.el: (calc-override-minor-modes-map) 1937 * calc/calc-embed.el (calc-override-minor-modes-map)
1637 (calc-override-minor-modes): New variables. 1938 (calc-override-minor-modes): New variables.
1638 (calc-do-embedded): Make sure that Calc keystrokes aren't 1939 (calc-do-embedded): Make sure that Calc keystrokes aren't
1639 overwritten by minor modes. 1940 overwritten by minor modes.
@@ -2616,7 +2917,7 @@
2616 (Man-abstract-xref-man-page): If Man-target-string is a function, 2917 (Man-abstract-xref-man-page): If Man-target-string is a function,
2617 call it. 2918 call it.
2618 (Man-highlight-references): Use Man-default-man-entry to get the 2919 (Man-highlight-references): Use Man-default-man-entry to get the
2619 target. Deal with xrefs too. 2920 target. Deal with xrefs too.
2620 (Man-highlight-references0): Don't call the target function. 2921 (Man-highlight-references0): Don't call the target function.
2621 2922
2622 * woman.el (WoMan-xref-man-page): Strip the section number, woman 2923 * woman.el (WoMan-xref-man-page): Strip the section number, woman
diff --git a/lisp/allout.el b/lisp/allout.el
index d6955c52cdf..2fbef5b2cd8 100644
--- a/lisp/allout.el
+++ b/lisp/allout.el
@@ -37,7 +37,7 @@
37;; - Incremental search with dynamic exposure and reconcealment of text 37;; - Incremental search with dynamic exposure and reconcealment of text
38;; - Customizable bullet format - enables programming-language specific 38;; - Customizable bullet format - enables programming-language specific
39;; outlining, for code-folding editing. (Allout code itself is to try it; 39;; outlining, for code-folding editing. (Allout code itself is to try it;
40;; formatted as an outline - do ESC-x eval-current-buffer in allout.el; but 40;; formatted as an outline - do ESC-x eval-buffer in allout.el; but
41;; emacs local file variables need to be enabled when the 41;; emacs local file variables need to be enabled when the
42;; file was visited - see `enable-local-variables'.) 42;; file was visited - see `enable-local-variables'.)
43;; - Configurable per-file initial exposure settings 43;; - Configurable per-file initial exposure settings
@@ -72,7 +72,7 @@
72;; 3.x, for those of you that depend on the old method.) 72;; 3.x, for those of you that depend on the old method.)
73;; 73;;
74;; Note - the lines beginning with `;;;_' are outline topic headers. 74;; Note - the lines beginning with `;;;_' are outline topic headers.
75;; Just `ESC-x eval-current-buffer' to give it a whirl. 75;; Just `ESC-x eval-buffer' to give it a whirl.
76 76
77;; ken manheimer (ken dot manheimer at gmail dot com) 77;; ken manheimer (ken dot manheimer at gmail dot com)
78 78
diff --git a/lisp/buff-menu.el b/lisp/buff-menu.el
index 4998c1edf07..e9e7e9a2bb8 100644
--- a/lisp/buff-menu.el
+++ b/lisp/buff-menu.el
@@ -777,7 +777,7 @@ For more information, see the function `buffer-menu'."
777 ((eq major-mode 'Info-mode) 777 ((eq major-mode 'Info-mode)
778 (setq file Info-current-file) 778 (setq file Info-current-file)
779 (cond 779 (cond
780 ((eq file t) 780 ((equal file "dir")
781 (setq file "*Info Directory*")) 781 (setq file "*Info Directory*"))
782 ((eq file 'apropos) 782 ((eq file 'apropos)
783 (setq file "*Info Apropos*")) 783 (setq file "*Info Apropos*"))
diff --git a/lisp/calendar/appt.el b/lisp/calendar/appt.el
index 5c862ee6c29..29e6fe56b6e 100644
--- a/lisp/calendar/appt.el
+++ b/lisp/calendar/appt.el
@@ -136,7 +136,9 @@ of the (obsolete) variables `appt-msg-window' and `appt-visible'."
136 :type '(choice 136 :type '(choice
137 (const :tag "Separate window" window) 137 (const :tag "Separate window" window)
138 (const :tag "Echo-area" echo) 138 (const :tag "Echo-area" echo)
139 (const :tag "No visible display" nil)) 139 (const :tag "No visible display" nil)
140 (const :tag "Backwards compatibility setting - choose another value"
141 ignore))
140 :group 'appt 142 :group 'appt
141 :version "22.1") 143 :version "22.1")
142 144
diff --git a/lisp/calendar/calendar.el b/lisp/calendar/calendar.el
index 6abcb74a3e2..38bcc887ec0 100644
--- a/lisp/calendar/calendar.el
+++ b/lisp/calendar/calendar.el
@@ -213,12 +213,6 @@ If nil, make an icon of the frame. If non-nil, delete the frame."
213;; backward-compatibility alias 213;; backward-compatibility alias
214(put 'holiday-face 'face-alias 'holiday) 214(put 'holiday-face 'face-alias 'holiday)
215 215
216(eval-after-load "facemenu"
217 '(progn
218 (add-to-list 'facemenu-unlisted-faces 'diary)
219 (add-to-list 'facemenu-unlisted-faces 'calendar-today)
220 (add-to-list 'facemenu-unlisted-faces 'holiday)))
221
222(defcustom diary-entry-marker 216(defcustom diary-entry-marker
223 (if (not (display-color-p)) 217 (if (not (display-color-p))
224 "+" 218 "+"
diff --git a/lisp/complete.el b/lisp/complete.el
index d0e3fbe8ddf..ca6231893c3 100644
--- a/lisp/complete.el
+++ b/lisp/complete.el
@@ -196,7 +196,7 @@ as much as possible and `*' characters are treated likewise in file names.
196For example, M-x p-c-m expands to M-x partial-completion-mode since no other 196For example, M-x p-c-m expands to M-x partial-completion-mode since no other
197command begins with that sequence of characters, and 197command begins with that sequence of characters, and
198\\[find-file] f_b.c TAB might complete to foo_bar.c if that file existed and no 198\\[find-file] f_b.c TAB might complete to foo_bar.c if that file existed and no
199other file in that directory begin with that sequence of characters. 199other file in that directory begins with that sequence of characters.
200 200
201Unless `PC-disable-includes' is non-nil, the `<...>' sequence is interpreted 201Unless `PC-disable-includes' is non-nil, the `<...>' sequence is interpreted
202specially in \\[find-file]. For example, 202specially in \\[find-file]. For example,
@@ -234,7 +234,9 @@ second TAB brings up the `*Completions*' buffer."
234 (funcall 234 (funcall
235 (if partial-completion-mode 'add-hook 'remove-hook) 235 (if partial-completion-mode 'add-hook 'remove-hook)
236 'choose-completion-string-functions 236 'choose-completion-string-functions
237 (lambda (&rest x) (goto-char (point-max)) nil)) 237 (lambda (choice buffer mini-p base-size)
238 (if mini-p (goto-char (point-max)))
239 nil))
238 ;; Build the env-completion and mapping table. 240 ;; Build the env-completion and mapping table.
239 (when (and partial-completion-mode (null PC-env-vars-alist)) 241 (when (and partial-completion-mode (null PC-env-vars-alist))
240 (setq PC-env-vars-alist 242 (setq PC-env-vars-alist
@@ -358,13 +360,36 @@ See `PC-complete' for details."
358The function takes no arguments, and typically looks at the value 360The function takes no arguments, and typically looks at the value
359of `minibuffer-completion-table' and the minibuffer contents.") 361of `minibuffer-completion-table' and the minibuffer contents.")
360 362
363;; Returns the sequence of non-delimiter characters that follow regexp in string.
364(defun PC-chunk-after (string regexp)
365 (if (not (string-match regexp string))
366 (let ((message (format "String %s didn't match regexp %s" string regexp)))
367 (message message)
368 (error message)))
369 (let ((result (substring string (match-end 0))))
370 ;; result may contain multiple chunks
371 (if (string-match PC-delim-regex result)
372 (setq result (substring result 0 (match-beginning 0))))
373 result))
374
375(defun test-completion-ignore-case (str table pred)
376 "Like `test-completion', but ignores case when possible."
377 ;; Binding completion-ignore-case to nil ensures, for compatibility with
378 ;; standard completion, that the return value is exactly one of the
379 ;; possibilities. Do this binding only if pred is nil, out of paranoia;
380 ;; perhaps it is safe even if pred is non-nil.
381 (if pred
382 (test-completion str table pred)
383 (let ((completion-ignore-case nil))
384 (test-completion str table pred))))
385
361(defun PC-do-completion (&optional mode beg end) 386(defun PC-do-completion (&optional mode beg end)
362 (or beg (setq beg (minibuffer-prompt-end))) 387 (or beg (setq beg (minibuffer-prompt-end)))
363 (or end (setq end (point-max))) 388 (or end (setq end (point-max)))
364 (let* ((table minibuffer-completion-table) 389 (let* ((table minibuffer-completion-table)
365 (pred minibuffer-completion-predicate) 390 (pred minibuffer-completion-predicate)
366 (filename (funcall PC-completion-as-file-name-predicate)) 391 (filename (funcall PC-completion-as-file-name-predicate))
367 (dirname nil) 392 (dirname nil) ; non-nil only if a filename is being completed
368 (dirlength 0) 393 (dirlength 0)
369 (str (buffer-substring beg end)) 394 (str (buffer-substring beg end))
370 (incname (and filename (string-match "<\\([^\"<>]*\\)>?$" str))) 395 (incname (and filename (string-match "<\\([^\"<>]*\\)>?$" str)))
@@ -379,7 +404,7 @@ of `minibuffer-completion-table' and the minibuffer contents.")
379 404
380 ;; Check if buffer contents can already be considered complete 405 ;; Check if buffer contents can already be considered complete
381 (if (and (eq mode 'exit) 406 (if (and (eq mode 'exit)
382 (test-completion str table pred)) 407 (test-completion-ignore-case str table pred))
383 'complete 408 'complete
384 409
385 ;; Do substitutions in directory names 410 ;; Do substitutions in directory names
@@ -598,35 +623,38 @@ of `minibuffer-completion-table' and the minibuffer contents.")
598 623
599 ;; Check if next few letters are the same in all cases 624 ;; Check if next few letters are the same in all cases
600 (if (and (not (eq mode 'help)) 625 (if (and (not (eq mode 'help))
601 (setq prefix (try-completion "" (mapcar 'list poss)))) 626 (setq prefix (try-completion (PC-chunk-after basestr skip) (mapcar 'list poss))))
602 (let ((first t) i) 627 (let ((first t) i)
628 ;; Retain capitalization of user input even if
629 ;; completion-ignore-case is set.
603 (if (eq mode 'word) 630 (if (eq mode 'word)
604 (setq prefix (PC-chop-word prefix basestr))) 631 (setq prefix (PC-chop-word prefix basestr)))
605 (goto-char (+ beg (length dirname))) 632 (goto-char (+ beg (length dirname)))
606 (while (and (progn 633 (while (and (progn
607 (setq i 0) 634 (setq i 0) ; index into prefix string
608 (while (< i (length prefix)) 635 (while (< i (length prefix))
609 (if (and (< (point) end) 636 (if (and (< (point) end)
610 (eq (aref prefix i) 637 (eq (downcase (aref prefix i))
611 (following-char))) 638 (downcase (following-char))))
639 ;; same char (modulo case); no action
612 (forward-char 1) 640 (forward-char 1)
613 (if (and (< (point) end) 641 (if (and (< (point) end)
614 (or (and (looking-at " ") 642 (and (looking-at " ")
615 (memq (aref prefix i) 643 (memq (aref prefix i)
616 PC-delims-list)) 644 PC-delims-list)))
617 (eq (downcase (aref prefix i)) 645 ;; replace " " by the actual delimiter
618 (downcase
619 (following-char)))))
620 (progn 646 (progn
621 (delete-char 1) 647 (delete-char 1)
622 (setq end (1- end))) 648 (insert (substring prefix i (1+ i))))
649 ;; insert a new character
650 (progn
623 (and filename (looking-at "\\*") 651 (and filename (looking-at "\\*")
624 (progn 652 (progn
625 (delete-char 1) 653 (delete-char 1)
626 (setq end (1- end)))) 654 (setq end (1- end))))
627 (setq improved t)) 655 (setq improved t)
628 (insert (substring prefix i (1+ i))) 656 (insert (substring prefix i (1+ i)))
629 (setq end (1+ end))) 657 (setq end (1+ end)))))
630 (setq i (1+ i))) 658 (setq i (1+ i)))
631 (or pt (setq pt (point))) 659 (or pt (setq pt (point)))
632 (looking-at PC-delim-regex)) 660 (looking-at PC-delim-regex))
@@ -634,7 +662,12 @@ of `minibuffer-completion-table' and the minibuffer contents.")
634 (regexp-quote prefix) 662 (regexp-quote prefix)
635 PC-ndelims-regex) 663 PC-ndelims-regex)
636 prefix (try-completion 664 prefix (try-completion
637 "" 665 (PC-chunk-after
666 ;; not basestr, because that does
667 ;; not reflect insertions
668 (buffer-substring
669 (+ beg (length dirname)) end)
670 skip)
638 (mapcar 671 (mapcar
639 (function 672 (function
640 (lambda (x) 673 (lambda (x)
@@ -666,7 +699,7 @@ of `minibuffer-completion-table' and the minibuffer contents.")
666 699
667 ;; We changed it... enough to be complete? 700 ;; We changed it... enough to be complete?
668 (and (eq mode 'exit) 701 (and (eq mode 'exit)
669 (test-completion (field-string) table pred)) 702 (test-completion-ignore-case (field-string) table pred))
670 703
671 ;; If totally ambiguous, display a list of completions 704 ;; If totally ambiguous, display a list of completions
672 (if (or (eq completion-auto-help t) 705 (if (or (eq completion-auto-help t)
@@ -950,11 +983,10 @@ absolute rather than relative to some directory on the SEARCH-PATH."
950 (if (string-match "<\\([^\"<>]*\\)>?\\'" (ad-get-arg 0)) 983 (if (string-match "<\\([^\"<>]*\\)>?\\'" (ad-get-arg 0))
951 (let* ((string (ad-get-arg 0)) 984 (let* ((string (ad-get-arg 0))
952 (action (ad-get-arg 2)) 985 (action (ad-get-arg 2))
953 (name (match-string 1 string)) 986 (name (substring string (match-beginning 1) (match-end 1)))
954 (str2 (substring string (match-beginning 0))) 987 (str2 (substring string (match-beginning 0)))
955 (completion-table 988 (completion-table
956 (mapcar (lambda (x) 989 (mapcar (lambda (x) (format "<%s>" x))
957 (format (if (string-match "/\\'" x) "<%s" "<%s>") x))
958 (PC-include-file-all-completions 990 (PC-include-file-all-completions
959 name (PC-include-file-path))))) 991 name (PC-include-file-path)))))
960 (setq ad-return-value 992 (setq ad-return-value
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 53f92f2243b..d7ffab4bc5b 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -1366,10 +1366,10 @@ that are not customizable options, as well as faces and groups
1366 (get symbol 'variable-documentation)))) 1366 (get symbol 'variable-documentation))))
1367 (push (list symbol 'custom-variable) found))))) 1367 (push (list symbol 'custom-variable) found)))))
1368 (if (not found) 1368 (if (not found)
1369 (error "No matches") 1369 (error "No customizable items matching %s" regexp)
1370 (custom-buffer-create (custom-sort-items found t 1370 (custom-buffer-create
1371 custom-buffer-order-groups) 1371 (custom-sort-items found t custom-buffer-order-groups)
1372 "*Customize Apropos*")))) 1372 "*Customize Apropos*"))))
1373 1373
1374;;;###autoload 1374;;;###autoload
1375(defun customize-apropos-options (regexp &optional arg) 1375(defun customize-apropos-options (regexp &optional arg)
@@ -4520,9 +4520,18 @@ if that value is non-nil."
4520 4520
4521(put 'custom-mode 'mode-class 'special) 4521(put 'custom-mode 'mode-class 'special)
4522 4522
4523(add-to-list 4523(dolist (regexp
4524 'debug-ignored-errors 4524 '("^No user option defaults have been changed since Emacs "
4525 "^No user options have changed defaults in recent Emacs versions$") 4525 "^Invalid face:? "
4526 "^No \\(?:customized\\|rogue\\|saved\\) user options"
4527 "^No customizable items matching "
4528 "^There are unset changes"
4529 "^Cannot set hidden variable"
4530 "^No \\(?:saved\\|backup\\) value for "
4531 "^No standard setting known for "
4532 "^No standard setting for this face"
4533 "^Saving settings from \"emacs -q\" would overwrite existing customizations"))
4534 (add-to-list 'debug-ignored-errors regexp))
4526 4535
4527;;; The End. 4536;;; The End.
4528 4537
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 69815117bc2..ded83bc8944 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -153,8 +153,9 @@ backward compatibility.")
153(define-minor-mode desktop-save-mode 153(define-minor-mode desktop-save-mode
154 "Toggle desktop saving mode. 154 "Toggle desktop saving mode.
155With numeric ARG, turn desktop saving on if ARG is positive, off 155With numeric ARG, turn desktop saving on if ARG is positive, off
156otherwise. See variable `desktop-save' for a description of when the 156otherwise. If desktop saving is turned on, the state of Emacs is
157desktop is saved." 157saved from one session to another. See variable `desktop-save'
158and function `desktop-read' for details."
158 :global t 159 :global t
159 :group 'desktop) 160 :group 'desktop)
160 161
@@ -175,7 +176,8 @@ Possible values are:
175The desktop is never saved when `desktop-save-mode' is nil. 176The desktop is never saved when `desktop-save-mode' is nil.
176The variables `desktop-dirname' and `desktop-base-file-name' 177The variables `desktop-dirname' and `desktop-base-file-name'
177determine where the desktop is saved." 178determine where the desktop is saved."
178 :type '(choice 179 :type
180 '(choice
179 (const :tag "Always save" t) 181 (const :tag "Always save" t)
180 (const :tag "Always ask" ask) 182 (const :tag "Always ask" ask)
181 (const :tag "Ask if desktop file is new, else do save" ask-if-new) 183 (const :tag "Ask if desktop file is new, else do save" ask-if-new)
@@ -212,6 +214,7 @@ If nil, just print error messages in the message buffer."
212 214
213(defcustom desktop-no-desktop-file-hook nil 215(defcustom desktop-no-desktop-file-hook nil
214 "Normal hook run when `desktop-read' can't find a desktop file. 216 "Normal hook run when `desktop-read' can't find a desktop file.
217Run in the directory in which the desktop file was sought.
215May be used to show a dired buffer." 218May be used to show a dired buffer."
216 :type 'hook 219 :type 'hook
217 :group 'desktop 220 :group 'desktop
@@ -222,11 +225,14 @@ May be used to show a dired buffer."
222May be used to show a buffer list." 225May be used to show a buffer list."
223 :type 'hook 226 :type 'hook
224 :group 'desktop 227 :group 'desktop
228 :options '(list-buffers)
225 :version "22.1") 229 :version "22.1")
226 230
227(defcustom desktop-save-hook nil 231(defcustom desktop-save-hook nil
228 "Normal hook run before the desktop is saved in a desktop file. 232 "Normal hook run before the desktop is saved in a desktop file.
229This is useful for truncating history lists, for example." 233Run with the desktop buffer current with only the header present.
234May be used to add to the desktop code or to truncate history lists,
235for example."
230 :type 'hook 236 :type 'hook
231 :group 'desktop) 237 :group 'desktop)
232 238
@@ -282,6 +288,7 @@ these won't be deleted."
282 size-indication-mode 288 size-indication-mode
283 buffer-file-coding-system 289 buffer-file-coding-system
284 indent-tabs-mode 290 indent-tabs-mode
291 tab-width
285 indicate-buffer-boundaries 292 indicate-buffer-boundaries
286 indicate-empty-lines 293 indicate-empty-lines
287 show-trailing-whitespace) 294 show-trailing-whitespace)
@@ -475,6 +482,11 @@ See also `desktop-minor-mode-table'.")
475(defvar desktop-dirname nil 482(defvar desktop-dirname nil
476 "The directory in which the desktop file should be saved.") 483 "The directory in which the desktop file should be saved.")
477 484
485(defun desktop-full-file-name (&optional dirname)
486 "Return the full name of the desktop file in DIRNAME.
487DIRNAME omitted or nil means use `desktop-dirname'."
488 (expand-file-name desktop-base-file-name (or dirname desktop-dirname)))
489
478(defconst desktop-header 490(defconst desktop-header
479";; -------------------------------------------------------------------------- 491";; --------------------------------------------------------------------------
480;; Desktop File for Emacs 492;; Desktop File for Emacs
@@ -492,6 +504,7 @@ See also `desktop-minor-mode-table'.")
492 (setcdr here nil)))) 504 (setcdr here nil))))
493 505
494;; ---------------------------------------------------------------------------- 506;; ----------------------------------------------------------------------------
507;;;###autoload
495(defun desktop-clear () 508(defun desktop-clear ()
496 "Empty the Desktop. 509 "Empty the Desktop.
497This kills all buffers except for internal ones and those with names matched by 510This kills all buffers except for internal ones and those with names matched by
@@ -528,29 +541,26 @@ Furthermore, it clears the variables listed in `desktop-globals-to-clear'."
528 "If `desktop-save-mode' is non-nil, do what `desktop-save' says to do. 541 "If `desktop-save-mode' is non-nil, do what `desktop-save' says to do.
529If the desktop should be saved and `desktop-dirname' 542If the desktop should be saved and `desktop-dirname'
530is nil, ask the user where to save the desktop." 543is nil, ask the user where to save the desktop."
531 (when 544 (when (and desktop-save-mode
532 (and 545 (let ((exists (file-exists-p (desktop-full-file-name))))
533 desktop-save-mode 546 (or (eq desktop-save t)
534 (let ((exists (file-exists-p (expand-file-name desktop-base-file-name desktop-dirname)))) 547 (and exists (memq desktop-save '(ask-if-new if-exists)))
535 (or 548 (and
536 (eq desktop-save t) 549 (or (memq desktop-save '(ask ask-if-new))
537 (and exists (memq desktop-save '(ask-if-new if-exists))) 550 (and exists (eq desktop-save 'ask-if-exists)))
538 (and 551 (y-or-n-p "Save desktop? ")))))
539 (or
540 (memq desktop-save '(ask ask-if-new))
541 (and exists (eq desktop-save 'ask-if-exists)))
542 (y-or-n-p "Save desktop? ")))))
543 (unless desktop-dirname 552 (unless desktop-dirname
544 (setq desktop-dirname 553 (setq desktop-dirname
545 (file-name-as-directory 554 (file-name-as-directory
546 (expand-file-name 555 (expand-file-name
547 (call-interactively 556 (call-interactively
548 (lambda (dir) (interactive "DDirectory for desktop file: ") dir)))))) 557 (lambda (dir)
558 (interactive "DDirectory for desktop file: ") dir))))))
549 (condition-case err 559 (condition-case err
550 (desktop-save desktop-dirname) 560 (desktop-save desktop-dirname)
551 (file-error 561 (file-error
552 (unless (yes-or-no-p "Error while saving the desktop. Ignore? ") 562 (unless (yes-or-no-p "Error while saving the desktop. Ignore? ")
553 (signal (car err) (cdr err))))))) 563 (signal (car err) (cdr err)))))))
554 564
555;; ---------------------------------------------------------------------------- 565;; ----------------------------------------------------------------------------
556(defun desktop-list* (&rest args) 566(defun desktop-list* (&rest args)
@@ -715,6 +725,7 @@ DIRNAME must be the directory in which the desktop file will be saved."
715 (t (expand-file-name filename)))) 725 (t (expand-file-name filename))))
716 726
717;; ---------------------------------------------------------------------------- 727;; ----------------------------------------------------------------------------
728;;;###autoload
718(defun desktop-save (dirname) 729(defun desktop-save (dirname)
719 "Save the desktop in a desktop file. 730 "Save the desktop in a desktop file.
720Parameter DIRNAME specifies where to save the desktop file. 731Parameter DIRNAME specifies where to save the desktop file.
@@ -723,7 +734,7 @@ See also `desktop-base-file-name'."
723 (run-hooks 'desktop-save-hook) 734 (run-hooks 'desktop-save-hook)
724 (setq dirname (file-name-as-directory (expand-file-name dirname))) 735 (setq dirname (file-name-as-directory (expand-file-name dirname)))
725 (save-excursion 736 (save-excursion
726 (let ((filename (expand-file-name desktop-base-file-name dirname)) 737 (let ((filename (desktop-full-file-name dirname))
727 (info 738 (info
728 (mapcar 739 (mapcar
729 #'(lambda (b) 740 #'(lambda (b)
@@ -802,12 +813,13 @@ See also `desktop-base-file-name'."
802 (setq desktop-dirname dirname)) 813 (setq desktop-dirname dirname))
803 814
804;; ---------------------------------------------------------------------------- 815;; ----------------------------------------------------------------------------
816;;;###autoload
805(defun desktop-remove () 817(defun desktop-remove ()
806 "Delete desktop file in `desktop-dirname'. 818 "Delete desktop file in `desktop-dirname'.
807This function also sets `desktop-dirname' to nil." 819This function also sets `desktop-dirname' to nil."
808 (interactive) 820 (interactive)
809 (when desktop-dirname 821 (when desktop-dirname
810 (let ((filename (expand-file-name desktop-base-file-name desktop-dirname))) 822 (let ((filename (desktop-full-file-name)))
811 (setq desktop-dirname nil) 823 (setq desktop-dirname nil)
812 (when (file-exists-p filename) 824 (when (file-exists-p filename)
813 (delete-file filename))))) 825 (delete-file filename)))))
@@ -830,32 +842,30 @@ It returns t if a desktop file was loaded, nil otherwise."
830 (interactive) 842 (interactive)
831 (unless noninteractive 843 (unless noninteractive
832 (setq desktop-dirname 844 (setq desktop-dirname
833 (file-name-as-directory 845 (file-name-as-directory
834 (expand-file-name 846 (expand-file-name
835 (or 847 (or
836 ;; If DIRNAME is specified, use it. 848 ;; If DIRNAME is specified, use it.
837 (and (< 0 (length dirname)) dirname) 849 (and (< 0 (length dirname)) dirname)
838 ;; Otherwise search desktop file in desktop-path. 850 ;; Otherwise search desktop file in desktop-path.
839 (let ((dirs desktop-path)) 851 (let ((dirs desktop-path))
840 (while 852 (while (and dirs
841 (and 853 (not (file-exists-p
842 dirs 854 (desktop-full-file-name (car dirs)))))
843 (not 855 (setq dirs (cdr dirs)))
844 (file-exists-p (expand-file-name desktop-base-file-name (car dirs))))) 856 (and dirs (car dirs)))
845 (setq dirs (cdr dirs))) 857 ;; If not found and `desktop-path' is non-nil, use its first element.
846 (and dirs (car dirs))) 858 (and desktop-path (car desktop-path))
847 ;; If not found and `desktop-path' is non-nil, use its first element. 859 ;; Default: Home directory.
848 (and desktop-path (car desktop-path)) 860 "~"))))
849 ;; Default: Home directory. 861 (if (file-exists-p (desktop-full-file-name))
850 "~"))))
851 (if (file-exists-p (expand-file-name desktop-base-file-name desktop-dirname))
852 ;; Desktop file found, process it. 862 ;; Desktop file found, process it.
853 (let ((desktop-first-buffer nil) 863 (let ((desktop-first-buffer nil)
854 (desktop-buffer-ok-count 0) 864 (desktop-buffer-ok-count 0)
855 (desktop-buffer-fail-count 0)) 865 (desktop-buffer-fail-count 0))
856 (setq desktop-lazy-timer nil) 866 (setq desktop-lazy-timer nil)
857 ;; Evaluate desktop buffer. 867 ;; Evaluate desktop buffer.
858 (load (expand-file-name desktop-base-file-name desktop-dirname) t t t) 868 (load (desktop-full-file-name) t t t)
859 ;; `desktop-create-buffer' puts buffers at end of the buffer list. 869 ;; `desktop-create-buffer' puts buffers at end of the buffer list.
860 ;; We want buffers existing prior to evaluating the desktop (and not reused) 870 ;; We want buffers existing prior to evaluating the desktop (and not reused)
861 ;; to be placed at the end of the buffer list, so we move them here. 871 ;; to be placed at the end of the buffer list, so we move them here.
@@ -925,7 +935,7 @@ directory DIRNAME."
925 (interactive) 935 (interactive)
926 (unless desktop-dirname 936 (unless desktop-dirname
927 (error "Unknown desktop directory")) 937 (error "Unknown desktop directory"))
928 (unless (file-exists-p (expand-file-name desktop-base-file-name desktop-dirname)) 938 (unless (file-exists-p (desktop-full-file-name))
929 (error "No desktop file found")) 939 (error "No desktop file found"))
930 (desktop-clear) 940 (desktop-clear)
931 (desktop-read desktop-dirname)) 941 (desktop-read desktop-dirname))
diff --git a/lisp/diff-mode.el b/lisp/diff-mode.el
index 7ea02352b0b..16bdaf152f7 100644
--- a/lisp/diff-mode.el
+++ b/lisp/diff-mode.el
@@ -46,13 +46,15 @@
46;; of a hunk. Show then the changes between <file> and <hunk> and make it 46;; of a hunk. Show then the changes between <file> and <hunk> and make it
47;; possible to apply them to <file>, <hunk-src>, or <hunk-dst>. 47;; possible to apply them to <file>, <hunk-src>, or <hunk-dst>.
48;; Or maybe just make it into a ".rej to diff3-markers converter". 48;; Or maybe just make it into a ".rej to diff3-markers converter".
49;; Maybe just use `wiggle' (by Neil Brown) to do it for us.
49;; 50;;
50;; - Refine hunk on a word-by-word basis. 51;; - Refine hunk on a word-by-word basis.
51;; 52;;
53;; - in diff-apply-hunk, strip context in replace-match to better
54;; preserve markers and spacing.
52;; - Handle `diff -b' output in context->unified. 55;; - Handle `diff -b' output in context->unified.
53 56
54;;; Code: 57;;; Code:
55
56(eval-when-compile (require 'cl)) 58(eval-when-compile (require 'cl))
57 59
58(defvar add-log-buffer-file-name-function) 60(defvar add-log-buffer-file-name-function)
@@ -128,14 +130,14 @@ when editing big diffs)."
128 ;;("h" . diff-show-header) 130 ;;("h" . diff-show-header)
129 ;;("j" . diff-show-difference) ;jump to Nth diff 131 ;;("j" . diff-show-difference) ;jump to Nth diff
130 ;;("q" . diff-quit) 132 ;;("q" . diff-quit)
131;; Not useful if you have to metafy them. 133 ;; Not useful if you have to metafy them.
132;; (" " . scroll-up) 134 ;;(" " . scroll-up)
133;; ("\177" . scroll-down) 135 ;;("\177" . scroll-down)
134;; Standard M-a is useful, so don't change M-A. 136 ;; Standard M-a is useful, so don't change M-A.
135;; ("A" . diff-ediff-patch) 137 ;;("A" . diff-ediff-patch)
136;; Standard M-r is useful, so don't change M-r or M-R. 138 ;; Standard M-r is useful, so don't change M-r or M-R.
137;; ("r" . diff-restrict-view) 139 ;;("r" . diff-restrict-view)
138;; ("R" . diff-reverse-direction) 140 ;;("R" . diff-reverse-direction)
139 ("q" . quit-window)) 141 ("q" . quit-window))
140 "Basic keymap for `diff-mode', bound to various prefix keys.") 142 "Basic keymap for `diff-mode', bound to various prefix keys.")
141 143
@@ -581,14 +583,16 @@ If the OLD prefix arg is passed, tell the file NAME of the old file."
581 (list (if old (match-string 2) (match-string 4)) 583 (list (if old (match-string 2) (match-string 4))
582 (if old (match-string 4) (match-string 2))))))))) 584 (if old (match-string 4) (match-string 2)))))))))
583 585
584(defun diff-find-file-name (&optional old) 586(defun diff-find-file-name (&optional old prefix)
585 "Return the file corresponding to the current patch. 587 "Return the file corresponding to the current patch.
586Non-nil OLD means that we want the old file." 588Non-nil OLD means that we want the old file.
589PREFIX is only used internally: don't use it."
587 (save-excursion 590 (save-excursion
588 (unless (looking-at diff-file-header-re) 591 (unless (looking-at diff-file-header-re)
589 (or (ignore-errors (diff-beginning-of-file)) 592 (or (ignore-errors (diff-beginning-of-file))
590 (re-search-forward diff-file-header-re nil t))) 593 (re-search-forward diff-file-header-re nil t)))
591 (let ((fs (diff-hunk-file-names old))) 594 (let ((fs (diff-hunk-file-names old)))
595 (if prefix (setq fs (mapcar (lambda (f) (concat prefix f)) fs)))
592 (or 596 (or
593 ;; use any previously used preference 597 ;; use any previously used preference
594 (cdr (assoc fs diff-remembered-files-alist)) 598 (cdr (assoc fs diff-remembered-files-alist))
@@ -610,6 +614,13 @@ Non-nil OLD means that we want the old file."
610 (and (string-match "\\.rej\\'" (or buffer-file-name "")) 614 (and (string-match "\\.rej\\'" (or buffer-file-name ""))
611 (let ((file (substring buffer-file-name 0 (match-beginning 0)))) 615 (let ((file (substring buffer-file-name 0 (match-beginning 0))))
612 (when (file-exists-p file) file))) 616 (when (file-exists-p file) file)))
617 ;; If we haven't found the file, maybe it's because we haven't paid
618 ;; attention to the PCL-CVS hint.
619 (and (not prefix)
620 (boundp 'cvs-pcl-cvs-dirchange-re)
621 (save-excursion
622 (re-search-backward cvs-pcl-cvs-dirchange-re nil t))
623 (diff-find-file-name old (match-string 1)))
613 ;; if all else fails, ask the user 624 ;; if all else fails, ask the user
614 (let ((file (read-file-name (format "Use file %s: " (or (first fs) "")) 625 (let ((file (read-file-name (format "Use file %s: " (or (first fs) ""))
615 nil (first fs) t (first fs)))) 626 nil (first fs) t (first fs))))
@@ -639,7 +650,7 @@ else cover the whole bufer."
639 (interactive (if (or current-prefix-arg (and transient-mark-mode mark-active)) 650 (interactive (if (or current-prefix-arg (and transient-mark-mode mark-active))
640 (list (region-beginning) (region-end)) 651 (list (region-beginning) (region-end))
641 (list (point-min) (point-max)))) 652 (list (point-min) (point-max))))
642 (unless (markerp end) (setq end (copy-marker end))) 653 (unless (markerp end) (setq end (copy-marker end t)))
643 (let (;;(diff-inhibit-after-change t) 654 (let (;;(diff-inhibit-after-change t)
644 (inhibit-read-only t)) 655 (inhibit-read-only t))
645 (save-excursion 656 (save-excursion
@@ -729,7 +740,7 @@ With a prefix argument, convert unified format to context format."
729 (list (point-min) (point-max) current-prefix-arg))) 740 (list (point-min) (point-max) current-prefix-arg)))
730 (if to-context 741 (if to-context
731 (diff-unified->context start end) 742 (diff-unified->context start end)
732 (unless (markerp end) (setq end (copy-marker end))) 743 (unless (markerp end) (setq end (copy-marker end t)))
733 (let ( ;;(diff-inhibit-after-change t) 744 (let ( ;;(diff-inhibit-after-change t)
734 (inhibit-read-only t)) 745 (inhibit-read-only t))
735 (save-excursion 746 (save-excursion
@@ -801,7 +812,7 @@ else cover the whole bufer."
801 (interactive (if (or current-prefix-arg (and transient-mark-mode mark-active)) 812 (interactive (if (or current-prefix-arg (and transient-mark-mode mark-active))
802 (list (region-beginning) (region-end)) 813 (list (region-beginning) (region-end))
803 (list (point-min) (point-max)))) 814 (list (point-min) (point-max))))
804 (unless (markerp end) (setq end (copy-marker end))) 815 (unless (markerp end) (setq end (copy-marker end t)))
805 (let (;;(diff-inhibit-after-change t) 816 (let (;;(diff-inhibit-after-change t)
806 (inhibit-read-only t)) 817 (inhibit-read-only t))
807 (save-excursion 818 (save-excursion
@@ -979,7 +990,8 @@ headers for you on-the-fly.
979 990
980You can also switch between context diff and unified diff with \\[diff-context->unified], 991You can also switch between context diff and unified diff with \\[diff-context->unified],
981or vice versa with \\[diff-unified->context] and you can also reverse the direction of 992or vice versa with \\[diff-unified->context] and you can also reverse the direction of
982a diff with \\[diff-reverse-direction]." 993a diff with \\[diff-reverse-direction].
994\\{diff-mode-map}"
983 (set (make-local-variable 'font-lock-defaults) diff-font-lock-defaults) 995 (set (make-local-variable 'font-lock-defaults) diff-font-lock-defaults)
984 (set (make-local-variable 'outline-regexp) diff-outline-regexp) 996 (set (make-local-variable 'outline-regexp) diff-outline-regexp)
985 (set (make-local-variable 'imenu-generic-expression) 997 (set (make-local-variable 'imenu-generic-expression)
@@ -1004,13 +1016,13 @@ a diff with \\[diff-reverse-direction]."
1004 (add-hook 'after-change-functions 'diff-after-change-function nil t) 1016 (add-hook 'after-change-functions 'diff-after-change-function nil t)
1005 (add-hook 'post-command-hook 'diff-post-command-hook nil t)) 1017 (add-hook 'post-command-hook 'diff-post-command-hook nil t))
1006 ;; Neat trick from Dave Love to add more bindings in read-only mode: 1018 ;; Neat trick from Dave Love to add more bindings in read-only mode:
1007 (let ((ro-bind (cons 'buffer-read-only diff-mode-shared-map))) 1019 (lexical-let ((ro-bind (cons 'buffer-read-only diff-mode-shared-map)))
1008 (add-to-list 'minor-mode-overriding-map-alist ro-bind) 1020 (add-to-list 'minor-mode-overriding-map-alist ro-bind)
1009 ;; Turn off this little trick in case the buffer is put in view-mode. 1021 ;; Turn off this little trick in case the buffer is put in view-mode.
1010 (add-hook 'view-mode-hook 1022 (add-hook 'view-mode-hook
1011 `(lambda () 1023 (lambda ()
1012 (setq minor-mode-overriding-map-alist 1024 (setq minor-mode-overriding-map-alist
1013 (delq ',ro-bind minor-mode-overriding-map-alist))) 1025 (delq ro-bind minor-mode-overriding-map-alist)))
1014 nil t)) 1026 nil t))
1015 ;; add-log support 1027 ;; add-log support
1016 (set (make-local-variable 'add-log-current-defun-function) 1028 (set (make-local-variable 'add-log-current-defun-function)
@@ -1031,7 +1043,7 @@ a diff with \\[diff-reverse-direction]."
1031 (add-hook 'after-change-functions 'diff-after-change-function nil t) 1043 (add-hook 'after-change-functions 'diff-after-change-function nil t)
1032 (add-hook 'post-command-hook 'diff-post-command-hook nil t))) 1044 (add-hook 'post-command-hook 'diff-post-command-hook nil t)))
1033 1045
1034;;; Handy hook functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 1046;;; Handy hook functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
1035 1047
1036(defun diff-delete-if-empty () 1048(defun diff-delete-if-empty ()
1037 ;; An empty diff file means there's no more diffs to integrate, so we 1049 ;; An empty diff file means there's no more diffs to integrate, so we
diff --git a/lisp/dos-w32.el b/lisp/dos-w32.el
index ae2bd8052bb..2d730c8af0f 100644
--- a/lisp/dos-w32.el
+++ b/lisp/dos-w32.el
@@ -186,7 +186,7 @@ set to the appropriate coding system, and the value of
186 (setq buffer-file-type (eq buffer-file-coding-system 'no-conversion))))) 186 (setq buffer-file-type (eq buffer-file-coding-system 'no-conversion)))))
187 187
188;;; To set the default coding system on new files. 188;;; To set the default coding system on new files.
189(add-hook 'find-file-not-found-hooks 189(add-hook 'find-file-not-found-functions
190 'find-file-not-found-set-buffer-file-coding-system) 190 'find-file-not-found-set-buffer-file-coding-system)
191 191
192;;; To accomodate filesystems that do not require CR/LF translation. 192;;; To accomodate filesystems that do not require CR/LF translation.
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index d5588f3811f..a58ecb256ac 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -291,7 +291,7 @@ All commands in `lisp-mode-shared-map' are inherited by this map.")
291 (define-key map [byte-compile] 291 (define-key map [byte-compile]
292 '("Byte-compile This File" . emacs-lisp-byte-compile)) 292 '("Byte-compile This File" . emacs-lisp-byte-compile))
293 (define-key map [separator-eval] '("--")) 293 (define-key map [separator-eval] '("--"))
294 (define-key map [eval-buffer] '("Evaluate Buffer" . eval-current-buffer)) 294 (define-key map [eval-buffer] '("Evaluate Buffer" . eval-buffer))
295 (define-key map [eval-region] '("Evaluate Region" . eval-region)) 295 (define-key map [eval-region] '("Evaluate Region" . eval-region))
296 (define-key map [eval-sexp] '("Evaluate Last S-expression" . eval-last-sexp)) 296 (define-key map [eval-sexp] '("Evaluate Last S-expression" . eval-last-sexp))
297 (define-key map [separator-format] '("--")) 297 (define-key map [separator-format] '("--"))
diff --git a/lisp/emulation/viper-init.el b/lisp/emulation/viper-init.el
index 661fc6ede7f..80938b0282a 100644
--- a/lisp/emulation/viper-init.el
+++ b/lisp/emulation/viper-init.el
@@ -854,11 +854,6 @@ Related buffers can be cycled through via :R and :P commands."
854 854
855;;; Face-saving tricks 855;;; Face-saving tricks
856 856
857(defun viper-hide-face (face)
858 (if (and (viper-has-face-support-p) viper-emacs-p)
859 (add-to-list 'facemenu-unlisted-faces face)))
860
861
862(defgroup viper-highlighting nil 857(defgroup viper-highlighting nil
863 "Hilighting of replace region, search pattern, minibuffer, etc." 858 "Hilighting of replace region, search pattern, minibuffer, etc."
864 :prefix "viper-" 859 :prefix "viper-"
@@ -876,8 +871,6 @@ Related buffers can be cycled through via :R and :P commands."
876DO NOT CHANGE this variable. Instead, use the customization widget 871DO NOT CHANGE this variable. Instead, use the customization widget
877to customize the actual face object `viper-search' 872to customize the actual face object `viper-search'
878this variable represents.") 873this variable represents.")
879(viper-hide-face viper-search-face)
880
881 874
882(defface viper-replace-overlay 875(defface viper-replace-overlay
883 '((((class color)) (:foreground "Black" :background "darkseagreen2")) 876 '((((class color)) (:foreground "Black" :background "darkseagreen2"))
@@ -890,8 +883,6 @@ this variable represents.")
890DO NOT CHANGE this variable. Instead, use the customization widget 883DO NOT CHANGE this variable. Instead, use the customization widget
891to customize the actual face object `viper-replace-overlay' 884to customize the actual face object `viper-replace-overlay'
892this variable represents.") 885this variable represents.")
893(viper-hide-face viper-replace-overlay-face)
894
895 886
896(defface viper-minibuffer-emacs 887(defface viper-minibuffer-emacs
897 '((((class color)) (:foreground "Black" :background "darkseagreen2")) 888 '((((class color)) (:foreground "Black" :background "darkseagreen2"))
@@ -904,8 +895,6 @@ this variable represents.")
904DO NOT CHANGE this variable. Instead, use the customization widget 895DO NOT CHANGE this variable. Instead, use the customization widget
905to customize the actual face object `viper-minibuffer-emacs' 896to customize the actual face object `viper-minibuffer-emacs'
906this variable represents.") 897this variable represents.")
907(viper-hide-face viper-minibuffer-emacs-face)
908
909 898
910(defface viper-minibuffer-insert 899(defface viper-minibuffer-insert
911 '((((class color)) (:foreground "Black" :background "pink")) 900 '((((class color)) (:foreground "Black" :background "pink"))
@@ -918,8 +907,6 @@ this variable represents.")
918DO NOT CHANGE this variable. Instead, use the customization widget 907DO NOT CHANGE this variable. Instead, use the customization widget
919to customize the actual face object `viper-minibuffer-insert' 908to customize the actual face object `viper-minibuffer-insert'
920this variable represents.") 909this variable represents.")
921(viper-hide-face viper-minibuffer-insert-face)
922
923 910
924(defface viper-minibuffer-vi 911(defface viper-minibuffer-vi
925 '((((class color)) (:foreground "DarkGreen" :background "grey")) 912 '((((class color)) (:foreground "DarkGreen" :background "grey"))
@@ -932,7 +919,6 @@ this variable represents.")
932DO NOT CHANGE this variable. Instead, use the customization widget 919DO NOT CHANGE this variable. Instead, use the customization widget
933to customize the actual face object `viper-minibuffer-vi' 920to customize the actual face object `viper-minibuffer-vi'
934this variable represents.") 921this variable represents.")
935(viper-hide-face viper-minibuffer-vi-face)
936 922
937;; the current face to be used in the minibuffer 923;; the current face to be used in the minibuffer
938(viper-deflocalvar 924(viper-deflocalvar
diff --git a/lisp/facemenu.el b/lisp/facemenu.el
index 5478cf12b8c..a8d8ea9a4b5 100644
--- a/lisp/facemenu.el
+++ b/lisp/facemenu.el
@@ -67,8 +67,8 @@
67;; 67;;
68;; The order of the faces that appear in the menu and their keybindings can be 68;; The order of the faces that appear in the menu and their keybindings can be
69;; controlled by setting the variables `facemenu-keybindings' and 69;; controlled by setting the variables `facemenu-keybindings' and
70;; `facemenu-new-faces-at-end'. List faces that you don't use in documents 70;; `facemenu-new-faces-at-end'. List faces that you want to use in documents
71;; (eg, `region') in `facemenu-unlisted-faces'. 71;; in `facemenu-listed-faces'.
72 72
73;;; Known Problems: 73;;; Known Problems:
74;; Bold and Italic do not combine to create bold-italic if you select them 74;; Bold and Italic do not combine to create bold-italic if you select them
@@ -116,9 +116,9 @@ the next element is the key to use as a keyboard equivalent of the menu item;
116the binding is made in `facemenu-keymap'. 116the binding is made in `facemenu-keymap'.
117 117
118The faces specifically mentioned in this list are put at the top of 118The faces specifically mentioned in this list are put at the top of
119the menu, in the order specified. All other faces which are defined, 119the menu, in the order specified. All other faces which are defined
120except for those in `facemenu-unlisted-faces', are listed after them, 120in `facemenu-listed-faces' are listed after them, but get no
121but get no keyboard equivalents. 121keyboard equivalents.
122 122
123If you change this variable after loading facemenu.el, you will need to call 123If you change this variable after loading facemenu.el, you will need to call
124`facemenu-update' to make it take effect." 124`facemenu-update' to make it take effect."
@@ -132,28 +132,25 @@ just before \"Other\" at the end."
132 :type 'boolean 132 :type 'boolean
133 :group 'facemenu) 133 :group 'facemenu)
134 134
135(defcustom facemenu-unlisted-faces 135(defcustom facemenu-listed-faces nil
136 `(modeline region secondary-selection highlight scratch-face 136 "*List of faces to include in the Face menu.
137 ,(purecopy "^font-lock-") ,(purecopy "^gnus-") ,(purecopy "^message-") 137Each element should be a symbol, which is the name of a face.
138 ,(purecopy "^ediff-") ,(purecopy "^term-") ,(purecopy "^vc-") 138The \"basic \" faces in `facemenu-keybindings' are automatically
139 ,(purecopy "^widget-") ,(purecopy "^custom-") ,(purecopy "^vm-")) 139added to the Face menu, and are not included in this list.
140 "*List of faces not to include in the Face menu.
141Each element may be either a symbol, which is the name of a face, or a string,
142which is a regular expression to be matched against face names. Matching
143faces will not be added to the menu.
144 140
145You can set this list before loading facemenu.el, or add a face to it before 141You can set this list before loading facemenu.el, or add a face to it before
146creating that face if you do not want it to be listed. If you change the 142creating that face if you want it to be listed. If you change the
147variable so as to eliminate faces that have already been added to the menu, 143variable so as to eliminate faces that have already been added to the menu,
148call `facemenu-update' to recalculate the menu contents. 144call `facemenu-update' to recalculate the menu contents.
149 145
150If this variable is t, no faces will be added to the menu. This is useful for 146If this variable is t, all faces will be added to the menu. This
151temporarily turning off the feature that automatically adds faces to the menu 147is useful for setting temporarily if you want to add faces to the
152when they are created." 148menu when they are created."
153 :type '(choice (const :tag "Don't add faces" t) 149 :type '(choice (const :tag "List all faces" t)
154 (const :tag "None (do add any face)" nil) 150 (const :tag "None" nil)
155 (repeat (choice symbol regexp))) 151 (repeat symbol))
156 :group 'facemenu) 152 :group 'facemenu
153 :version "22.1")
157 154
158;;;###autoload 155;;;###autoload
159(defvar facemenu-face-menu 156(defvar facemenu-face-menu
@@ -675,18 +672,13 @@ This is called whenever you create a new face."
675 (setq docstring 672 (setq docstring
676 (format "Select face `%s' for subsequent insertion." 673 (format "Select face `%s' for subsequent insertion."
677 name)) 674 name))
678 (cond ((eq t facemenu-unlisted-faces)) 675 (cond ((facemenu-iterate ; check if equivalent face is already in the menu
679 ((memq symbol facemenu-unlisted-faces)) 676 (lambda (m) (and (listp m)
680 ;; test against regexps in facemenu-unlisted-faces 677 (symbolp (car m))
681 ((let ((unlisted facemenu-unlisted-faces) 678 (face-equal (car m) symbol)))
682 (matched nil)) 679 (cdr (symbol-function menu))))
683 (while (and unlisted (not matched)) 680 ;; Faces with a keyboard equivalent. These go at the front.
684 (if (and (stringp (car unlisted)) 681 (key
685 (string-match (car unlisted) name))
686 (setq matched t)
687 (setq unlisted (cdr unlisted))))
688 matched))
689 (key ; has a keyboard equivalent. These go at the front.
690 (setq function (intern (concat "facemenu-set-" name))) 682 (setq function (intern (concat "facemenu-set-" name)))
691 (fset function 683 (fset function
692 `(lambda () 684 `(lambda ()
@@ -700,17 +692,14 @@ This is called whenever you create a new face."
700 (region-end))))) 692 (region-end)))))
701 (define-key 'facemenu-keymap key (cons name function)) 693 (define-key 'facemenu-keymap key (cons name function))
702 (define-key menu key (cons name function))) 694 (define-key menu key (cons name function)))
703 ((facemenu-iterate ; check if equivalent face is already in the menu 695 ;; Faces with no keyboard equivalent. Figure out where to put it:
704 (lambda (m) (and (listp m) 696 ((or (eq t facemenu-listed-faces)
705 (symbolp (car m)) 697 (memq symbol facemenu-listed-faces))
706 (face-equal (car m) symbol)))
707 (cdr (symbol-function menu))))
708 (t ; No keyboard equivalent. Figure out where to put it:
709 (setq key (vector symbol) 698 (setq key (vector symbol)
710 function 'facemenu-set-face-from-menu 699 function 'facemenu-set-face-from-menu
711 menu-val (symbol-function menu)) 700 menu-val (symbol-function menu))
712 (if (and facemenu-new-faces-at-end 701 (if (and facemenu-new-faces-at-end
713 (> (length menu-val) 3)) 702 (> (length menu-val) 3))
714 (define-key-after menu-val key (cons name function) 703 (define-key-after menu-val key (cons name function)
715 (car (nth (- (length menu-val) 3) menu-val))) 704 (car (nth (- (length menu-val) 3) menu-val)))
716 (define-key menu key (cons name function)))))) 705 (define-key menu key (cons name function))))))
diff --git a/lisp/faces.el b/lisp/faces.el
index 6ae0bca663f..4627b5ff594 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -916,10 +916,11 @@ of the default face. Value is FACE."
916 916
917(defun read-face-name (prompt &optional string-describing-default multiple) 917(defun read-face-name (prompt &optional string-describing-default multiple)
918 "Read a face, defaulting to the face or faces on the char after point. 918 "Read a face, defaulting to the face or faces on the char after point.
919If it has a `read-face-name' property, that overrides the `face' property. 919If it has the property `read-face-name', that overrides the `face' property.
920PROMPT describes what you will do with the face (don't end in a space). 920PROMPT should be a string that describes what the caller will do with the face;
921STRING-DESCRIBING-DEFAULT describes what default you will use 921it should not end in a space.
922if this function returns nil. 922STRING-DESCRIBING-DEFAULT should describe what default the caller will use if
923the user just types RET; you can omit it.
923If MULTIPLE is non-nil, return a list of faces (possibly only one). 924If MULTIPLE is non-nil, return a list of faces (possibly only one).
924Otherwise, return a single face." 925Otherwise, return a single face."
925 (let ((faceprop (or (get-char-property (point) 'read-face-name) 926 (let ((faceprop (or (get-char-property (point) 'read-face-name)
diff --git a/lisp/files.el b/lisp/files.el
index 8a5a331da71..750cb36068a 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -488,7 +488,7 @@ This variable does not affect the use of major modes
488specified in a -*- line.") 488specified in a -*- line.")
489 489
490(defcustom enable-local-eval 'maybe 490(defcustom enable-local-eval 'maybe
491 "*Control processing of the \"variable\" `eval' in a file's local variables. 491 "Control processing of the \"variable\" `eval' in a file's local variables.
492The value can be t, nil or something else. 492The value can be t, nil or something else.
493A value of t means obey `eval' variables; 493A value of t means obey `eval' variables;
494nil means ignore them; anything else means query." 494nil means ignore them; anything else means query."
@@ -1275,48 +1275,49 @@ Choose the buffer's name using `generate-new-buffer-name'."
1275This also substitutes \"~\" for the user's home directory and 1275This also substitutes \"~\" for the user's home directory and
1276removes automounter prefixes (see the variable `automount-dir-prefix')." 1276removes automounter prefixes (see the variable `automount-dir-prefix')."
1277 ;; Get rid of the prefixes added by the automounter. 1277 ;; Get rid of the prefixes added by the automounter.
1278 (if (and automount-dir-prefix 1278 (save-match-data
1279 (string-match automount-dir-prefix filename) 1279 (if (and automount-dir-prefix
1280 (file-exists-p (file-name-directory 1280 (string-match automount-dir-prefix filename)
1281 (substring filename (1- (match-end 0)))))) 1281 (file-exists-p (file-name-directory
1282 (setq filename (substring filename (1- (match-end 0))))) 1282 (substring filename (1- (match-end 0))))))
1283 (let ((tail directory-abbrev-alist)) 1283 (setq filename (substring filename (1- (match-end 0)))))
1284 ;; If any elt of directory-abbrev-alist matches this name, 1284 (let ((tail directory-abbrev-alist))
1285 ;; abbreviate accordingly. 1285 ;; If any elt of directory-abbrev-alist matches this name,
1286 (while tail 1286 ;; abbreviate accordingly.
1287 (if (string-match (car (car tail)) filename) 1287 (while tail
1288 (if (string-match (car (car tail)) filename)
1289 (setq filename
1290 (concat (cdr (car tail)) (substring filename (match-end 0)))))
1291 (setq tail (cdr tail)))
1292 ;; Compute and save the abbreviated homedir name.
1293 ;; We defer computing this until the first time it's needed, to
1294 ;; give time for directory-abbrev-alist to be set properly.
1295 ;; We include a slash at the end, to avoid spurious matches
1296 ;; such as `/usr/foobar' when the home dir is `/usr/foo'.
1297 (or abbreviated-home-dir
1298 (setq abbreviated-home-dir
1299 (let ((abbreviated-home-dir "$foo"))
1300 (concat "^" (abbreviate-file-name (expand-file-name "~"))
1301 "\\(/\\|$\\)"))))
1302
1303 ;; If FILENAME starts with the abbreviated homedir,
1304 ;; make it start with `~' instead.
1305 (if (and (string-match abbreviated-home-dir filename)
1306 ;; If the home dir is just /, don't change it.
1307 (not (and (= (match-end 0) 1)
1308 (= (aref filename 0) ?/)))
1309 ;; MS-DOS root directories can come with a drive letter;
1310 ;; Novell Netware allows drive letters beyond `Z:'.
1311 (not (and (or (eq system-type 'ms-dos)
1312 (eq system-type 'cygwin)
1313 (eq system-type 'windows-nt))
1314 (save-match-data
1315 (string-match "^[a-zA-`]:/$" filename)))))
1288 (setq filename 1316 (setq filename
1289 (concat (cdr (car tail)) (substring filename (match-end 0))))) 1317 (concat "~"
1290 (setq tail (cdr tail))) 1318 (match-string 1 filename)
1291 ;; Compute and save the abbreviated homedir name. 1319 (substring filename (match-end 0)))))
1292 ;; We defer computing this until the first time it's needed, to 1320 filename)))
1293 ;; give time for directory-abbrev-alist to be set properly.
1294 ;; We include a slash at the end, to avoid spurious matches
1295 ;; such as `/usr/foobar' when the home dir is `/usr/foo'.
1296 (or abbreviated-home-dir
1297 (setq abbreviated-home-dir
1298 (let ((abbreviated-home-dir "$foo"))
1299 (concat "^" (abbreviate-file-name (expand-file-name "~"))
1300 "\\(/\\|$\\)"))))
1301
1302 ;; If FILENAME starts with the abbreviated homedir,
1303 ;; make it start with `~' instead.
1304 (if (and (string-match abbreviated-home-dir filename)
1305 ;; If the home dir is just /, don't change it.
1306 (not (and (= (match-end 0) 1)
1307 (= (aref filename 0) ?/)))
1308 ;; MS-DOS root directories can come with a drive letter;
1309 ;; Novell Netware allows drive letters beyond `Z:'.
1310 (not (and (or (eq system-type 'ms-dos)
1311 (eq system-type 'cygwin)
1312 (eq system-type 'windows-nt))
1313 (save-match-data
1314 (string-match "^[a-zA-`]:/$" filename)))))
1315 (setq filename
1316 (concat "~"
1317 (substring filename (match-beginning 1) (match-end 1))
1318 (substring filename (match-end 0)))))
1319 filename))
1320 1321
1321(defcustom find-file-not-true-dirname-list nil 1322(defcustom find-file-not-true-dirname-list nil
1322 "*List of logical names for which visiting shouldn't save the true dirname. 1323 "*List of logical names for which visiting shouldn't save the true dirname.
@@ -1607,7 +1608,7 @@ Do you want to revisit the file normally now? ")
1607 (kill-buffer buf) 1608 (kill-buffer buf)
1608 (signal 'file-error (list "File is not readable" 1609 (signal 'file-error (list "File is not readable"
1609 filename))) 1610 filename)))
1610 ;; Run find-file-not-found-hooks until one returns non-nil. 1611 ;; Run find-file-not-found-functions until one returns non-nil.
1611 (or (run-hook-with-args-until-success 'find-file-not-found-functions) 1612 (or (run-hook-with-args-until-success 'find-file-not-found-functions)
1612 ;; If they fail too, set error. 1613 ;; If they fail too, set error.
1613 (setq error t))))) 1614 (setq error t)))))
@@ -1627,9 +1628,7 @@ Do you want to revisit the file normally now? ")
1627 (not (member logical find-file-not-true-dirname-list))) 1628 (not (member logical find-file-not-true-dirname-list)))
1628 (setq buffer-file-name buffer-file-truename)) 1629 (setq buffer-file-name buffer-file-truename))
1629 (if find-file-visit-truename 1630 (if find-file-visit-truename
1630 (setq buffer-file-name 1631 (setq buffer-file-name (expand-file-name buffer-file-truename)))
1631 (setq filename
1632 (expand-file-name buffer-file-truename))))
1633 ;; Set buffer's default directory to that of the file. 1632 ;; Set buffer's default directory to that of the file.
1634 (setq default-directory (file-name-directory buffer-file-name)) 1633 (setq default-directory (file-name-directory buffer-file-name))
1635 ;; Turn off backup files for certain file names. Since 1634 ;; Turn off backup files for certain file names. Since
@@ -2436,11 +2435,9 @@ n -- to ignore the local variables list.")
2436 (insert " "))) 2435 (insert " ")))
2437 (princ (car elt) buf) 2436 (princ (car elt) buf)
2438 (insert " : ") 2437 (insert " : ")
2439 (if (stringp (cdr elt)) 2438 ;; Make strings with embedded whitespace easier to read.
2440 ;; Make strings with embedded whitespace easier to read. 2439 (let ((print-escape-newlines t))
2441 (let ((print-escape-newlines t)) 2440 (prin1 (cdr elt) buf))
2442 (prin1 (cdr elt) buf))
2443 (princ (cdr elt) buf))
2444 (insert "\n")) 2441 (insert "\n"))
2445 (setq prompt 2442 (setq prompt
2446 (format "Please type %s%s: " 2443 (format "Please type %s%s: "
@@ -2511,9 +2508,7 @@ and VAL is the specified value."
2511 ;; There used to be a downcase here, 2508 ;; There used to be a downcase here,
2512 ;; but the manual didn't say so, 2509 ;; but the manual didn't say so,
2513 ;; and people want to set var names that aren't all lc. 2510 ;; and people want to set var names that aren't all lc.
2514 (let ((key (intern (buffer-substring 2511 (let ((key (intern (match-string 1)))
2515 (match-beginning 1)
2516 (match-end 1))))
2517 (val (save-restriction 2512 (val (save-restriction
2518 (narrow-to-region (point) end) 2513 (narrow-to-region (point) end)
2519 (read (current-buffer))))) 2514 (read (current-buffer)))))
@@ -2665,8 +2660,8 @@ is specified, returning t if it is specified."
2665 (hack-local-variables-confirm 2660 (hack-local-variables-confirm
2666 result unsafe-vars risky-vars)) 2661 result unsafe-vars risky-vars))
2667 (dolist (elt result) 2662 (dolist (elt result)
2668 (hack-one-local-variable (car elt) (cdr elt)))))) 2663 (hack-one-local-variable (car elt) (cdr elt)))))))
2669 (run-hooks 'hack-local-variables-hook)))))) 2664 (run-hooks 'hack-local-variables-hook)))))
2670 2665
2671(defun safe-local-variable-p (sym val) 2666(defun safe-local-variable-p (sym val)
2672 "Non-nil if SYM is safe as a file-local variable with value VAL. 2667 "Non-nil if SYM is safe as a file-local variable with value VAL.
@@ -2752,17 +2747,16 @@ It is dangerous if either of these conditions are met:
2752(defun hack-one-local-variable (var val) 2747(defun hack-one-local-variable (var val)
2753 "Set local variable VAR with value VAL." 2748 "Set local variable VAR with value VAL."
2754 (cond ((eq var 'mode) 2749 (cond ((eq var 'mode)
2755 (funcall (intern (concat (downcase (symbol-name val)) 2750 (funcall (intern (concat (downcase (symbol-name val)) "-mode"))))
2756 "-mode"))))
2757 ((eq var 'eval) 2751 ((eq var 'eval)
2758 (save-excursion (eval val))) 2752 (save-excursion (eval val)))
2759 (t (make-local-variable var) 2753 (t
2760 ;; Make sure the string has no text properties. 2754 ;; Make sure the string has no text properties.
2761 ;; Some text properties can get evaluated in various ways, 2755 ;; Some text properties can get evaluated in various ways,
2762 ;; so it is risky to put them on with a local variable list. 2756 ;; so it is risky to put them on with a local variable list.
2763 (if (stringp val) 2757 (if (stringp val)
2764 (set-text-properties 0 (length val) nil val)) 2758 (set-text-properties 0 (length val) nil val))
2765 (set var val)))) 2759 (set (make-local-variable var) val))))
2766 2760
2767 2761
2768(defcustom change-major-mode-with-file-name t 2762(defcustom change-major-mode-with-file-name t
@@ -4220,9 +4214,7 @@ This command is used in the special Dired buffer created by
4220 (setq autofile 4214 (setq autofile
4221 (buffer-substring-no-properties 4215 (buffer-substring-no-properties
4222 (point) 4216 (point)
4223 (save-excursion 4217 (line-end-position)))
4224 (end-of-line)
4225 (point))))
4226 (setq thisfile 4218 (setq thisfile
4227 (expand-file-name 4219 (expand-file-name
4228 (substring 4220 (substring
diff --git a/lisp/generic-x.el b/lisp/generic-x.el
index 55c4e482803..609d076d8a2 100644
--- a/lisp/generic-x.el
+++ b/lisp/generic-x.el
@@ -512,10 +512,11 @@ like an INI file. You can add this hook to `find-file-hook'."
512 (1 font-lock-builtin-face) 512 (1 font-lock-builtin-face)
513 (2 font-lock-variable-name-face t t)))) 513 (2 font-lock-variable-name-face t t))))
514 '("\\.[bB][aA][tT]\\'" 514 '("\\.[bB][aA][tT]\\'"
515 "\\.[cC][mM][dD]\\'"
515 "\\`[cC][oO][nN][fF][iI][gG]\\." 516 "\\`[cC][oO][nN][fF][iI][gG]\\."
516 "\\`[aA][uU][tT][oO][eE][xX][eE][cC]\\.") 517 "\\`[aA][uU][tT][oO][eE][xX][eE][cC]\\.")
517 '(generic-bat-mode-setup-function) 518 '(generic-bat-mode-setup-function)
518 "Generic mode for MS-Windows BAT files.") 519 "Generic mode for MS-Windows batch files.")
519 520
520(defvar bat-generic-mode-syntax-table nil 521(defvar bat-generic-mode-syntax-table nil
521 "Syntax table in use in `bat-generic-mode' buffers.") 522 "Syntax table in use in `bat-generic-mode' buffers.")
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 60a7e6b1e8b..d1f63c63324 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,17 @@
12006-06-26 Reiner Steib <Reiner.Steib@gmx.de>
2
3 * gnus-diary.el (gnus-user-format-function-d)
4 (gnus-user-format-function-D): Autoload.
5
62006-06-26 Lars Magne Ingebrigtsen <larsi@gnus.org>
7
8 * gnus-group.el (gnus-group-select-group): Doc fix.
9 [ See 2004-05-19 change on the trunk. ]
10
112006-06-20 Katsumi Yamaoka <yamaoka@jpl.org>
12
13 * rfc2231.el (rfc2231-parse-string): Allow `*'s in parameter values.
14
12006-06-19 Katsumi Yamaoka <yamaoka@jpl.org> 152006-06-19 Katsumi Yamaoka <yamaoka@jpl.org>
2 16
3 * message.el (message-syntax-checks): Doc fix. 17 * message.el (message-syntax-checks): Doc fix.
diff --git a/lisp/gnus/gnus-diary.el b/lisp/gnus/gnus-diary.el
index 5dfbd56af24..e4834131aa7 100644
--- a/lisp/gnus/gnus-diary.el
+++ b/lisp/gnus/gnus-diary.el
@@ -213,6 +213,7 @@ There are currently two built-in format functions:
213;; #### NOTE: Gnus sometimes gives me a HEADER not corresponding to any 213;; #### NOTE: Gnus sometimes gives me a HEADER not corresponding to any
214;; message, with all fields set to nil here. I don't know what it is for, and 214;; message, with all fields set to nil here. I don't know what it is for, and
215;; I just ignore it. 215;; I just ignore it.
216;;;###autoload
216(defun gnus-user-format-function-d (header) 217(defun gnus-user-format-function-d (header)
217 ;; Returns an aproximative delay string for the next occurence of this 218 ;; Returns an aproximative delay string for the next occurence of this
218 ;; message. The delay is given only in the first non zero unit. 219 ;; message. The delay is given only in the first non zero unit.
@@ -249,6 +250,7 @@ There are currently two built-in format functions:
249;; #### NOTE: Gnus sometimes gives me a HEADER not corresponding to any 250;; #### NOTE: Gnus sometimes gives me a HEADER not corresponding to any
250;; message, with all fields set to nil here. I don't know what it is for, and 251;; message, with all fields set to nil here. I don't know what it is for, and
251;; I just ignore it. 252;; I just ignore it.
253;;;###autoload
252(defun gnus-user-format-function-D (header) 254(defun gnus-user-format-function-D (header)
253 ;; Returns a formatted time string for the next occurence of this message. 255 ;; Returns a formatted time string for the next occurence of this message.
254 (let* ((extras (mail-header-extra header)) 256 (let* ((extras (mail-header-extra header))
diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el
index f3ca6248811..c34e339c5b1 100644
--- a/lisp/gnus/gnus-group.el
+++ b/lisp/gnus/gnus-group.el
@@ -2039,7 +2039,10 @@ group."
2039No article is selected automatically. 2039No article is selected automatically.
2040If the group is opened, just switch the summary buffer. 2040If the group is opened, just switch the summary buffer.
2041If ALL is non-nil, already read articles become readable. 2041If ALL is non-nil, already read articles become readable.
2042If ALL is a number, fetch this number of articles." 2042If ALL is a positive number, fetch this number of the latest
2043articles in the group.
2044If ALL is a negative number, fetch this number of the earliest
2045articles in the group."
2043 (interactive "P") 2046 (interactive "P")
2044 (when (and (eobp) (not (gnus-group-group-name))) 2047 (when (and (eobp) (not (gnus-group-group-name)))
2045 (forward-line -1)) 2048 (forward-line -1))
diff --git a/lisp/gnus/rfc2231.el b/lisp/gnus/rfc2231.el
index a5827ecb70c..284c95fc151 100644
--- a/lisp/gnus/rfc2231.el
+++ b/lisp/gnus/rfc2231.el
@@ -176,14 +176,14 @@ must never cause a Lisp error."
176 (buffer-substring 176 (buffer-substring
177 (point) 177 (point)
178 (progn 178 (progn
179 (forward-sexp) 179 ;; Jump over asterisk, non-ASCII
180 ;; We might not have reached at the end of 180 ;; and non-boundary characters.
181 ;; the value because of non-ascii chars, 181 (while (and c
182 ;; so we should jump over them if any. 182 (or (eq c ?*)
183 (while (and (not (eobp)) 183 (> c ?\177)
184 (> (char-after) ?\177)) 184 (not (eq (char-syntax c) ? ))))
185 (forward-char 1) 185 (forward-char 1)
186 (forward-sexp)) 186 (setq c (char-after)))
187 (point))))) 187 (point)))))
188 (t 188 (t
189 (error "Invalid header: %s" string))) 189 (error "Invalid header: %s" string)))
diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 0c6e0f47453..f4ab3de5a4a 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -238,9 +238,9 @@ Commands:
238 238
239(defconst help-xref-symbol-regexp 239(defconst help-xref-symbol-regexp
240 (purecopy (concat "\\(\\<\\(\\(variable\\|option\\)\\|" ; Link to var 240 (purecopy (concat "\\(\\<\\(\\(variable\\|option\\)\\|" ; Link to var
241 "\\(function\\|command\\)\\|" ; Link to function 241 "\\(function\\|command\\)\\|" ; Link to function
242 "\\(face\\)\\|" ; Link to face 242 "\\(face\\)\\|" ; Link to face
243 "\\(symbol\\|program\\)\\|" ; Don't link 243 "\\(symbol\\|program\\|property\\)\\|" ; Don't link
244 "\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)" 244 "\\(source \\(?:code \\)?\\(?:of\\|for\\)\\)\\)"
245 "[ \t\n]+\\)?" 245 "[ \t\n]+\\)?"
246 ;; Note starting with word-syntax character: 246 ;; Note starting with word-syntax character:
diff --git a/lisp/help.el b/lisp/help.el
index 0caf018c2e9..4d92f69cebd 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -346,8 +346,7 @@ With argument, display info only for the selected version."
346 (directory-files data-directory nil 346 (directory-files data-directory nil
347 "^NEWS\\.[0-9][-0-9]*$" nil))) 347 "^NEWS\\.[0-9][-0-9]*$" nil)))
348 (sort (delete-dups res) (lambda (a b) (string< b a))))) 348 (sort (delete-dups res) (lambda (a b) (string< b a)))))
349 (current (car all-versions)) 349 (current (car all-versions)))
350 res)
351 (setq version (completing-read 350 (setq version (completing-read
352 (format "Read NEWS for the version (default %s): " current) 351 (format "Read NEWS for the version (default %s): " current)
353 all-versions nil nil nil nil current)) 352 all-versions nil nil nil nil current))
@@ -369,7 +368,8 @@ With argument, display info only for the selected version."
369 (file (cond 368 (file (cond
370 ((>= vn emacs-major-version) "NEWS") 369 ((>= vn emacs-major-version) "NEWS")
371 ((< vn 18) "NEWS.1-17") 370 ((< vn 18) "NEWS.1-17")
372 (t (format "NEWS.%d" vn))))) 371 (t (format "NEWS.%d" vn))))
372 res)
373 (view-file (expand-file-name file data-directory)) 373 (view-file (expand-file-name file data-directory))
374 (widen) 374 (widen)
375 (goto-char (point-min)) 375 (goto-char (point-min))
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 6264d2e56b5..b5f9c4f1bcf 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -2457,10 +2457,13 @@ Sorting commands:
2457 2457
2458Other commands: 2458Other commands:
2459 2459
2460 '\\[ibuffer-update]' - Regenerate the list of all buffers.
2461 Prefix arg means to toggle whether buffers that match
2462 `ibuffer-maybe-show-predicates' should be displayed.
2463
2460 '\\[ibuffer-switch-format]' - Change the current display format. 2464 '\\[ibuffer-switch-format]' - Change the current display format.
2461 '\\[forward-line]' - Move point to the next line. 2465 '\\[forward-line]' - Move point to the next line.
2462 '\\[previous-line]' - Move point to the previous line. 2466 '\\[previous-line]' - Move point to the previous line.
2463 '\\[ibuffer-update]' - As above, but add new buffers to the list.
2464 '\\[ibuffer-quit]' - Bury the Ibuffer buffer. 2467 '\\[ibuffer-quit]' - Bury the Ibuffer buffer.
2465 '\\[describe-mode]' - This help. 2468 '\\[describe-mode]' - This help.
2466 '\\[ibuffer-diff-with-file]' - View the differences between this buffer 2469 '\\[ibuffer-diff-with-file]' - View the differences between this buffer
diff --git a/lisp/info.el b/lisp/info.el
index 107dbb72d95..21d4bbc238d 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -844,7 +844,7 @@ a case-insensitive match is tried."
844 (goto-char (point-min)) 844 (goto-char (point-min))
845 (condition-case () 845 (condition-case ()
846 (if (and (re-search-forward 846 (if (and (re-search-forward
847 "makeinfo version \\([0-9]+.[0-9]+\\)" 847 "makeinfo[ \n]version[ \n]\\([0-9]+.[0-9]+\\)"
848 (line-beginning-position 3) t) 848 (line-beginning-position 3) t)
849 (not (version< (match-string 1) "4.7"))) 849 (not (version< (match-string 1) "4.7")))
850 (setq found t)) 850 (setq found t))
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 77ef9f07d59..dc3d1171cb2 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -1088,7 +1088,19 @@ see `language-info-alist'."
1088 (setq lang-env (symbol-name lang-env))) 1088 (setq lang-env (symbol-name lang-env)))
1089 (set-language-info-internal lang-env key info) 1089 (set-language-info-internal lang-env key info)
1090 (if (equal lang-env current-language-environment) 1090 (if (equal lang-env current-language-environment)
1091 (set-language-environment lang-env))) 1091 (cond ((eq key 'coding-priority)
1092 (set-language-environment-coding-systems lang-env))
1093 ((eq key 'input-method)
1094 (set-language-environment-input-method lang-env))
1095 ((eq key 'nonascii-translation)
1096 (set-language-environment-nonascii-translation lang-env))
1097 ((eq key 'charset)
1098 (set-language-environment-charset lang-env))
1099 ((eq key 'overriding-fontspec)
1100 (set-language-environment-fontset lang-env))
1101 ((and (not default-enable-multibyte-characters)
1102 (or (eq key 'unibyte-syntax) (eq key 'unibyte-display)))
1103 (set-language-environment-unibyte lang-env)))))
1092 1104
1093(defun set-language-info-internal (lang-env key info) 1105(defun set-language-info-internal (lang-env key info)
1094 "Internal use only. 1106 "Internal use only.
@@ -1921,6 +1933,80 @@ of `buffer-file-coding-system' set by this function."
1921 (setq default-sendmail-coding-system default-coding) 1933 (setq default-sendmail-coding-system default-coding)
1922 (apply 'set-coding-system-priority priority)))) 1934 (apply 'set-coding-system-priority priority))))
1923 1935
1936(defun set-language-environment-input-method (language-name)
1937 "Do various input method setups for language environment LANGUAGE-NAME."
1938 (let ((input-method (get-language-info language-name 'input-method)))
1939 (when input-method
1940 (setq default-input-method input-method)
1941 (if input-method-history
1942 (setq input-method-history
1943 (cons input-method
1944 (delete input-method input-method-history)))))))
1945
1946(defun set-language-environment-nonascii-translation (language-name)
1947 "Do unibyte/multibyte translation setup for language environment LANGUAGE-NAME."
1948 (let ((nonascii (get-language-info language-name 'nonascii-translation))
1949 (dos-table
1950 (if (eq window-system 'pc)
1951 (intern
1952 (format "cp%d-nonascii-translation-table" dos-codepage)))))
1953 (cond
1954 ((char-table-p nonascii)
1955 (setq nonascii-translation-table nonascii))
1956 ((and (eq window-system 'pc) (boundp dos-table))
1957 ;; DOS terminals' default is to use a special non-ASCII translation
1958 ;; table as appropriate for the installed codepage.
1959 (setq nonascii-translation-table (symbol-value dos-table)))
1960 ((charsetp nonascii)
1961 (setq nonascii-insert-offset (- (make-char nonascii) 128))))))
1962
1963(defun set-language-environment-charset (language-name)
1964 "Do various charset setups for language environment LANGUAGE-NAME."
1965 (if (and utf-translate-cjk-mode
1966 (not (eq utf-translate-cjk-lang-env language-name))
1967 (catch 'tag
1968 (dolist (charset (get-language-info language-name 'charset))
1969 (if (memq charset utf-translate-cjk-charsets)
1970 (throw 'tag t)))
1971 nil))
1972 (utf-translate-cjk-load-tables)))
1973
1974(defun set-language-environment-fontset (language-name)
1975 "Do various fontset setups for language environment LANGUAGE-NAME."
1976 ;; Don't invoke fontset-related functions if fontsets aren't
1977 ;; supported in this build of Emacs.
1978 (if (fboundp 'fontset-list)
1979 (set-overriding-fontspec-internal
1980 (get-language-info language-name 'overriding-fontspec))))
1981
1982(defun set-language-environment-unibyte (language-name)
1983 "Do various unibyte-mode setups for language environment LANGUAGE-NAME."
1984 ;; Syntax and case table.
1985 (let ((syntax (get-language-info language-name 'unibyte-syntax)))
1986 (if syntax
1987 (let ((set-case-syntax-set-multibyte nil))
1988 (load syntax nil t))
1989 ;; No information for syntax and case. Reset to the defaults.
1990 (let ((syntax-table (standard-syntax-table))
1991 (standard-table (standard-case-table))
1992 (case-table (make-char-table 'case-table))
1993 (ch (if (eq window-system 'pc) 128 160)))
1994 (while (< ch 256)
1995 (modify-syntax-entry ch " " syntax-table)
1996 (setq ch (1+ ch)))
1997 (dotimes (i 128)
1998 (aset case-table i (aref standard-table i)))
1999 (set-char-table-extra-slot case-table 0 nil)
2000 (set-char-table-extra-slot case-table 1 nil)
2001 (set-char-table-extra-slot case-table 2 nil)
2002 (set-standard-case-table case-table))
2003 (let ((list (buffer-list)))
2004 (while list
2005 (with-current-buffer (car list)
2006 (set-case-table (standard-case-table)))
2007 (setq list (cdr list))))))
2008 (set-display-table-and-terminal-coding-system language-name))
2009
1924(defsubst princ-list (&rest args) 2010(defsubst princ-list (&rest args)
1925 "Print all arguments with `princ', then print \"\n\"." 2011 "Print all arguments with `princ', then print \"\n\"."
1926 (while args (princ (car args)) (setq args (cdr args))) 2012 (while args (princ (car args)) (setq args (cdr args)))
diff --git a/lisp/locate.el b/lisp/locate.el
index 702ae98ecd6..5df695d59b9 100644
--- a/lisp/locate.el
+++ b/lisp/locate.el
@@ -191,17 +191,37 @@ This should contain the \"-l\" switch, but not the \"-F\" or \"-b\" switches."
191 :group 'locate 191 :group 'locate
192 :version "22.1") 192 :version "22.1")
193 193
194(defcustom locate-update-when-revert nil
195 "This option affects how the *Locate* buffer gets reverted.
196If non-nil, offer to update the locate database when reverting that buffer.
197\(Normally, you need to have root privileges for this to work. See the
198option `locate-update-path'.)
199If nil, reverting does not update the locate database."
200 :type 'boolean
201 :group 'locate
202 :version "22.1")
203
194(defcustom locate-update-command "updatedb" 204(defcustom locate-update-command "updatedb"
195 "The executable program used to update the locate database." 205 "The executable program used to update the locate database."
196 :type 'string 206 :type 'string
197 :group 'locate) 207 :group 'locate)
198 208
209(defcustom locate-update-path "/"
210 "The default directory from where `locate-update-command' is called.
211Usually, root permissions are required to run that command. This
212can be achieved by setting this option to \"/su::\" or \"/sudo::\"
213\(if you have the appropriate authority). If your current user
214permissions are sufficient to run the command, you can set this
215option to \"/\"."
216 :type 'string
217 :group 'locate
218 :version "22.1")
219
199(defcustom locate-prompt-for-command nil 220(defcustom locate-prompt-for-command nil
200 "If non-nil, the `locate' command prompts for a command to run. 221 "If non-nil, the `locate' command prompts for a command to run.
201Otherwise, that behavior is invoked via a prefix argument." 222Otherwise, that behavior is invoked via a prefix argument."
202 :group 'locate 223 :group 'locate
203 :type 'boolean 224 :type 'boolean)
204 )
205 225
206;; Functions 226;; Functions
207 227
@@ -557,12 +577,18 @@ do not work in subdirectories.
557 577
558;; From Stephen Eglen <stephen@cns.ed.ac.uk> 578;; From Stephen Eglen <stephen@cns.ed.ac.uk>
559(defun locate-update (ignore1 ignore2) 579(defun locate-update (ignore1 ignore2)
560 "Update the locate database. 580 "Revert the *Locate* buffer.
561Database is updated using the shell command in `locate-update-command'." 581If `locate-update-when-revert' is non-nil, offer to update the
582locate database using the shell command in `locate-update-command'."
562 (let ((str (car locate-history-list))) 583 (let ((str (car locate-history-list)))
563 (cond ((yes-or-no-p "Update locate database (may take a few seconds)? ") 584 (and locate-update-when-revert
564 (shell-command locate-update-command) 585 (yes-or-no-p "Update locate database (may take a few seconds)? ")
565 (locate str))))) 586 ;; `expand-file-name' is used in order to autoload Tramp if
587 ;; necessary. It cannot be loaded when `default-directory'
588 ;; is remote.
589 (let ((default-directory (expand-file-name locate-update-path)))
590 (shell-command locate-update-command)))
591 (locate str)))
566 592
567;;; Modified three functions from `dired.el': 593;;; Modified three functions from `dired.el':
568;;; dired-find-directory, 594;;; dired-find-directory,
diff --git a/lisp/mh-e/ChangeLog b/lisp/mh-e/ChangeLog
index a679b5d65eb..a49e3b2a4a3 100644
--- a/lisp/mh-e/ChangeLog
+++ b/lisp/mh-e/ChangeLog
@@ -1,3 +1,48 @@
12006-07-03 Bill Wohler <wohler@newt.com>
2
3 Release MH-E version 8.0.2.
4
5 * mh-e.el (Version, mh-version): Update for release 8.0.2.
6
72006-07-03 Ted Phelps <phelps@gnusto.com> (tiny change)
8
9 * mh-tool-bar.el (mh-tool-bar-define): Fix XEmacs' vector-list so
10 it refers to the icons in mh-xemacs-icon-map instead of trying to
11 declare the icons in situ. This allows mh-tool-bar.el to be
12 compiled under XEmacs. Remove initial value for
13 mh-tool-bar-folder-buttons, mh-tool-bar-show-buttons,
14 mh-tool-bar-letter-buttons. The MH-E icons now appear in XEmacs.
15 In mh-tool-bar-init, check for mh-xemacs-use-tool-bar-flag sooner.
16 This allows MH-E to be used in XEmacs in a tty (closes SF
17 #1506846).
18
192006-07-03 Bill Wohler <wohler@newt.com>
20
21 * mh-e.el: Require mh-buffers and mh-compat before mh-xemacs now
22 that mh-xemacs needs functions in mh-compat.
23
242006-06-29 Bill Wohler <wohler@newt.com>
25
26 * mh-search.el (mh-search, mh-index-group-by-folder): Add "the" in
27 loop construct to be consistent with other loops, and because
28 edebug doesn't work without it.
29
302006-06-29 Ted Phelps <phelps@gnusto.com> (tiny change)
31
32 * mh-search.el (mh-folder-exists-p): Strip + from folder to avoid
33 redundant +s in regexp (closes SF #1514424).
34
352006-06-29 Sergey Poznyakoff <gray@Mirddin.farlep.net> (tiny change)
36
37 * mh-mime.el (mh-mime-save-parts): Add -store option to
38 mhn (closes SF #1513140).
39
402006-06-20 Bill Wohler <wohler@newt.com>
41
42 Release MH-E version 8.0.1.
43
44 * mh-e.el (Version, mh-version): Update for release 8.0.1.
45
12006-06-15 Bill Wohler <wohler@newt.com> 462006-06-15 Bill Wohler <wohler@newt.com>
2 47
3 * mh-search.el (mh-index-new-folder): Use -2 suffix instead of <2> 48 * mh-search.el (mh-index-new-folder): Use -2 suffix instead of <2>
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index 28fff81e93b..ba48a84ad99 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -6,7 +6,7 @@
6 6
7;; Author: Bill Wohler <wohler@newt.com> 7;; Author: Bill Wohler <wohler@newt.com>
8;; Maintainer: Bill Wohler <wohler@newt.com> 8;; Maintainer: Bill Wohler <wohler@newt.com>
9;; Version: 8.0 9;; Version: 8.0.2
10;; Keywords: mail 10;; Keywords: mail
11 11
12;; This file is part of GNU Emacs. 12;; This file is part of GNU Emacs.
@@ -96,6 +96,9 @@
96 96
97(mh-require-cl) 97(mh-require-cl)
98 98
99(require 'mh-buffers)
100(require 'mh-compat)
101
99(eval-and-compile 102(eval-and-compile
100 (defvar mh-xemacs-flag (featurep 'xemacs) 103 (defvar mh-xemacs-flag (featurep 'xemacs)
101 "Non-nil means the current Emacs is XEmacs.")) 104 "Non-nil means the current Emacs is XEmacs."))
@@ -103,9 +106,6 @@
103(mh-do-in-xemacs 106(mh-do-in-xemacs
104 (require 'mh-xemacs)) 107 (require 'mh-xemacs))
105 108
106(require 'mh-buffers)
107(require 'mh-compat)
108
109(mh-font-lock-add-keywords 109(mh-font-lock-add-keywords
110 'emacs-lisp-mode 110 'emacs-lisp-mode
111 (eval-when-compile 111 (eval-when-compile
@@ -133,7 +133,7 @@
133;; Try to keep variables local to a single file. Provide accessors if 133;; Try to keep variables local to a single file. Provide accessors if
134;; variables are shared. Use this section as a last resort. 134;; variables are shared. Use this section as a last resort.
135 135
136(defconst mh-version "8.0" "Version number of MH-E.") 136(defconst mh-version "8.0.2" "Version number of MH-E.")
137 137
138;; Variants 138;; Variants
139 139
diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el
index c05e867a2b4..a66db002b6a 100644
--- a/lisp/mh-e/mh-mime.el
+++ b/lisp/mh-e/mh-mime.el
@@ -415,7 +415,9 @@ do the work."
415 (let ((initial-size (mh-truncate-log-buffer))) 415 (let ((initial-size (mh-truncate-log-buffer)))
416 (apply 'call-process 416 (apply 'call-process
417 (expand-file-name command mh-progs) nil t nil 417 (expand-file-name command mh-progs) nil t nil
418 (mh-list-to-string (list folder msg "-auto"))) 418 (mh-list-to-string (list folder msg "-auto"
419 (if (not (mh-variant-p 'nmh))
420 "-store"))))
419 (if (> (buffer-size) initial-size) 421 (if (> (buffer-size) initial-size)
420 (save-window-excursion 422 (save-window-excursion
421 (switch-to-buffer-other-window mh-log-buffer) 423 (switch-to-buffer-other-window mh-log-buffer)
diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el
index 62c130bb90f..191e42f734a 100644
--- a/lisp/mh-e/mh-search.el
+++ b/lisp/mh-e/mh-search.el
@@ -318,9 +318,9 @@ folder containing the index search results."
318 318
319 (message "%s found %s matches in %s folders" 319 (message "%s found %s matches in %s folders"
320 (upcase-initials (symbol-name mh-searcher)) 320 (upcase-initials (symbol-name mh-searcher))
321 (loop for msg-hash being hash-values of mh-index-data 321 (loop for msg-hash being the hash-values of mh-index-data
322 sum (hash-table-count msg-hash)) 322 sum (hash-table-count msg-hash))
323 (loop for msg-hash being hash-values of mh-index-data 323 (loop for msg-hash being the hash-values of mh-index-data
324 count (> (hash-table-count msg-hash) 0))))))) 324 count (> (hash-table-count msg-hash) 0)))))))
325 325
326;; Shush compiler. 326;; Shush compiler.
@@ -1362,7 +1362,7 @@ being the list of messages originally from that folder."
1362 (save-excursion 1362 (save-excursion
1363 (goto-char (point-min)) 1363 (goto-char (point-min))
1364 (let ((result-table (make-hash-table :test #'equal))) 1364 (let ((result-table (make-hash-table :test #'equal)))
1365 (loop for msg being hash-keys of mh-index-msg-checksum-map 1365 (loop for msg being the hash-keys of mh-index-msg-checksum-map
1366 do (push msg (gethash (car (gethash 1366 do (push msg (gethash (car (gethash
1367 (gethash msg mh-index-msg-checksum-map) 1367 (gethash msg mh-index-msg-checksum-map)
1368 mh-index-checksum-origin-map)) 1368 mh-index-checksum-origin-map))
@@ -1524,7 +1524,8 @@ construct the base name."
1524 (with-temp-buffer 1524 (with-temp-buffer
1525 (mh-exec-cmd-output "folder" nil "-fast" "-nocreate" folder) 1525 (mh-exec-cmd-output "folder" nil "-fast" "-nocreate" folder)
1526 (goto-char (point-min)) 1526 (goto-char (point-min))
1527 (looking-at (format "+?%s" folder)))))) 1527 ;; Strip + from folder; use optional + in regexp.
1528 (looking-at (format "+?%s" (substring folder 1)))))))
1528 1529
1529(defun mh-msg-exists-p (msg folder) 1530(defun mh-msg-exists-p (msg folder)
1530 "Check if MSG exists in FOLDER." 1531 "Check if MSG exists in FOLDER."
diff --git a/lisp/mh-e/mh-tool-bar.el b/lisp/mh-e/mh-tool-bar.el
index 9b18848bd12..a5131420753 100644
--- a/lisp/mh-e/mh-tool-bar.el
+++ b/lisp/mh-e/mh-tool-bar.el
@@ -149,7 +149,7 @@ where,
149 (name-str (symbol-name name)) 149 (name-str (symbol-name name))
150 (icon (nth 2 button)) 150 (icon (nth 2 button))
151 (xemacs-icon (mh-do-in-xemacs 151 (xemacs-icon (mh-do-in-xemacs
152 (cdr (assoc (intern icon) mh-xemacs-icon-map)))) 152 `(cdr (assoc (quote ,(intern icon)) mh-xemacs-icon-map))))
153 (full-doc (nth 3 button)) 153 (full-doc (nth 3 button))
154 (doc (if (string-match "\\(.*\\)\n" full-doc) 154 (doc (if (string-match "\\(.*\\)\n" full-doc)
155 (match-string 1 full-doc) 155 (match-string 1 full-doc)
@@ -189,7 +189,7 @@ where,
189 (t 'folder-buttons))) 189 (t 'folder-buttons)))
190 (docs (cond ((eq mbuttons 'letter-buttons) 'letter-docs) 190 (docs (cond ((eq mbuttons 'letter-buttons) 'letter-docs)
191 ((eq mbuttons 'folder-buttons) 'folder-docs)))) 191 ((eq mbuttons 'folder-buttons) 'folder-docs))))
192 (add-to-list vector-list `[,xemacs-icon ,function t ,full-doc]) 192 (add-to-list vector-list `(vector ,xemacs-icon ',function t ,full-doc))
193 (add-to-list 193 (add-to-list
194 setter `(when (member ',name ,list) 194 setter `(when (member ',name ,list)
195 (mh-funcall-if-exists 195 (mh-funcall-if-exists
@@ -288,27 +288,28 @@ Use SEQUENCE-MAP if display is limited; DEFAULT-MAP otherwise."
288 ;; XEmacs specific code 288 ;; XEmacs specific code
289 (mh-do-in-xemacs 289 (mh-do-in-xemacs
290 (defvar mh-tool-bar-folder-vector-map 290 (defvar mh-tool-bar-folder-vector-map
291 ',(loop for button in folder-buttons 291 (list ,@(loop for button in folder-buttons
292 for vector in folder-vectors 292 for vector in folder-vectors
293 collect (cons button vector))) 293 collect `(cons ',button ,vector))))
294 (defvar mh-tool-bar-show-vector-map 294 (defvar mh-tool-bar-show-vector-map
295 ',(loop for button in show-buttons 295 (list ,@(loop for button in show-buttons
296 for vector in show-vectors 296 for vector in show-vectors
297 collect (cons button vector))) 297 collect `(cons ',button ,vector))))
298 (defvar mh-tool-bar-letter-vector-map 298 (defvar mh-tool-bar-letter-vector-map
299 ',(loop for button in letter-buttons 299 (list ,@(loop for button in letter-buttons
300 for vector in letter-vectors 300 for vector in letter-vectors
301 collect (cons button vector))) 301 collect `(cons ',button ,vector))))
302 (defvar mh-tool-bar-folder-buttons nil) 302 (defvar mh-tool-bar-folder-buttons)
303 (defvar mh-tool-bar-show-buttons nil) 303 (defvar mh-tool-bar-show-buttons)
304 (defvar mh-tool-bar-letter-buttons nil) 304 (defvar mh-tool-bar-letter-buttons)
305 ;; Custom setter functions 305 ;; Custom setter functions
306 (defun mh-tool-bar-letter-buttons-set (symbol value) 306 (defun mh-tool-bar-letter-buttons-set (symbol value)
307 (set-default symbol value) 307 (set-default symbol value)
308 (when mh-xemacs-has-tool-bar-flag 308 (when mh-xemacs-has-tool-bar-flag
309 (setq mh-tool-bar-letter-buttons 309 (setq mh-tool-bar-letter-buttons
310 (loop for b in value 310 (loop for b in value
311 collect (cdr (assoc b mh-tool-bar-letter-vector-map)))))) 311 collect (cdr
312 (assoc b mh-tool-bar-letter-vector-map))))))
312 (defun mh-tool-bar-folder-buttons-set (symbol value) 313 (defun mh-tool-bar-folder-buttons-set (symbol value)
313 (set-default symbol value) 314 (set-default symbol value)
314 (when mh-xemacs-has-tool-bar-flag 315 (when mh-xemacs-has-tool-bar-flag
@@ -320,13 +321,16 @@ Use SEQUENCE-MAP if display is limited; DEFAULT-MAP otherwise."
320 collect (cdr (assoc b mh-tool-bar-show-vector-map)))))) 321 collect (cdr (assoc b mh-tool-bar-show-vector-map))))))
321 (defun mh-tool-bar-init (mode) 322 (defun mh-tool-bar-init (mode)
322 "Install tool bar in MODE." 323 "Install tool bar in MODE."
323 (let ((tool-bar (cond ((eq mode :folder) mh-tool-bar-folder-buttons) 324 (when mh-xemacs-use-tool-bar-flag
324 ((eq mode :letter) mh-tool-bar-letter-buttons) 325 (let ((tool-bar (cond ((eq mode :folder)
325 ((eq mode :show) mh-tool-bar-show-buttons))) 326 mh-tool-bar-folder-buttons)
326 (height 37) 327 ((eq mode :letter)
327 (width 40) 328 mh-tool-bar-letter-buttons)
328 (buffer (current-buffer))) 329 ((eq mode :show)
329 (when mh-xemacs-use-tool-bar-flag 330 mh-tool-bar-show-buttons)))
331 (height 37)
332 (width 40)
333 (buffer (current-buffer)))
330 (cond 334 (cond
331 ((eq mh-xemacs-tool-bar-position 'top) 335 ((eq mh-xemacs-tool-bar-position 'top)
332 (set-specifier top-toolbar tool-bar buffer) 336 (set-specifier top-toolbar tool-bar buffer)
@@ -367,8 +371,9 @@ Use SEQUENCE-MAP if display is limited; DEFAULT-MAP otherwise."
367 for y in letter-docs 371 for y in letter-docs
368 collect `(const :tag ,y ,x))) 372 collect `(const :tag ,y ,x)))
369 ;;:package-version '(MH-E "7.1") 373 ;;:package-version '(MH-E "7.1")
370 )))) 374 ))))
371 375
376;; The icon names are duplicated in the Makefile and mh-xemacs.el.
372(mh-tool-bar-define 377(mh-tool-bar-define
373 ((:folder mh-inc-folder mh-mime-save-parts 378 ((:folder mh-inc-folder mh-mime-save-parts
374 mh-previous-undeleted-msg mh-page-msg 379 mh-previous-undeleted-msg mh-page-msg
diff --git a/lisp/msb.el b/lisp/msb.el
index d5f32486971..aa42e183007 100644
--- a/lisp/msb.el
+++ b/lisp/msb.el
@@ -473,18 +473,21 @@ selects that window.
473See the function `mouse-select-buffer' and the variable 473See the function `mouse-select-buffer' and the variable
474`msb-menu-cond' for more information about how the menus are split." 474`msb-menu-cond' for more information about how the menus are split."
475 (interactive "e") 475 (interactive "e")
476 ;; If EVENT is a down-event, read and discard the
477 ;; corresponding up-event.
478 (and (eventp event)
479 (memq 'down (event-modifiers event))
480 (read-event))
481 (let ((old-window (selected-window)) 476 (let ((old-window (selected-window))
482 (window (posn-window (event-start event)))) 477 (window (posn-window (event-start event)))
478 early-release)
483 (unless (framep window) (select-window window)) 479 (unless (framep window) (select-window window))
480 ;; This `sit-for' magically makes the menu stay up if the mouse
481 ;; button is released within 0.1 second.
482 (setq early-release (not (sit-for 0.1 t)))
484 (let ((buffer (mouse-select-buffer event))) 483 (let ((buffer (mouse-select-buffer event)))
485 (if buffer 484 (if buffer
486 (switch-to-buffer buffer) 485 (switch-to-buffer buffer)
487 (select-window old-window)))) 486 (select-window old-window)))
487 ;; If the above `sit-for' was interrupted by a mouse-up, avoid
488 ;; generating a drag event.
489 (if (and early-release (memq 'down (event-modifiers last-input-event)))
490 (discard-input)))
488 nil) 491 nil)
489 492
490;;; 493;;;
@@ -995,9 +998,6 @@ variable `msb-menu-cond'."
995 ;; adjust position 998 ;; adjust position
996 (setq posX (- posX (funcall msb-horizontal-shift-function)) 999 (setq posX (- posX (funcall msb-horizontal-shift-function))
997 position (list (list posX posY) posWind)))) 1000 position (list (list posX posY) posWind))))
998 ;; This `sit-for' magically makes the menu stay up if the mouse
999 ;; button is released within 0.1 second.
1000 (sit-for 0 100)
1001 ;; Popup the menu 1001 ;; Popup the menu
1002 (setq choice (x-popup-menu position msb--last-buffer-menu)) 1002 (setq choice (x-popup-menu position msb--last-buffer-menu))
1003 (cond 1003 (cond
diff --git a/lisp/net/goto-addr.el b/lisp/net/goto-addr.el
index 89695b61b36..44970f7aaf3 100644
--- a/lisp/net/goto-addr.el
+++ b/lisp/net/goto-addr.el
@@ -250,6 +250,7 @@ Also fontifies the buffer appropriately (see `goto-address-fontify-p' and
250 (interactive) 250 (interactive)
251 (if goto-address-highlight-p 251 (if goto-address-highlight-p
252 (goto-address-fontify))) 252 (goto-address-fontify)))
253;;;###autoload(put 'goto-address 'safe-local-eval-function t)
253 254
254(provide 'goto-addr) 255(provide 'goto-addr)
255 256
diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el
index a0b328413b0..1f051ffa9f2 100644
--- a/lisp/net/rcirc.el
+++ b/lisp/net/rcirc.el
@@ -74,7 +74,7 @@
74 :group 'rcirc) 74 :group 'rcirc)
75 75
76(defcustom rcirc-default-user-full-name (if (string= (user-full-name) "") 76(defcustom rcirc-default-user-full-name (if (string= (user-full-name) "")
77 rcirc-user-name 77 rcirc-default-user-name
78 (user-full-name)) 78 (user-full-name))
79 "The full name sent to the server when connecting." 79 "The full name sent to the server when connecting."
80 :type 'string 80 :type 'string
@@ -469,7 +469,7 @@ Functions are called with PROCESS and SENTINEL arguments.")
469 "Return a list of rcirc processes." 469 "Return a list of rcirc processes."
470 (let (ps) 470 (let (ps)
471 (mapc (lambda (p) 471 (mapc (lambda (p)
472 (when (process-buffer p) 472 (when (buffer-live-p (process-buffer p))
473 (with-rcirc-process-buffer p 473 (with-rcirc-process-buffer p
474 (when (eq major-mode 'rcirc-mode) 474 (when (eq major-mode 'rcirc-mode)
475 (setq ps (cons p ps)))))) 475 (setq ps (cons p ps))))))
@@ -719,8 +719,8 @@ If NOTICEP is non-nil, send a notice instead of privmsg."
719 (serv (if (consp (car i)) (cdar i) ""))) 719 (serv (if (consp (car i)) (cdar i) "")))
720 (when (and (string-match chan (or target "")) 720 (when (and (string-match chan (or target ""))
721 (string-match serv (rcirc-server-name process))) 721 (string-match serv (rcirc-server-name process)))
722 (setq rcirc-decode-coding-system (if (consp (cdr i)) (cadr i) i) 722 (setq rcirc-decode-coding-system (if (consp (cdr i)) (cadr i) (cdr i))
723 rcirc-encode-coding-system (if (consp (cdr i)) (cddr i) i))))) 723 rcirc-encode-coding-system (if (consp (cdr i)) (cddr i) (cdr i))))))
724 724
725 ;; setup the prompt and markers 725 ;; setup the prompt and markers
726 (make-local-variable 'rcirc-prompt-start-marker) 726 (make-local-variable 'rcirc-prompt-start-marker)
diff --git a/lisp/net/rcompile.el b/lisp/net/rcompile.el
index 469f268fb9c..158069986d2 100644
--- a/lisp/net/rcompile.el
+++ b/lisp/net/rcompile.el
@@ -115,17 +115,25 @@ nil means run no commands."
115 115
116;;;; entry point 116;;;; entry point
117 117
118;; We use the Tramp internal functions `with-parsed-tramp-file-name'
119;; and `tramp-make-tramp-file-name'. Better would be, if there are
120;; functions to provide user, host and localname of a remote filename,
121;; independent of Tramp's implementation. The function calls are
122;; wrapped by `funcall' in order to pacify the byte compiler.
123;; ange-ftp check removed, because it is handled also by Tramp.
118;;;###autoload 124;;;###autoload
119(defun remote-compile (host user command) 125(defun remote-compile (host user command)
120 "Compile the current buffer's directory on HOST. Log in as USER. 126 "Compile the current buffer's directory on HOST. Log in as USER.
121See \\[compile]." 127See \\[compile]."
122 (interactive 128 (interactive
123 (let ((parsed (or (and (featurep 'ange-ftp) 129 (let ((parsed (and (featurep 'tramp)
124 (ange-ftp-ftp-name default-directory)))) 130 (file-remote-p default-directory)))
125 host user command prompt) 131 host user command prompt l l-host l-user)
126 (if parsed 132 (if parsed
127 (setq host (nth 0 parsed) 133 (funcall (symbol-function 'with-parsed-tramp-file-name)
128 user (nth 1 parsed)) 134 default-directory l
135 (setq host l-host
136 user l-user))
129 (setq prompt (if (stringp remote-compile-host) 137 (setq prompt (if (stringp remote-compile-host)
130 (format "Compile on host (default %s): " 138 (format "Compile on host (default %s): "
131 remote-compile-host) 139 remote-compile-host)
@@ -155,8 +163,9 @@ See \\[compile]."
155 (setq remote-compile-user user)) 163 (setq remote-compile-user user))
156 ((null remote-compile-user) 164 ((null remote-compile-user)
157 (setq remote-compile-user (user-login-name)))) 165 (setq remote-compile-user (user-login-name))))
158 (let* ((parsed (and (featurep 'ange-ftp) 166 (let* (localname ;; Pacify byte-compiler.
159 (ange-ftp-ftp-name default-directory))) 167 (parsed (and (featurep 'tramp)
168 (file-remote-p default-directory)))
160 (compile-command 169 (compile-command
161 (format "%s %s -l %s \"(%scd %s; %s)\"" 170 (format "%s %s -l %s \"(%scd %s; %s)\""
162 remote-shell-program 171 remote-shell-program
@@ -165,16 +174,25 @@ See \\[compile]."
165 (if remote-compile-run-before 174 (if remote-compile-run-before
166 (concat remote-compile-run-before "; ") 175 (concat remote-compile-run-before "; ")
167 "") 176 "")
168 (if parsed (nth 2 parsed) default-directory) 177 (if parsed
178 (funcall (symbol-function 'with-parsed-tramp-file-name)
179 default-directory nil localname)
180 "")
169 compile-command))) 181 compile-command)))
170 (setq remote-compile-host host) 182 (setq remote-compile-host host)
171 (save-some-buffers nil nil) 183 (save-some-buffers nil nil)
172 (compilation-start compile-command) 184 (compilation-start compile-command)
173 ;; Set comint-file-name-prefix in the compilation buffer so 185 ;; Set comint-file-name-prefix in the compilation buffer so
174 ;; compilation-parse-errors will find referenced files by ange-ftp. 186 ;; compilation-parse-errors will find referenced files by Tramp.
175 (with-current-buffer compilation-last-buffer 187 (with-current-buffer compilation-last-buffer
176 (set (make-local-variable 'comint-file-name-prefix) 188 (when (featurep 'tramp)
177 (concat "/" host ":"))))) 189 (set (make-local-variable 'comint-file-name-prefix)
190 (funcall (symbol-function 'tramp-make-tramp-file-name)
191 nil ;; multi-method. To be removed with Tramp 2.1.
192 nil
193 remote-compile-user
194 remote-compile-host
195 ""))))))
178 196
179;;; arch-tag: 2866a132-ece4-4ce9-9f91-ec147f803f73 197;;; arch-tag: 2866a132-ece4-4ce9-9f91-ec147f803f73
180;;; rcompile.el ends here 198;;; rcompile.el ends here
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index c4166bb6d24..cb5a6d75331 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -3572,7 +3572,8 @@ This will break if COMMAND prints a newline, followed by the value of
3572 ;; for `find-grep-dired' and `find-name-dired' in Emacs 22. 3572 ;; for `find-grep-dired' and `find-name-dired' in Emacs 22.
3573 (if (tramp-tramp-file-p default-directory) 3573 (if (tramp-tramp-file-p default-directory)
3574 (with-parsed-tramp-file-name default-directory nil 3574 (with-parsed-tramp-file-name default-directory nil
3575 (let ((asynchronous (string-match "[ \t]*&[ \t]*\\'" command)) 3575 (let ((curbuf (current-buffer))
3576 (asynchronous (string-match "[ \t]*&[ \t]*\\'" command))
3576 status) 3577 status)
3577 (unless output-buffer 3578 (unless output-buffer
3578 (setq output-buffer 3579 (setq output-buffer
@@ -3674,6 +3675,7 @@ This will break if COMMAND prints a newline, followed by the value of
3674 (unless (zerop (buffer-size)) 3675 (unless (zerop (buffer-size))
3675 (when tramp-display-shell-command-buffer 3676 (when tramp-display-shell-command-buffer
3676 (display-buffer output-buffer))) 3677 (display-buffer output-buffer)))
3678 (set-buffer curbuf)
3677 status)) 3679 status))
3678 ;; The following is only executed if something strange was 3680 ;; The following is only executed if something strange was
3679 ;; happening. Emit a helpful message and do it anyway. 3681 ;; happening. Emit a helpful message and do it anyway.
@@ -7591,6 +7593,7 @@ Therefore, the contents of files might be included in the debug buffer(s).")
7591;; - Cleanup autoloads 7593;; - Cleanup autoloads
7592;;;###autoload 7594;;;###autoload
7593(defun tramp-unload-tramp () 7595(defun tramp-unload-tramp ()
7596 "Discard Tramp from loading remote files."
7594 (interactive) 7597 (interactive)
7595 ;; When Tramp is not loaded yet, its autoloads are still active. 7598 ;; When Tramp is not loaded yet, its autoloads are still active.
7596 (tramp-unload-file-name-handlers) 7599 (tramp-unload-file-name-handlers)
diff --git a/lisp/play/cookie1.el b/lisp/play/cookie1.el
index bc4ee84da2f..7a2e6c602ea 100644
--- a/lisp/play/cookie1.el
+++ b/lisp/play/cookie1.el
@@ -1,6 +1,6 @@
1;;; cookie1.el --- retrieve random phrases from fortune cookie files 1;;; cookie1.el --- retrieve random phrases from fortune cookie files
2 2
3;; Copyright (C) 1993, 2002, 2003, 2004, 2005, 3;; Copyright (C) 1993, 2002, 2003, 2004, 2005, 2006,
4;; 2006 Free Software Foundation, Inc. 4;; 2006 Free Software Foundation, Inc.
5 5
6;; Author: Eric S. Raymond <esr@snark.thyrsus.com> 6;; Author: Eric S. Raymond <esr@snark.thyrsus.com>
@@ -75,7 +75,7 @@ When the phrase file is read in, display STARTMSG at the beginning
75of load, ENDMSG at the end." 75of load, ENDMSG at the end."
76 (let ((cookie-vector (cookie-snarf phrase-file startmsg endmsg))) 76 (let ((cookie-vector (cookie-snarf phrase-file startmsg endmsg)))
77 (shuffle-vector cookie-vector) 77 (shuffle-vector cookie-vector)
78 (aref cookie-vector 1))) 78 (aref cookie-vector 0)))
79 79
80;;;###autoload 80;;;###autoload
81(defun cookie-insert (phrase-file &optional count startmsg endmsg) 81(defun cookie-insert (phrase-file &optional count startmsg endmsg)
diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el
index 2c6a75da03e..ae8a62c48f1 100644
--- a/lisp/play/dunnet.el
+++ b/lisp/play/dunnet.el
@@ -1304,7 +1304,7 @@ for a moment, then straighten yourself up.
1304 (condition-case nil 1304 (condition-case nil
1305 (dun-rot13) 1305 (dun-rot13)
1306 (error (yank))) 1306 (error (yank)))
1307 (eval-current-buffer) 1307 (eval-buffer)
1308 (kill-buffer (current-buffer))) 1308 (kill-buffer (current-buffer)))
1309 (switch-to-buffer old-buffer) 1309 (switch-to-buffer old-buffer)
1310 result)) 1310 result))
@@ -2576,7 +2576,7 @@ treasures for points?" "4" "four")
2576 (insert ")") 2576 (insert ")")
2577 (setq eval-error nil) 2577 (setq eval-error nil)
2578 (condition-case nil 2578 (condition-case nil
2579 (eval-current-buffer) 2579 (eval-buffer)
2580 (error (setq eval-error t))) 2580 (error (setq eval-error t)))
2581 (kill-buffer (current-buffer)) 2581 (kill-buffer (current-buffer))
2582 (switch-to-buffer "*dungeon*") 2582 (switch-to-buffer "*dungeon*")
diff --git a/lisp/play/landmark.el b/lisp/play/landmark.el
index 7ec6f9bb187..1bd1c7ec48a 100644
--- a/lisp/play/landmark.el
+++ b/lisp/play/landmark.el
@@ -9,7 +9,7 @@
9 9
10;;;_* Usage 10;;;_* Usage
11;;; Just type 11;;; Just type
12;;; M-x eval-current-buffer 12;;; M-x eval-buffer
13;;; M-x lm-test-run 13;;; M-x lm-test-run
14 14
15 15
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el
index d7e1ecb67e1..9dc74264da8 100644
--- a/lisp/progmodes/ada-mode.el
+++ b/lisp/progmodes/ada-mode.el
@@ -438,7 +438,7 @@ An example is:
438 438
439(defcustom ada-which-compiler 'gnat 439(defcustom ada-which-compiler 'gnat
440 "*Name of the compiler to use. 440 "*Name of the compiler to use.
441This will determine what features are made available through the ada-mode. 441This will determine what features are made available through the Ada mode.
442The possible choices are : 442The possible choices are :
443`gnat': Use Ada Core Technologies' Gnat compiler. Add some cross-referencing 443`gnat': Use Ada Core Technologies' Gnat compiler. Add some cross-referencing
444 features 444 features
@@ -460,7 +460,7 @@ The extensions should include a `.' if needed.")
460The extensions should include a `.' if needed.") 460The extensions should include a `.' if needed.")
461 461
462(defvar ada-mode-menu (make-sparse-keymap "Ada") 462(defvar ada-mode-menu (make-sparse-keymap "Ada")
463 "Menu for ada-mode.") 463 "Menu for Ada mode.")
464 464
465(defvar ada-mode-map (make-sparse-keymap) 465(defvar ada-mode-map (make-sparse-keymap)
466 "Local keymap used for Ada mode.") 466 "Local keymap used for Ada mode.")
@@ -728,7 +728,7 @@ each type of entity that can be found in an Ada file.")
728;;------------------------------------------------------------ 728;;------------------------------------------------------------
729 729
730(defun ada-compile-mouse-goto-error () 730(defun ada-compile-mouse-goto-error ()
731 "Mouse interface for ada-compile-goto-error." 731 "Mouse interface for `ada-compile-goto-error'."
732 (interactive) 732 (interactive)
733 (mouse-set-point last-input-event) 733 (mouse-set-point last-input-event)
734 (ada-compile-goto-error (point)) 734 (ada-compile-goto-error (point))
@@ -906,7 +906,7 @@ declares it as a word constituent."
906 (setq change (cdr change))))))) 906 (setq change (cdr change)))))))
907 907
908(defun ada-deactivate-properties () 908(defun ada-deactivate-properties ()
909 "Deactivate ada-mode's properties handling. 909 "Deactivate Ada mode's properties handling.
910This would be a duplicate of font-lock if both are used at the same time." 910This would be a duplicate of font-lock if both are used at the same time."
911 (remove-hook 'after-change-functions 'ada-after-change-function t)) 911 (remove-hook 'after-change-functions 'ada-after-change-function t))
912 912
@@ -977,7 +977,7 @@ If parse-result is non-nil, use is instead of calling `parse-partial-sexp'."
977 977
978;;------------------------------------------------------------------ 978;;------------------------------------------------------------------
979;; Contextual menus 979;; Contextual menus
980;; The Ada-mode comes with contextual menus, bound by default to the right 980;; The Ada mode comes with contextual menus, bound by default to the right
981;; mouse button. 981;; mouse button.
982;; Add items to this menu by modifying `ada-contextual-menu'. Note that the 982;; Add items to this menu by modifying `ada-contextual-menu'. Note that the
983;; variable `ada-contextual-menu-on-identifier' is set automatically to t 983;; variable `ada-contextual-menu-on-identifier' is set automatically to t
@@ -1419,7 +1419,7 @@ If you use ada-xref.el:
1419 1419
1420;;----------------------------------------------------------------- 1420;;-----------------------------------------------------------------
1421;; auto-casing 1421;; auto-casing
1422;; Since Ada is case-insensitive, the Ada-mode provides an extensive set of 1422;; Since Ada is case-insensitive, the Ada mode provides an extensive set of
1423;; functions to auto-case identifiers, keywords, ... 1423;; functions to auto-case identifiers, keywords, ...
1424;; The basic rules for autocasing are defined through the variables 1424;; The basic rules for autocasing are defined through the variables
1425;; `ada-case-attribute', `ada-case-keyword' and `ada-case-identifier'. These 1425;; `ada-case-attribute', `ada-case-keyword' and `ada-case-identifier'. These
@@ -1766,7 +1766,7 @@ ARG is ignored, and is there for compatibility with `capitalize-word' only."
1766 1766
1767(defun ada-no-auto-case (&optional arg) 1767(defun ada-no-auto-case (&optional arg)
1768 "Do nothing. 1768 "Do nothing.
1769This function can be used for the auto-casing variables in the ada-mode, to 1769This function can be used for the auto-casing variables in the Ada mode, to
1770adapt to unusal auto-casing schemes. Since it does nothing, you can for 1770adapt to unusal auto-casing schemes. Since it does nothing, you can for
1771instance use it for `ada-case-identifier' if you don't want any special 1771instance use it for `ada-case-identifier' if you don't want any special
1772auto-casing for identifiers, whereas keywords have to be lower-cased. 1772auto-casing for identifiers, whereas keywords have to be lower-cased.
@@ -2122,7 +2122,7 @@ Return the equivalent internal parameter list."
2122;; that are evaluated) 2122;; that are evaluated)
2123;; Thus the total indentation for a line is the column number of the reference 2123;; Thus the total indentation for a line is the column number of the reference
2124;; position plus whatever value the evaluation of the second element provides. 2124;; position plus whatever value the evaluation of the second element provides.
2125;; This mechanism is used so that the ada-mode can "explain" how the 2125;; This mechanism is used so that the Ada mode can "explain" how the
2126;; indentation was calculated, by showing which variables were used. 2126;; indentation was calculated, by showing which variables were used.
2127;; 2127;;
2128;; The indentation itself is done in only one pass: first we try to guess in 2128;; The indentation itself is done in only one pass: first we try to guess in
@@ -5268,7 +5268,7 @@ Use `M-x widen' to go back to the full visibility for the buffer."
5268 5268
5269;; --------------------------------------------------------- 5269;; ---------------------------------------------------------
5270;; Automatic generation of code 5270;; Automatic generation of code
5271;; The Ada-mode has a set of function to automatically generate a subprogram 5271;; The Ada mode has a set of function to automatically generate a subprogram
5272;; or package body from its spec. 5272;; or package body from its spec.
5273;; These function only use a primary and basic algorithm, this could use a 5273;; These function only use a primary and basic algorithm, this could use a
5274;; lot of improvement. 5274;; lot of improvement.
@@ -5440,7 +5440,7 @@ This function typically is to be hooked into `ff-file-created-hooks'."
5440;; Read the special cases for exceptions 5440;; Read the special cases for exceptions
5441(ada-case-read-exceptions) 5441(ada-case-read-exceptions)
5442 5442
5443;; Setup auto-loading of the other ada-mode files. 5443;; Setup auto-loading of the other Ada mode files.
5444(if (equal ada-which-compiler 'gnat) 5444(if (equal ada-which-compiler 'gnat)
5445 (progn 5445 (progn
5446 (autoload 'ada-change-prj "ada-xref" nil t) 5446 (autoload 'ada-change-prj "ada-xref" nil t)
diff --git a/lisp/progmodes/gdb-ui.el b/lisp/progmodes/gdb-ui.el
index f3144cbb84a..684102015cc 100644
--- a/lisp/progmodes/gdb-ui.el
+++ b/lisp/progmodes/gdb-ui.el
@@ -1325,6 +1325,7 @@ directives."
1325 (setq gdb-active-process nil) 1325 (setq gdb-active-process nil)
1326 (setq gud-overlay-arrow-position nil) 1326 (setq gud-overlay-arrow-position nil)
1327 (setq gdb-overlay-arrow-position nil) 1327 (setq gdb-overlay-arrow-position nil)
1328 (setq gud-old-arrow nil)
1328 (setq gdb-inferior-status "exited") 1329 (setq gdb-inferior-status "exited")
1329 (gdb-force-mode-line-update gdb-inferior-status) 1330 (gdb-force-mode-line-update gdb-inferior-status)
1330 (gdb-stopping ignored)) 1331 (gdb-stopping ignored))
@@ -3217,8 +3218,8 @@ BUFFER nil or omitted means use the current buffer."
3217 (setq gdb-frame-number (match-string 1)) 3218 (setq gdb-frame-number (match-string 1))
3218 (setq gdb-frame-address (match-string 2))) 3219 (setq gdb-frame-address (match-string 2)))
3219 (goto-char (point-min)) 3220 (goto-char (point-min))
3220 (when (re-search-forward ".*=\\s-+0x0*\\(\\S-*\\)\\s-+in\\s-+\\(\\S-+?\\)\ 3221 (when (re-search-forward ".*=\\s-+0x0*\\(\\S-*\\)\\s-+in\\s-+\\(.*?\\)\
3221\\(?: (\\(\\S-+?\\):[0-9]+?)\\)*;? " 3222\\(?: (\\(\\S-+?\\):[0-9]+?)\\)*; "
3222 nil t) 3223 nil t)
3223 (setq gdb-selected-frame (match-string 2)) 3224 (setq gdb-selected-frame (match-string 2))
3224 (if (gdb-get-buffer 'gdb-locals-buffer) 3225 (if (gdb-get-buffer 'gdb-locals-buffer)
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index d207094cafe..eb803422027 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -282,13 +282,13 @@ Notice that using \\[next-error] or \\[compile-goto-error] modifies
282 (": \\(.+\\): \\(?:Permission denied\\|No such \\(?:file or directory\\|device or address\\)\\)$" 282 (": \\(.+\\): \\(?:Permission denied\\|No such \\(?:file or directory\\|device or address\\)\\)$"
283 1 grep-error-face) 283 1 grep-error-face)
284 ;; remove match from grep-regexp-alist before fontifying 284 ;; remove match from grep-regexp-alist before fontifying
285 ("^Grep started.*" 285 ("^Grep[/a-zA-z]* started.*"
286 (0 '(face nil message nil help-echo nil mouse-face nil) t)) 286 (0 '(face nil message nil help-echo nil mouse-face nil) t))
287 ("^Grep finished \\(?:(\\(matches found\\))\\|with \\(no matches found\\)\\).*" 287 ("^Grep[/a-zA-z]* finished \\(?:(\\(matches found\\))\\|with \\(no matches found\\)\\).*"
288 (0 '(face nil message nil help-echo nil mouse-face nil) t) 288 (0 '(face nil message nil help-echo nil mouse-face nil) t)
289 (1 compilation-info-face nil t) 289 (1 compilation-info-face nil t)
290 (2 compilation-warning-face nil t)) 290 (2 compilation-warning-face nil t))
291 ("^Grep \\(exited abnormally\\|interrupt\\|killed\\|terminated\\)\\(?:.*with code \\([0-9]+\\)\\)?.*" 291 ("^Grep[/a-zA-z]* \\(exited abnormally\\|interrupt\\|killed\\|terminated\\)\\(?:.*with code \\([0-9]+\\)\\)?.*"
292 (0 '(face nil message nil help-echo nil mouse-face nil) t) 292 (0 '(face nil message nil help-echo nil mouse-face nil) t)
293 (1 grep-error-face) 293 (1 grep-error-face)
294 (2 grep-error-face nil t)) 294 (2 grep-error-face nil t))
diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el
index 1ce5d404a80..c57c88d3ece 100644
--- a/lisp/progmodes/gud.el
+++ b/lisp/progmodes/gud.el
@@ -3366,6 +3366,12 @@ only tooltips in the buffer containing the overlay arrow."
3366(defvar gud-tooltip-mouse-motions-active nil 3366(defvar gud-tooltip-mouse-motions-active nil
3367 "Locally t in a buffer if tooltip processing of mouse motion is enabled.") 3367 "Locally t in a buffer if tooltip processing of mouse motion is enabled.")
3368 3368
3369;; We don't set track-mouse globally because this is a big redisplay
3370;; problem in buffers having a pre-command-hook or such installed,
3371;; which does a set-buffer, like the summary buffer of Gnus. Calling
3372;; set-buffer prevents redisplay optimizations, so every mouse motion
3373;; would be accompanied by a full redisplay.
3374
3369(defun gud-tooltip-activate-mouse-motions (activatep) 3375(defun gud-tooltip-activate-mouse-motions (activatep)
3370 "Activate/deactivate mouse motion events for the current buffer. 3376 "Activate/deactivate mouse motion events for the current buffer.
3371ACTIVATEP non-nil means activate mouse motion events." 3377ACTIVATEP non-nil means activate mouse motion events."
diff --git a/lisp/progmodes/make-mode.el b/lisp/progmodes/make-mode.el
index a3146df3e45..109455e9e61 100644
--- a/lisp/progmodes/make-mode.el
+++ b/lisp/progmodes/make-mode.el
@@ -294,7 +294,8 @@ not be enclosed in { } or ( )."
294 ;; We used to match not just the varname but also the whole value 294 ;; We used to match not just the varname but also the whole value
295 ;; (spanning potentially several lines). 295 ;; (spanning potentially several lines).
296 ;; "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=[ \t]*\\(\\(?:.+\\\\\n\\)*.+\\)\\|[*:+]?[:?]?=[ \t]*\\(\\(?:.*\\\\\n\\)*.*\\)\\)" 296 ;; "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=[ \t]*\\(\\(?:.+\\\\\n\\)*.+\\)\\|[*:+]?[:?]?=[ \t]*\\(\\(?:.*\\\\\n\\)*.*\\)\\)"
297 "^ *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=\\|[*:+]?[:?]?=\\)" 297 ;; What about the define statement? What about differentiating this for makepp?
298 "\\(?:^\\|^export\\|^override\\|:\\|: *override\\) *\\([^ \n\t][^:#= \t\n]*\\)[ \t]*\\(?:!=\\|[*:+]?[:?]?=\\)"
298 "Regex used to find macro assignment lines in a makefile.") 299 "Regex used to find macro assignment lines in a makefile.")
299 300
300(defconst makefile-var-use-regex 301(defconst makefile-var-use-regex
@@ -305,8 +306,6 @@ not be enclosed in { } or ( )."
305 "\\(^\\..*\\)\\|\\(.*~$\\)\\|\\(.*,v$\\)\\|\\(\\.[chy]\\)" 306 "\\(^\\..*\\)\\|\\(.*~$\\)\\|\\(.*,v$\\)\\|\\(\\.[chy]\\)"
306 "Regex for filenames that will NOT be included in the target list.") 307 "Regex for filenames that will NOT be included in the target list.")
307 308
308(if (fboundp 'facemenu-unlisted-faces)
309 (add-to-list 'facemenu-unlisted-faces 'makefile-space))
310(defvar makefile-space 'makefile-space 309(defvar makefile-space 'makefile-space
311 "Face to use for highlighting leading spaces in Font-Lock mode.") 310 "Face to use for highlighting leading spaces in Font-Lock mode.")
312 311
@@ -320,9 +319,9 @@ not be enclosed in { } or ( )."
320 "List of keywords understood by automake.") 319 "List of keywords understood by automake.")
321 320
322(defconst makefile-gmake-statements 321(defconst makefile-gmake-statements
323 `("-sinclude" "sinclude" "override" "vpath" 322 `("-sinclude" "sinclude" "vpath" ; makefile-makepp-statements takes rest
324 "ifdef" "ifndef" "ifeq" "ifneq" "-include" "define" "endef" "export" 323 "ifdef" "ifndef" "ifeq" "ifneq" "-include" "define" "endef" "export"
325 "unexport" 324 "override define" "override" "unexport"
326 ,@(cdr makefile-automake-statements)) 325 ,@(cdr makefile-automake-statements))
327 "List of keywords understood by gmake.") 326 "List of keywords understood by gmake.")
328 327
@@ -331,13 +330,14 @@ not be enclosed in { } or ( )."
331 `("and ifdef" "and ifndef" "and ifeq" "and ifneq" "and ifperl" 330 `("and ifdef" "and ifndef" "and ifeq" "and ifneq" "and ifperl"
332 "and ifmakeperl" "and ifsys" "and ifnsys" "build_cache" "build_check" 331 "and ifmakeperl" "and ifsys" "and ifnsys" "build_cache" "build_check"
333 "else ifdef" "else ifndef" "else ifeq" "else ifneq" "else ifperl" 332 "else ifdef" "else ifndef" "else ifeq" "else ifneq" "else ifperl"
334 "else ifmakeperl" "else ifsys" "else ifnsys" "enddef" "load_makefile" 333 "else ifmakeperl" "else ifsys" "else ifnsys" "enddef" "global"
335 "ifperl" "ifmakeperl" "ifsys" "ifnsys" "_include" "makeperl" "makesub" 334 "load_makefile" "ifperl" "ifmakeperl" "ifsys" "ifnsys" "_include"
336 "no_implicit_load" "perl" "perl-begin" "perl_begin" "perl-end" "perl_end" 335 "makeperl" "makesub" "no_implicit_load" "perl" "perl-begin" "perl_begin"
337 "prebuild" "or ifdef" "or ifndef" "or ifeq" "or ifneq" "or ifperl" 336 "perl-end" "perl_end" "prebuild" "or ifdef" "or ifndef" "or ifeq"
338 "or ifmakeperl" "or ifsys" "or ifnsys" "register_command_parser" 337 "or ifneq" "or ifperl" "or ifmakeperl" "or ifsys" "or ifnsys"
338 "override export" "override global" "register_command_parser"
339 "register_scanner" "repository" "runtime" "signature" "sub" 339 "register_scanner" "repository" "runtime" "signature" "sub"
340 ,@(nthcdr 4 makefile-gmake-statements)) 340 ,@(nthcdr 3 makefile-gmake-statements))
341 "List of keywords understood by gmake.") 341 "List of keywords understood by gmake.")
342 342
343(defconst makefile-bsdmake-statements 343(defconst makefile-bsdmake-statements
diff --git a/lisp/simple.el b/lisp/simple.el
index b023a7b780f..1778c15acfc 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -1043,7 +1043,7 @@ display the result of expression evaluation."
1043 (format " (#o%o, #x%x)" value value))))) 1043 (format " (#o%o, #x%x)" value value)))))
1044 1044
1045;; We define this, rather than making `eval' interactive, 1045;; We define this, rather than making `eval' interactive,
1046;; for the sake of completion of names like eval-region, eval-current-buffer. 1046;; for the sake of completion of names like eval-region, eval-buffer.
1047(defun eval-expression (eval-expression-arg 1047(defun eval-expression (eval-expression-arg
1048 &optional eval-expression-insert-value) 1048 &optional eval-expression-insert-value)
1049 "Evaluate EVAL-EXPRESSION-ARG and print value in the echo area. 1049 "Evaluate EVAL-EXPRESSION-ARG and print value in the echo area.
@@ -3529,7 +3529,7 @@ Outline mode sets this."
3529 (if (and track-eol (eolp) 3529 (if (and track-eol (eolp)
3530 ;; Don't count beg of empty line as end of line 3530 ;; Don't count beg of empty line as end of line
3531 ;; unless we just did explicit end-of-line. 3531 ;; unless we just did explicit end-of-line.
3532 (or (not (bolp)) (eq last-command 'end-of-line))) 3532 (or (not (bolp)) (eq last-command 'move-end-of-line)))
3533 9999 3533 9999
3534 (current-column)))) 3534 (current-column))))
3535 3535
diff --git a/lisp/term.el b/lisp/term.el
index cdaa72b7d94..5cf0887163d 100644
--- a/lisp/term.el
+++ b/lisp/term.el
@@ -3766,6 +3766,9 @@ Should only be called when point is at the start of a screen line."
3766 (save-start-line-column term-start-line-column) 3766 (save-start-line-column term-start-line-column)
3767 (save-current-row (term-current-row))) 3767 (save-current-row (term-current-row)))
3768 ;; The number of inserted lines shouldn't exceed the scroll region end. 3768 ;; The number of inserted lines shouldn't exceed the scroll region end.
3769 ;; The `term-scroll-end' line is part of the scrolling region, so
3770 ;; we need to go one line past it in order to ensure correct
3771 ;; scrolling.
3769 (when (> (+ save-current-row lines) (1+ term-scroll-end)) 3772 (when (> (+ save-current-row lines) (1+ term-scroll-end))
3770 (setq lines (- lines (- (+ save-current-row lines) (1+ term-scroll-end))))) 3773 (setq lines (- lines (- (+ save-current-row lines) (1+ term-scroll-end)))))
3771 (term-down lines) 3774 (term-down lines)
@@ -3784,6 +3787,9 @@ Should only be called when point is at the start of a screen line."
3784 (save-start-line-column term-start-line-column) 3787 (save-start-line-column term-start-line-column)
3785 (save-current-row (term-current-row))) 3788 (save-current-row (term-current-row)))
3786 ;; Inserting lines should take into account the scroll region. 3789 ;; Inserting lines should take into account the scroll region.
3790 ;; The `term-scroll-end' line is part of the scrolling region, so
3791 ;; we need to go one line past it in order to ensure correct
3792 ;; scrolling.
3787 (if (< save-current-row term-scroll-start) 3793 (if (< save-current-row term-scroll-start)
3788 ;; If point is before scroll start, 3794 ;; If point is before scroll start,
3789 (progn 3795 (progn
diff --git a/lisp/term/mac-win.el b/lisp/term/mac-win.el
index 9843d984e34..70ff213dc6c 100644
--- a/lisp/term/mac-win.el
+++ b/lisp/term/mac-win.el
@@ -1834,7 +1834,7 @@ With numeric ARG, display the font panel if and only if ARG is positive."
1834 (interactive "e") 1834 (interactive "e")
1835 (let* ((ae (mac-event-ae event)) 1835 (let* ((ae (mac-event-ae event))
1836 (fm-font-size (mac-ae-number ae "fmsz")) 1836 (fm-font-size (mac-ae-number ae "fmsz"))
1837 (atsu-font-id (cdr (mac-ae-parameter ae "auid"))) 1837 (atsu-font-id (mac-ae-number ae "auid"))
1838 (attribute-values (gethash atsu-font-id mac-atsu-font-table))) 1838 (attribute-values (gethash atsu-font-id mac-atsu-font-table)))
1839 (if fm-font-size 1839 (if fm-font-size
1840 (setq attribute-values 1840 (setq attribute-values
@@ -1865,8 +1865,8 @@ With numeric ARG, display the font panel if and only if ARG is positive."
1865(defface mac-ts-caret-position 1865(defface mac-ts-caret-position
1866 '((t :inverse-video t)) 1866 '((t :inverse-video t))
1867 "Face for caret position in Mac TSM active input area. 1867 "Face for caret position in Mac TSM active input area.
1868This is used only when the active input area is displayed in the 1868This is used when the active input area is displayed either in
1869echo area." 1869the echo area or in a buffer where the cursor is not displayed."
1870 :group 'mac) 1870 :group 'mac)
1871 1871
1872(defface mac-ts-raw-text 1872(defface mac-ts-raw-text
@@ -2013,7 +2013,10 @@ into `unread-command-events'. The unconfirmed text is displayed
2013either in the current buffer or in the echo area." 2013either in the current buffer or in the echo area."
2014 (interactive "e") 2014 (interactive "e")
2015 (let* ((ae (mac-event-ae event)) 2015 (let* ((ae (mac-event-ae event))
2016 (text (or (cdr (mac-ae-parameter ae "tstx" "utxt")) "")) 2016 (type-text (mac-ae-parameter ae "tstx"))
2017 (text (or (cdr type-text) ""))
2018 (decode-fun (if (equal (car type-text) "TEXT")
2019 'mac-TEXT-to-string 'mac-utxt-to-string))
2017 (script-language (mac-ae-script-language ae "tssl")) 2020 (script-language (mac-ae-script-language ae "tssl"))
2018 (coding (or (cdr (assq (car script-language) 2021 (coding (or (cdr (assq (car script-language)
2019 mac-script-code-coding-systems)) 2022 mac-script-code-coding-systems))
@@ -2035,22 +2038,27 @@ either in the current buffer or in the echo area."
2035 (or isearch-mode 2038 (or isearch-mode
2036 (and cursor-in-echo-area (current-message)) 2039 (and cursor-in-echo-area (current-message))
2037 ;; Overlay strings are not shown in some cases. 2040 ;; Overlay strings are not shown in some cases.
2038 (get-char-property (point) 'display)
2039 (get-char-property (point) 'invisible) 2041 (get-char-property (point) 'invisible)
2040 (get-char-property (point) 'composition))) 2042 (and (not (bobp))
2043 (or (and (get-char-property (point) 'display)
2044 (eq (get-char-property (1- (point)) 'display)
2045 (get-char-property (point) 'display)))
2046 (and (get-char-property (point) 'composition)
2047 (eq (get-char-property (1- (point)) 'composition)
2048 (get-char-property (point) 'composition)))))))
2041 active-input-string caret-seen) 2049 active-input-string caret-seen)
2042 ;; Decode the active input area text with inheriting faces and 2050 ;; Decode the active input area text with inheriting faces and
2043 ;; the caret position. 2051 ;; the caret position.
2044 (setq active-input-string 2052 (setq active-input-string
2045 (mapconcat 2053 (mapconcat
2046 (lambda (str) 2054 (lambda (str)
2047 (let ((decoded (mac-utxt-to-string str coding))) 2055 (let ((decoded (funcall decode-fun str coding)))
2048 (put-text-property 0 (length decoded) 'face 2056 (put-text-property 0 (length decoded) 'face
2049 (get-text-property 0 'face str) decoded) 2057 (get-text-property 0 'face str) decoded)
2050 (when (and (not caret-seen) 2058 (when (and (not caret-seen)
2051 (get-text-property 0 'cursor str)) 2059 (get-text-property 0 'cursor str))
2052 (setq caret-seen t) 2060 (setq caret-seen t)
2053 (if use-echo-area 2061 (if (or use-echo-area (null cursor-type))
2054 (put-text-property 0 1 'face 'mac-ts-caret-position 2062 (put-text-property 0 1 'face 'mac-ts-caret-position
2055 decoded) 2063 decoded)
2056 (put-text-property 0 1 'cursor t decoded))) 2064 (put-text-property 0 1 'cursor t decoded)))
@@ -2080,7 +2088,7 @@ either in the current buffer or in the echo area."
2080 ;; macro being defined. 2088 ;; macro being defined.
2081 (apply 'isearch-unread 2089 (apply 'isearch-unread
2082 (append (mac-replace-untranslated-utf-8-chars 2090 (append (mac-replace-untranslated-utf-8-chars
2083 (mac-utxt-to-string confirmed coding)) '()))) 2091 (funcall decode-fun confirmed coding)) '())))
2084 ;; The event is successfully processed. Sync the sequence number. 2092 ;; The event is successfully processed. Sync the sequence number.
2085 (setq mac-ts-update-active-input-area-seqno (1+ seqno)))) 2093 (setq mac-ts-update-active-input-area-seqno (1+ seqno))))
2086 2094
diff --git a/lisp/term/xterm.el b/lisp/term/xterm.el
index 6e6c75ade42..0da804a56af 100644
--- a/lisp/term/xterm.el
+++ b/lisp/term/xterm.el
@@ -228,9 +228,10 @@
228 (define-key map "\e[4~" [select]) 228 (define-key map "\e[4~" [select])
229 (define-key map "\e[29~" [print]) 229 (define-key map "\e[29~" [print])
230 230
231 ;; These keys will be available xterm starting probably from 231 ;; These keys are available in xterm starting from version 214
232 ;; version 214. 232 ;; if the modifyOtherKeys resource is set.
233 (define-key map "\e[27;5;9~" [(control ?\t)]) 233 (define-key map "\e[27;5;9~" [(control ?\t)])
234 (define-key map "\e[27;5;13~" [C-return])
234 (define-key map "\e[27;5;44~" [(control ?\,)]) 235 (define-key map "\e[27;5;44~" [(control ?\,)])
235 (define-key map "\e[27;5;46~" [(control ?\.)]) 236 (define-key map "\e[27;5;46~" [(control ?\.)])
236 (define-key map "\e[27;5;47~" [(control ?\/)]) 237 (define-key map "\e[27;5;47~" [(control ?\/)])
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index c4e739fdf77..79d526cbe76 100644
--- a/lisp/textmodes/org.el
+++ b/lisp/textmodes/org.el
@@ -5,7 +5,7 @@
5;; Author: Carsten Dominik <dominik at science dot uva dot nl> 5;; Author: Carsten Dominik <dominik at science dot uva dot nl>
6;; Keywords: outlines, hypermedia, calendar, wp 6;; Keywords: outlines, hypermedia, calendar, wp
7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ 7;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/
8;; Version: 4.38 8;; Version: 4.42
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -90,6 +90,26 @@
90;; 90;;
91;; Recent changes 91;; Recent changes
92;; -------------- 92;; --------------
93;; Version 4.42
94;; - Bug fixes
95;; - `s' key in the agenda saves all org-mode buffers.
96;;
97;; Version 4.41
98;; - Shift-curser keys can modify inactive time stamps (inactive time
99;; stamps are the ones in [...] brackets.
100;; - Toggle all checkboxes in a region/below a headline.
101;; - Bug fixes.
102;;
103;; Version 4.40
104;; - Bug fixes.
105;;
106;; Version 4.39
107;; - Special tag ARCHIVE keeps a subtree closed and away from agenda lists.
108;; - LaTeX code in Org-mode files can be converted to images for HTML.
109;; - Bug fixes.
110;; - CDLaTeX-mode features can be used in Org-mode to help inserting
111;; LaTeX environment and math.
112;;
93;; Version 4.38 113;; Version 4.38
94;; - noutline.el is now required (important for XEmacs users only). 114;; - noutline.el is now required (important for XEmacs users only).
95;; - Dynamic blocks. 115;; - Dynamic blocks.
@@ -189,7 +209,7 @@
189 209
190;;; Customization variables 210;;; Customization variables
191 211
192(defvar org-version "4.38" 212(defvar org-version "4.42"
193 "The version number of the file org.el.") 213 "The version number of the file org.el.")
194(defun org-version () 214(defun org-version ()
195 (interactive) 215 (interactive)
@@ -409,7 +429,8 @@ visibility is cycled."
409 (const :tag "Everywhere except in headlines" t) 429 (const :tag "Everywhere except in headlines" t)
410 )) 430 ))
411 431
412(defcustom org-cycle-hook '(org-optimize-window-after-visibility-change) 432(defcustom org-cycle-hook '(org-cycle-hide-archived-subtrees
433 org-optimize-window-after-visibility-change)
413 "Hook that is run after `org-cycle' has changed the buffer visibility. 434 "Hook that is run after `org-cycle' has changed the buffer visibility.
414The function(s) in this hook must accept a single argument which indicates 435The function(s) in this hook must accept a single argument which indicates
415the new state that was set by the most recent `org-cycle' command. The 436the new state that was set by the most recent `org-cycle' command. The
@@ -537,6 +558,38 @@ use \\[org-ctrl-c-ctrl-c] to trigger renumbering."
537 :tag "Org Archive" 558 :tag "Org Archive"
538 :group 'org-structure) 559 :group 'org-structure)
539 560
561(defcustom org-archive-tag "ARCHIVE"
562 "The tag that marks a subtree as archived.
563An archived subtree does not open during visibility cycling, and does
564not contribute to the agenda listings."
565 :group 'org-archive
566 :group 'org-keywords
567 :type 'string)
568
569(defcustom org-agenda-skip-archived-trees t
570 "Non-nil means, the agenda will skip any items located in archived trees.
571An archived tree is a tree marked with the tag ARCHIVE."
572 :group 'org-archive
573 :group 'org-agenda-display
574 :type 'boolean)
575
576(defcustom org-cycle-open-archived-trees nil
577 "Non-nil means, `org-cycle' will open archived trees.
578An archived tree is a tree marked with the tag ARCHIVE.
579When nil, archived trees will stay folded. You can still open them with
580normal outline commands like `show-all', but not with the cycling commands."
581 :group 'org-archive
582 :group 'org-cycle
583 :type 'boolean)
584
585(defcustom org-sparse-tree-open-archived-trees nil
586 "Non-nil means sparse tree construction shows matches in archived trees.
587When nil, matches in these trees are highlighted, but the trees are kept in
588collapsed state."
589 :group 'org-archive
590 :group 'org-sparse-trees
591 :type 'boolean)
592
540(defcustom org-archive-location "%s_archive::" 593(defcustom org-archive-location "%s_archive::"
541 "The location where subtrees should be archived. 594 "The location where subtrees should be archived.
542This string consists of two parts, separated by a double-colon. 595This string consists of two parts, separated by a double-colon.
@@ -574,12 +627,12 @@ line like
574 :type 'string) 627 :type 'string)
575 628
576(defcustom org-archive-mark-done t 629(defcustom org-archive-mark-done t
577 "Non-nil means, mark archived entries as DONE." 630 "Non-nil means, mark entries as DONE when they are moved to the archive file."
578 :group 'org-archive 631 :group 'org-archive
579 :type 'boolean) 632 :type 'boolean)
580 633
581(defcustom org-archive-stamp-time t 634(defcustom org-archive-stamp-time t
582 "Non-nil means, add a time stamp to archived entries. 635 "Non-nil means, add a time stamp to entries moved to an archive file.
583The time stamp will be added directly after the TODO state keyword in the 636The time stamp will be added directly after the TODO state keyword in the
584first line, so it is probably best to use this in combinations with 637first line, so it is probably best to use this in combinations with
585`org-archive-mark-done'." 638`org-archive-mark-done'."
@@ -1028,12 +1081,14 @@ rather than having to type \"yes\"."
1028 (const :tag "no confirmation (dangerous)" nil))) 1081 (const :tag "no confirmation (dangerous)" nil)))
1029 1082
1030(defconst org-file-apps-defaults-gnu 1083(defconst org-file-apps-defaults-gnu
1031 '((t . mailcap)) 1084 '((remote . emacs)
1085 (t . mailcap))
1032 "Default file applications on a UNIX or GNU/Linux system. 1086 "Default file applications on a UNIX or GNU/Linux system.
1033See `org-file-apps'.") 1087See `org-file-apps'.")
1034 1088
1035(defconst org-file-apps-defaults-macosx 1089(defconst org-file-apps-defaults-macosx
1036 '((t . "open %s") 1090 '((remote . emacs)
1091 (t . "open %s")
1037 ("ps" . "gv %s") 1092 ("ps" . "gv %s")
1038 ("ps.gz" . "gv %s") 1093 ("ps.gz" . "gv %s")
1039 ("eps" . "gv %s") 1094 ("eps" . "gv %s")
@@ -1046,11 +1101,13 @@ for some files for which the OS does not have a good default.
1046See `org-file-apps'.") 1101See `org-file-apps'.")
1047 1102
1048(defconst org-file-apps-defaults-windowsnt 1103(defconst org-file-apps-defaults-windowsnt
1049 (list (cons t 1104 (list
1050 (list (if (featurep 'xemacs) 1105 '(remote . emacs)
1051 'mswindows-shell-execute 1106 (cons t
1052 'w32-shell-execute) 1107 (list (if (featurep 'xemacs)
1053 "open" 'file))) 1108 'mswindows-shell-execute
1109 'w32-shell-execute)
1110 "open" 'file)))
1054 "Default file applications on a Windows NT system. 1111 "Default file applications on a Windows NT system.
1055The system \"open\" is used for most files. 1112The system \"open\" is used for most files.
1056See `org-file-apps'.") 1113See `org-file-apps'.")
@@ -1072,6 +1129,9 @@ files and the cdr the corresponding command. Possible values for the
1072file identifier are 1129file identifier are
1073 \"ext\" A string identifying an extension 1130 \"ext\" A string identifying an extension
1074 `directory' Matches a directory 1131 `directory' Matches a directory
1132 `remote' Matches a remove file, accessible through tramp or efs.
1133 Remote files most likely should be visited through emacs
1134 because external applications cannot handle such paths.
1075 t Default for all remaining files 1135 t Default for all remaining files
1076 1136
1077Possible values for the command are: 1137Possible values for the command are:
@@ -1090,6 +1150,7 @@ For more examples, see the system specific constants
1090 (cons (choice :value "" 1150 (cons (choice :value ""
1091 (string :tag "Extension") 1151 (string :tag "Extension")
1092 (const :tag "Default for unrecognized files" t) 1152 (const :tag "Default for unrecognized files" t)
1153 (const :tag "Remote file" remote)
1093 (const :tag "Links to a directory" directory)) 1154 (const :tag "Links to a directory" directory))
1094 (choice :value "" 1155 (choice :value ""
1095 (const :tag "Visit with Emacs" emacs) 1156 (const :tag "Visit with Emacs" emacs)
@@ -1715,6 +1776,29 @@ N days, just insert a special line indicating the size of the gap."
1715 (const :tag "All" t) 1776 (const :tag "All" t)
1716 (number :tag "at most"))) 1777 (number :tag "at most")))
1717 1778
1779(defgroup org-latex nil
1780 "Options for embedding LaTeX code into Org-mode"
1781 :tag "Org LaTeX"
1782 :group 'org)
1783
1784(defcustom org-format-latex-options
1785 '(:foreground "Black" :background "Transparent" :scale 1.0
1786 :matchers ("begin" "$" "$$" "\\(" "\\["))
1787 "Options for creating images from LaTeX fragments.
1788This is a property list with the following properties:
1789:foreground the foreground color, for example \"Black\".
1790:background the background color, or \"Transparent\".
1791:scale a scaling factor for the size of the images
1792:matchers a list indicating which matchers should be used to
1793 find LaTeX fragments. Valid members of this list are:
1794 \"begin\" find environments
1795 \"$\" find math expressions surrounded by $...$
1796 \"$$\" find math expressions surrounded by $$....$$
1797 \"\\(\" find math expressions surrounded by \\(...\\)
1798 \"\\ [\" find math expressions surrounded by \\ [...\\]"
1799 :group 'org-latex
1800 :type 'plist)
1801
1718(defgroup org-export nil 1802(defgroup org-export nil
1719 "Options for exporting org-listings." 1803 "Options for exporting org-listings."
1720 :tag "Org Export" 1804 :tag "Org Export"
@@ -1813,11 +1897,29 @@ This option can also be set with the +OPTIONS line, e.g. \"\\n:t\"."
1813 :group 'org-export-general 1897 :group 'org-export-general
1814 :type 'boolean) 1898 :type 'boolean)
1815 1899
1900(defcustom org-export-with-archived-trees 'headline
1901 "Whether subtrees with the ARCHIVE tag should be exported.
1902This can have three different values
1903nil Do not export, pretend this tree is not present
1904t Do export the entire tree
1905headline Only export the headline, but skip the tree below it."
1906 :group 'org-export-general
1907 :group 'org-archive
1908 :type '(choice
1909 (const :tag "not at all" nil)
1910 (const :tag "headline only" 'headline)
1911 (const :tag "entirely" t)))
1912
1816(defcustom org-export-with-timestamps t 1913(defcustom org-export-with-timestamps t
1817 "Nil means, do not export time stamps and associated keywords." 1914 "Nil means, do not export time stamps and associated keywords."
1818 :group 'org-export 1915 :group 'org-export
1819 :type 'boolean) 1916 :type 'boolean)
1820 1917
1918(defcustom org-export-remove-timestamps-from-toc t
1919 "Nil means, remove timestamps from the table of contents entries."
1920 :group 'org-export
1921 :type 'boolean)
1922
1821(defcustom org-export-with-tags t 1923(defcustom org-export-with-tags t
1822 "Nil means, do not export tags, just remove them from headlines." 1924 "Nil means, do not export tags, just remove them from headlines."
1823 :group 'org-export-general 1925 :group 'org-export-general
@@ -1876,6 +1978,19 @@ Not all export backends support this.
1876 1978
1877This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"." 1979This option can also be set with the +OPTIONS line, e.g. \"TeX:nil\"."
1878 :group 'org-export-translation 1980 :group 'org-export-translation
1981 :group 'org-latex
1982 :type 'boolean)
1983
1984(defcustom org-export-with-LaTeX-fragments nil
1985 "Non-nil means, convert LaTeX fragments to images when exporting to HTML.
1986When set, the exporter will find LaTeX environments if the \\begin line is
1987the first non-white thing on a line. It will also find the math delimiters
1988like $a=b$ and \\( a=b \\) for inline math, $$a=b$$ and \\[ a=b \\] for
1989display math.
1990
1991This option can also be set with the +OPTIONS line, e.g. \"LaTeX:t\"."
1992 :group 'org-export-translation
1993 :group 'org-latex
1879 :type 'boolean) 1994 :type 'boolean)
1880 1995
1881(defcustom org-export-with-fixed-width t 1996(defcustom org-export-with-fixed-width t
@@ -2387,6 +2502,19 @@ color of the frame."
2387This face is only used if `org-fontify-done-headline' is set." 2502This face is only used if `org-fontify-done-headline' is set."
2388 :group 'org-faces) 2503 :group 'org-faces)
2389 2504
2505(defface org-archived ; similar to shadow
2506 (org-compatible-face
2507 '((((class color grayscale) (min-colors 88) (background light))
2508 (:foreground "grey50"))
2509 (((class color grayscale) (min-colors 88) (background dark))
2510 (:foreground "grey70"))
2511 (((class color) (min-colors 8) (background light))
2512 (:foreground "green"))
2513 (((class color) (min-colors 8) (background dark))
2514 (:foreground "yellow"))))
2515 "Face for headline with the ARCHIVE tag."
2516 :group 'org-faces)
2517
2390(defface org-link 2518(defface org-link
2391 '((((class color) (background light)) (:foreground "Purple" :underline t)) 2519 '((((class color) (background light)) (:foreground "Purple" :underline t))
2392 (((class color) (background dark)) (:foreground "Cyan" :underline t)) 2520 (((class color) (background dark)) (:foreground "Cyan" :underline t))
@@ -2563,9 +2691,13 @@ Also put tags into group 4 if tags are present.")
2563 (remove-text-properties 0 (length s) org-rm-props s) 2691 (remove-text-properties 0 (length s) org-rm-props s)
2564 s) 2692 s)
2565 2693
2694(defsubst org-mode-p ()
2695 "Check if the current buffer is in Org-mode."
2696 (eq major-mode 'org-mode))
2697
2566(defun org-set-regexps-and-options () 2698(defun org-set-regexps-and-options ()
2567 "Precompute regular expressions for current buffer." 2699 "Precompute regular expressions for current buffer."
2568 (when (eq major-mode 'org-mode) 2700 (when (org-mode-p)
2569 (let ((re (org-make-options-regexp 2701 (let ((re (org-make-options-regexp
2570 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO" 2702 '("CATEGORY" "SEQ_TODO" "PRI_TODO" "TYP_TODO"
2571 "STARTUP" "ARCHIVE" "TAGS"))) 2703 "STARTUP" "ARCHIVE" "TAGS")))
@@ -2625,7 +2757,7 @@ Also put tags into group 4 if tags are present.")
2625 (and arch (set (make-local-variable 'org-archive-location) arch)) 2757 (and arch (set (make-local-variable 'org-archive-location) arch))
2626 (and int (set (make-local-variable 'org-todo-interpretation) int)) 2758 (and int (set (make-local-variable 'org-todo-interpretation) int))
2627 (when tags 2759 (when tags
2628 (let (e tg c tgs) 2760 (let (e tgs)
2629 (while (setq e (pop tags)) 2761 (while (setq e (pop tags))
2630 (cond 2762 (cond
2631 ((equal e "{") (push '(:startgroup) tgs)) 2763 ((equal e "{") (push '(:startgroup) tgs))
@@ -2707,6 +2839,8 @@ Also put tags into group 4 if tags are present.")
2707(defvar org-goto-start-pos) ; dynamically scoped parameter 2839(defvar org-goto-start-pos) ; dynamically scoped parameter
2708(defvar org-time-was-given) ; dynamically scoped parameter 2840(defvar org-time-was-given) ; dynamically scoped parameter
2709(defvar org-ts-what) ; dynamically scoped parameter 2841(defvar org-ts-what) ; dynamically scoped parameter
2842(defvar org-current-export-file) ; dynamically scoped parameter
2843(defvar org-current-export-dir) ; dynamically scoped parameter
2710(defvar mark-active) ; Emacs only, not available in XEmacs. 2844(defvar mark-active) ; Emacs only, not available in XEmacs.
2711(defvar timecnt) ; dynamically scoped parameter 2845(defvar timecnt) ; dynamically scoped parameter
2712(defvar levels-open) ; dynamically scoped parameter 2846(defvar levels-open) ; dynamically scoped parameter
@@ -2741,6 +2875,8 @@ Also put tags into group 4 if tags are present.")
2741(defvar orgtbl-mode) ; defined later in this file 2875(defvar orgtbl-mode) ; defined later in this file
2742(defvar Info-current-file) ; from info.el 2876(defvar Info-current-file) ; from info.el
2743(defvar Info-current-node) ; from info.el 2877(defvar Info-current-node) ; from info.el
2878(defvar texmathp-why) ; from texmathp.el
2879(defvar org-latex-regexps)
2744 2880
2745;;; Define the mode 2881;;; Define the mode
2746 2882
@@ -2832,9 +2968,7 @@ The following commands are available:
2832 ;; Paragraphs and auto-filling 2968 ;; Paragraphs and auto-filling
2833 (org-set-autofill-regexps) 2969 (org-set-autofill-regexps)
2834 (org-update-radio-target-regexp) 2970 (org-update-radio-target-regexp)
2835 ;; Settings for Calc embedded mode 2971
2836 (set (make-local-variable 'calc-embedded-open-formula) "|\\|\n")
2837 (set (make-local-variable 'calc-embedded-close-formula) "|\\|\n")
2838 (if (and org-insert-mode-line-in-empty-file 2972 (if (and org-insert-mode-line-in-empty-file
2839 (interactive-p) 2973 (interactive-p)
2840 (= (point-min) (point-max))) 2974 (= (point-min) (point-max)))
@@ -2958,10 +3092,12 @@ that will be added to PLIST. Returns the string that was modified."
2958 "Regular expression for fast time stamp matching.") 3092 "Regular expression for fast time stamp matching.")
2959(defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^\r\n>]*?\\)[]>]" 3093(defconst org-ts-regexp-both "[[<]\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}[^\r\n>]*?\\)[]>]"
2960 "Regular expression for fast time stamp matching.") 3094 "Regular expression for fast time stamp matching.")
2961(defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)\\([^0-9>\r\n]*\\)\\(\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)" 3095(defconst org-ts-regexp1 "\\(\\([0-9]\\{4\\}\\)-\\([0-9]\\{2\\}\\)-\\([0-9]\\{2\\}\\)\\([^]0-9>\r\n]*\\)\\(\\([0-9]\\{2\\}\\):\\([0-9]\\{2\\}\\)\\)?\\)"
2962 "Regular expression matching time strings for analysis.") 3096 "Regular expression matching time strings for analysis.")
2963(defconst org-ts-regexp2 (concat "<" org-ts-regexp1 ">") 3097(defconst org-ts-regexp2 (concat "<" org-ts-regexp1 ">")
2964 "Regular expression matching time stamps, with groups.") 3098 "Regular expression matching time stamps, with groups.")
3099(defconst org-ts-regexp3 (concat "[[<]" org-ts-regexp1 "[]>]")
3100 "Regular expression matching time stamps (also [..]), with groups.")
2965(defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp) 3101(defconst org-tr-regexp (concat org-ts-regexp "--?-?" org-ts-regexp)
2966 "Regular expression matching a time stamp range.") 3102 "Regular expression matching a time stamp range.")
2967(defconst org-tsr-regexp (concat org-ts-regexp "\\(--?-?" 3103(defconst org-tsr-regexp (concat org-ts-regexp "\\(--?-?"
@@ -3197,6 +3333,7 @@ between words."
3197 '("^[ \t]*| *\\([#!$*_^]\\) *|" (1 'org-formula t)) 3333 '("^[ \t]*| *\\([#!$*_^]\\) *|" (1 'org-formula t))
3198 (if org-format-transports-properties-p 3334 (if org-format-transports-properties-p
3199 '("| *\\(<[0-9]+>\\) *" (1 'org-formula t))) 3335 '("| *\\(<[0-9]+>\\) *" (1 'org-formula t)))
3336 '("^\\*+ \\(.*:ARCHIVE:.*\\)" (1 'org-archived prepend))
3200 ))) 3337 )))
3201 (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords)) 3338 (setq org-font-lock-extra-keywords (delq nil org-font-lock-extra-keywords))
3202 ;; Now set the full font-lock-keywords 3339 ;; Now set the full font-lock-keywords
@@ -3273,7 +3410,11 @@ between words."
3273 outline-regexp)) 3410 outline-regexp))
3274 (bob-special (and org-cycle-global-at-bob (bobp) 3411 (bob-special (and org-cycle-global-at-bob (bobp)
3275 (not (looking-at outline-regexp)))) 3412 (not (looking-at outline-regexp))))
3276 (org-cycle-hook (if bob-special nil org-cycle-hook)) 3413 (org-cycle-hook
3414 (if bob-special
3415 (delq 'org-optimize-window-after-visibility-change
3416 (copy-sequence org-cycle-hook))
3417 org-cycle-hook))
3277 (pos (point))) 3418 (pos (point)))
3278 3419
3279 (if (or bob-special (equal arg '(4))) 3420 (if (or bob-special (equal arg '(4)))
@@ -3291,7 +3432,7 @@ between words."
3291 (call-interactively 'org-table-next-field))))) 3432 (call-interactively 'org-table-next-field)))))
3292 3433
3293 ((eq arg t) ;; Global cycling 3434 ((eq arg t) ;; Global cycling
3294 3435
3295 (cond 3436 (cond
3296 ((and (eq last-command this-command) 3437 ((and (eq last-command this-command)
3297 (eq org-cycle-global-status 'overview)) 3438 (eq org-cycle-global-status 'overview))
@@ -3370,6 +3511,9 @@ between words."
3370 3511
3371 ;; TAB emulation 3512 ;; TAB emulation
3372 (buffer-read-only (org-back-to-heading)) 3513 (buffer-read-only (org-back-to-heading))
3514
3515 ((org-try-cdlatex-tab))
3516
3373 ((if (and (memq org-cycle-emulate-tab '(white whitestart)) 3517 ((if (and (memq org-cycle-emulate-tab '(white whitestart))
3374 (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")) 3518 (save-excursion (beginning-of-line 1) (looking-at "[ \t]*"))
3375 (or (and (eq org-cycle-emulate-tab 'white) 3519 (or (and (eq org-cycle-emulate-tab 'white)
@@ -3454,7 +3598,7 @@ This function is the default value of the hook `org-cycle-hook'."
3454 "Move cursor to the first headline and recenter the headline. 3598 "Move cursor to the first headline and recenter the headline.
3455Optional argument N means, put the headline into the Nth line of the window." 3599Optional argument N means, put the headline into the Nth line of the window."
3456 (goto-char (point-min)) 3600 (goto-char (point-min))
3457 (when (re-search-forward (concat "^" outline-regexp) nil t) 3601 (when (re-search-forward (concat "^\\(" outline-regexp "\\)") nil t)
3458 (beginning-of-line) 3602 (beginning-of-line)
3459 (recenter (prefix-numeric-value N)))) 3603 (recenter (prefix-numeric-value N))))
3460 3604
@@ -3637,10 +3781,8 @@ Return t when things worked, nil when we are not in an item."
3637 t) 3781 t)
3638 (error nil))) 3782 (error nil)))
3639 (let* ((bul (match-string 0)) 3783 (let* ((bul (match-string 0))
3640 (end (match-end 0))
3641 (eow (save-excursion (beginning-of-line 1) (looking-at "[ \t]*") 3784 (eow (save-excursion (beginning-of-line 1) (looking-at "[ \t]*")
3642 (match-end 0))) 3785 (match-end 0)))
3643 (eowcol (save-excursion (goto-char eow) (current-column)))
3644 pos) 3786 pos)
3645 (cond 3787 (cond
3646 ((and (org-at-item-p) (<= (point) eow)) 3788 ((and (org-at-item-p) (<= (point) eow))
@@ -4034,12 +4176,31 @@ If optional TXT is given, check this string instead of the current kill."
4034 (skip-chars-forward " \t") 4176 (skip-chars-forward " \t")
4035 (looking-at "\\[[ X]\\]")))) 4177 (looking-at "\\[[ X]\\]"))))
4036 4178
4037(defun org-toggle-checkbox () 4179(defun org-toggle-checkbox (&optional arg)
4038 "Toggle the checkbox in the current line." 4180 "Toggle the checkbox in the current line."
4039 (interactive) 4181 (interactive "P")
4040 (save-excursion 4182 (catch 'exit
4041 (if (org-at-item-checkbox-p) 4183 (let (beg end status (firstnew 'unknown))
4042 (replace-match (if (equal (match-string 0) "[ ]") "[X]" "[ ]") t t)))) 4184 (cond
4185 ((org-region-active-p)
4186 (setq beg (region-beginning) end (region-end)))
4187 ((org-on-heading-p)
4188 (setq beg (point) end (save-excursion (outline-next-heading) (point))))
4189 ((org-at-item-checkbox-p)
4190 (save-excursion
4191 (replace-match (if (equal (match-string 0) "[ ]") "[X]" "[ ]") t t))
4192 (throw 'exit t))
4193 (t (error "Not at a checkbox or heading, and no active region")))
4194 (save-excursion
4195 (goto-char beg)
4196 (while (< (point) end)
4197 (when (org-at-item-checkbox-p)
4198 (setq status (equal (match-string 0) "[X]"))
4199 (when (eq firstnew 'unknown)
4200 (setq firstnew (not status)))
4201 (replace-match
4202 (if (if arg (not status) firstnew) "[X]" "[ ]") t t))
4203 (beginning-of-line 2))))))
4043 4204
4044(defun org-get-indentation (&optional line) 4205(defun org-get-indentation (&optional line)
4045 "Get the indentation of the current line, interpreting tabs. 4206 "Get the indentation of the current line, interpreting tabs.
@@ -4093,7 +4254,7 @@ If the cursor is not in an item, throw an error."
4093 (while t 4254 (while t
4094 (beginning-of-line 0) 4255 (beginning-of-line 0)
4095 (if (< (point) limit) (throw 'exit nil)) 4256 (if (< (point) limit) (throw 'exit nil))
4096 (unless (looking-at " \t]*$") 4257 (unless (looking-at "[ \t]*$")
4097 (skip-chars-forward " \t") 4258 (skip-chars-forward " \t")
4098 (setq ind1 (current-column)) 4259 (setq ind1 (current-column))
4099 (if (< ind1 ind) 4260 (if (< ind1 ind)
@@ -4129,12 +4290,10 @@ If the cursor is not in an item, throw an error."
4129 "Move to the beginning of the next item in the current plain list. 4290 "Move to the beginning of the next item in the current plain list.
4130Error if not at a plain list, or if this is the last item in the list." 4291Error if not at a plain list, or if this is the last item in the list."
4131 (interactive) 4292 (interactive)
4132 (let (beg end ind ind1 (pos (point)) txt) 4293 (let (ind ind1 (pos (point)))
4133 (org-beginning-of-item) 4294 (org-beginning-of-item)
4134 (setq beg (point))
4135 (setq ind (org-get-indentation)) 4295 (setq ind (org-get-indentation))
4136 (org-end-of-item) 4296 (org-end-of-item)
4137 (setq end (point))
4138 (setq ind1 (org-get-indentation)) 4297 (setq ind1 (org-get-indentation))
4139 (unless (and (org-at-item-p) (= ind ind1)) 4298 (unless (and (org-at-item-p) (= ind ind1))
4140 (goto-char pos) 4299 (goto-char pos)
@@ -4144,7 +4303,7 @@ Error if not at a plain list, or if this is the last item in the list."
4144 "Move to the beginning of the previous item in the current plain list. 4303 "Move to the beginning of the previous item in the current plain list.
4145Error if not at a plain list, or if this is the last item in the list." 4304Error if not at a plain list, or if this is the last item in the list."
4146 (interactive) 4305 (interactive)
4147 (let (beg end ind ind1 (pos (point)) txt) 4306 (let (beg ind (pos (point)))
4148 (org-beginning-of-item) 4307 (org-beginning-of-item)
4149 (setq beg (point)) 4308 (setq beg (point))
4150 (setq ind (org-get-indentation)) 4309 (setq ind (org-get-indentation))
@@ -4154,7 +4313,7 @@ Error if not at a plain list, or if this is the last item in the list."
4154 (beginning-of-line 0) 4313 (beginning-of-line 0)
4155 (if (looking-at "[ \t]*$") 4314 (if (looking-at "[ \t]*$")
4156 nil 4315 nil
4157 (if (<= (setq ind1 (org-get-indentation)) ind) 4316 (if (<= (org-get-indentation) ind)
4158 (throw 'exit t))))) 4317 (throw 'exit t)))))
4159 (condition-case nil 4318 (condition-case nil
4160 (org-beginning-of-item) 4319 (org-beginning-of-item)
@@ -4367,7 +4526,7 @@ this heading. "
4367 (let (this-command) (org-copy-subtree)) 4526 (let (this-command) (org-copy-subtree))
4368 (set-buffer buffer) 4527 (set-buffer buffer)
4369 ;; Enforce org-mode for the archive buffer 4528 ;; Enforce org-mode for the archive buffer
4370 (if (not (eq major-mode 'org-mode)) 4529 (if (not (org-mode-p))
4371 ;; Force the mode for future visits. 4530 ;; Force the mode for future visits.
4372 (let ((org-insert-mode-line-in-empty-file t)) 4531 (let ((org-insert-mode-line-in-empty-file t))
4373 (call-interactively 'org-mode))) 4532 (call-interactively 'org-mode)))
@@ -4427,13 +4586,17 @@ this heading. "
4427 (concat "under heading: " heading) 4586 (concat "under heading: " heading)
4428 (concat "in file: " (abbreviate-file-name file))))))) 4587 (concat "in file: " (abbreviate-file-name file)))))))
4429 4588
4430(defun org-archive-all-done () 4589(defun org-archive-all-done (&optional tag)
4431 "Archive sublevels of the current tree without open TODO items. 4590 "Archive sublevels of the current tree without open TODO items.
4432If the cursor is not on a headline, try all level 1 trees. If 4591If the cursor is not on a headline, try all level 1 trees. If
4433it is on a headline, try all direct children." 4592it is on a headline, try all direct children.
4593When TAG is non-nil, don't move trees, but mark them with the ARCHIVE tag."
4434 (let ((re (concat "^\\*+ +" org-not-done-regexp)) re1 4594 (let ((re (concat "^\\*+ +" org-not-done-regexp)) re1
4595 (rea (concat ".*:" org-archive-tag ":"))
4435 (begm (make-marker)) 4596 (begm (make-marker))
4436 (endm (make-marker)) 4597 (endm (make-marker))
4598 (question (if tag "Set ARCHIVE tag (no open TODO items)? "
4599 "Move subtree to archive (no open TODO items)? "))
4437 beg end (cntarch 0)) 4600 beg end (cntarch 0))
4438 (if (org-on-heading-p) 4601 (if (org-on-heading-p)
4439 (progn 4602 (progn
@@ -4450,19 +4613,148 @@ it is on a headline, try all direct children."
4450 (save-excursion 4613 (save-excursion
4451 (goto-char begm) 4614 (goto-char begm)
4452 (while (re-search-forward re1 endm t) 4615 (while (re-search-forward re1 endm t)
4453 beg (match-beginning 0) 4616 (setq beg (match-beginning 0)
4454 end (save-excursion (org-end-of-subtree t) (point))) 4617 end (save-excursion (org-end-of-subtree t) (point)))
4455 (goto-char beg) 4618 (goto-char beg)
4456 (if (re-search-forward re end t) 4619 (if (re-search-forward re end t)
4457 (goto-char end) 4620 (goto-char end)
4458 (goto-char beg) 4621 (goto-char beg)
4459 (if (y-or-n-p "Archive this subtree (no open TODO items)? ") 4622 (if (and (or (not tag) (not (looking-at rea)))
4623 (y-or-n-p question))
4460 (progn 4624 (progn
4461 (org-archive-subtree) 4625 (if tag
4626 (org-toggle-tag org-archive-tag 'on)
4627 (org-archive-subtree))
4462 (setq cntarch (1+ cntarch))) 4628 (setq cntarch (1+ cntarch)))
4463 (goto-char end)))) 4629 (goto-char end)))))
4464 (message "%d trees archived" cntarch))) 4630 (message "%d trees archived" cntarch)))
4465 4631
4632(defun org-cycle-hide-archived-subtrees (state)
4633 "Re-hide all archived subtrees after a visibility state change."
4634 (when (and (not org-cycle-open-archived-trees)
4635 (not (memq state '(overview folded))))
4636 (save-excursion
4637 (let* ((globalp (memq state '(contents all)))
4638 (beg (if globalp (point-min) (point)))
4639 (end (if globalp (point-max) (org-end-of-subtree))))
4640 (org-hide-archived-subtrees beg end)))))
4641
4642(defun org-hide-archived-subtrees (beg end)
4643 "Re-hide all archived subtrees after a visibility state change."
4644 (save-excursion
4645 (let* ((re (concat ":" org-archive-tag ":")))
4646 (goto-char beg)
4647 (while (re-search-forward re end t)
4648 (and (org-on-heading-p) (hide-subtree))
4649 (org-end-of-subtree)))))
4650
4651(defun org-toggle-tag (tag &optional onoff)
4652 "Toggle the tag TAG for the current line.
4653If ONOFF is `on' or `off', don't toggle but set to this state."
4654 (unless (org-on-heading-p) (error "Not on headling"))
4655 (let (res current)
4656 (save-excursion
4657 (beginning-of-line)
4658 (if (re-search-forward "[ \t]:\\([a-zA-Z0-9_@:]+\\):[ \t]*$"
4659 (point-at-eol) t)
4660 (progn
4661 (setq current (match-string 1))
4662 (replace-match ""))
4663 (setq current ""))
4664 (setq current (nreverse (org-split-string current ":")))
4665 (cond
4666 ((eq onoff 'on)
4667 (setq res t)
4668 (or (member tag current) (push tag current)))
4669 ((eq onoff 'off)
4670 (or (not (member tag current)) (setq current (delete tag current))))
4671 (t (if (member tag current)
4672 (setq current (delete tag current))
4673 (setq res t)
4674 (push tag current))))
4675 (end-of-line 1)
4676 (when current
4677 (insert " :" (mapconcat 'identity (nreverse current) ":") ":"))
4678 (org-set-tags nil t))
4679 res))
4680
4681(defun org-toggle-archive-tag (&optional arg)
4682 "Toggle the archive tag for the current headline.
4683With prefix ARG, check all children of current headline and offer tagging
4684the children that do not contain any open TODO items."
4685 (interactive "P")
4686 (if arg
4687 (org-archive-all-done 'tag)
4688 (let (set)
4689 (save-excursion
4690 (org-back-to-heading t)
4691 (setq set (org-toggle-tag org-archive-tag))
4692 (when set (hide-subtree)))
4693 (and set (beginning-of-line 1))
4694 (message "Subtree %s" (if set "archived" "unarchived")))))
4695
4696(defun org-prepare-agenda-buffers (files)
4697 "Create buffers for all agenda files, protect archived trees and comments."
4698 (interactive)
4699 (let ((pa '(:org-archived t))
4700 (pc '(:org-comment t))
4701 (pall '(:org-archived t :org-comment t))
4702 (rea (concat ":" org-archive-tag ":"))
4703 file re)
4704 (save-excursion
4705 (while (setq file (pop files))
4706 (org-check-agenda-file file)
4707 (set-buffer (org-get-agenda-file-buffer file))
4708 (widen)
4709 (save-excursion
4710 (remove-text-properties (point-min) (point-max) pall)
4711 (when org-agenda-skip-archived-trees
4712 (goto-char (point-min))
4713 (while (re-search-forward rea nil t)
4714 (if (org-on-heading-p)
4715 (add-text-properties (point-at-bol) (org-end-of-subtree t) pa))))
4716 (goto-char (point-min))
4717 (setq re (concat "^\\*+ +" org-comment-string "\\>"))
4718 (while (re-search-forward re nil t)
4719 (add-text-properties
4720 (match-beginning 0) (org-end-of-subtree t) pc)))))))
4721
4722(defun org-agenda-skip ()
4723 "Throw to `:skip' in places that should be skipped."
4724 (let ((p (point-at-bol)))
4725 (and org-agenda-skip-archived-trees
4726 (get-text-property p :org-archived)
4727 (org-end-of-subtree)
4728 (throw :skip t))
4729 (and (get-text-property p :org-comment)
4730 (org-end-of-subtree)
4731 (throw :skip t))
4732 (if (equal (char-after p) ?#) (throw :skip t))))
4733
4734(defun org-agenda-toggle-archive-tag ()
4735 "Toggle the archive tag for the current entry."
4736 (interactive)
4737 (org-agenda-check-no-diary)
4738 (org-agenda-show) ;;; FIXME This is a stupid hack and should not be needed
4739 (let* ((hdmarker (or (get-text-property (point) 'org-hd-marker)
4740 (org-agenda-error)))
4741 (buffer (marker-buffer hdmarker))
4742 (pos (marker-position hdmarker))
4743 (buffer-read-only nil)
4744 newhead)
4745 (with-current-buffer buffer
4746 (widen)
4747 (goto-char pos)
4748 (org-show-hidden-entry)
4749 (save-excursion
4750 (and (outline-next-heading)
4751 (org-flag-heading nil))) ; show the next heading
4752 (call-interactively 'org-toggle-archive-tag)
4753 (end-of-line 1)
4754 (setq newhead (org-get-heading)))
4755 (org-agenda-change-all-lines newhead hdmarker)
4756 (beginning-of-line 1)))
4757
4466;;; Dynamic blocks 4758;;; Dynamic blocks
4467 4759
4468(defun org-find-dblock (name) 4760(defun org-find-dblock (name)
@@ -4503,8 +4795,7 @@ This empties the block, puts the cursor at the insert position and returns
4503the property list including an extra property :name with the block name." 4795the property list including an extra property :name with the block name."
4504 (unless (looking-at org-dblock-start-re) 4796 (unless (looking-at org-dblock-start-re)
4505 (error "Not at a dynamic block")) 4797 (error "Not at a dynamic block"))
4506 (let* ((beg (match-beginning 0)) 4798 (let* ((begdel (1+ (match-end 0)))
4507 (begdel (1+ (match-end 0)))
4508 (name (match-string 1)) 4799 (name (match-string 1))
4509 (params (append (list :name name) 4800 (params (append (list :name name)
4510 (read (concat "(" (match-string 2) ")"))))) 4801 (read (concat "(" (match-string 2) ")")))))
@@ -4557,7 +4848,7 @@ the correct writing function."
4557 "Find the beginning of the dynamic block at point. 4848 "Find the beginning of the dynamic block at point.
4558Error if there is no scuh block at point." 4849Error if there is no scuh block at point."
4559 (let ((pos (point)) 4850 (let ((pos (point))
4560 beg end) 4851 beg)
4561 (end-of-line 1) 4852 (end-of-line 1)
4562 (if (and (re-search-backward org-dblock-start-re nil t) 4853 (if (and (re-search-backward org-dblock-start-re nil t)
4563 (setq beg (match-beginning 0)) 4854 (setq beg (match-beginning 0))
@@ -4570,7 +4861,7 @@ Error if there is no scuh block at point."
4570(defun org-update-all-dblocks () 4861(defun org-update-all-dblocks ()
4571 "Update all dynamic blocks in the buffer. 4862 "Update all dynamic blocks in the buffer.
4572This function can be used in a hook." 4863This function can be used in a hook."
4573 (when (eq major-mode 'org-mode) 4864 (when (org-mode-p)
4574 (org-map-dblocks 'org-update-dblock))) 4865 (org-map-dblocks 'org-update-dblock)))
4575 4866
4576 4867
@@ -4846,9 +5137,8 @@ be removed."
4846 (format-time-string (car org-time-stamp-formats) time)) 5137 (format-time-string (car org-time-stamp-formats) time))
4847 (setq what nil)) 5138 (setq what nil))
4848 (save-excursion 5139 (save-excursion
4849 (let (beg end col list elt (buffer-invisibility-spec nil) ts) 5140 (let (col list elt (buffer-invisibility-spec nil) ts)
4850 (org-back-to-heading t) 5141 (org-back-to-heading t)
4851 (setq beg (point))
4852 (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*")) 5142 (looking-at (concat outline-regexp "\\( *\\)[^\r\n]*"))
4853 (goto-char (match-end 1)) 5143 (goto-char (match-end 1))
4854 (setq col (current-column)) 5144 (setq col (current-column))
@@ -4918,6 +5208,8 @@ that the match should indeed be shown."
4918 (org-show-hierarchy-above)))) 5208 (org-show-hierarchy-above))))
4919 (org-add-hook 'before-change-functions 'org-remove-occur-highlights 5209 (org-add-hook 'before-change-functions 'org-remove-occur-highlights
4920 nil 'local) 5210 nil 'local)
5211 (unless org-sparse-tree-open-archived-trees
5212 (org-hide-archived-subtrees (point-min) (point-max)))
4921 (run-hooks 'org-occur-hook) 5213 (run-hooks 'org-occur-hook)
4922 (if (interactive-p) 5214 (if (interactive-p)
4923 (message "%d match(es) for regexp %s" cnt regexp)) 5215 (message "%d match(es) for regexp %s" cnt regexp))
@@ -4959,8 +5251,15 @@ that the match should indeed be shown."
4959 (if (featurep 'xemacs) 5251 (if (featurep 'xemacs)
4960 (set-extent-property ovl prop value) 5252 (set-extent-property ovl prop value)
4961 (overlay-put ovl prop value))) 5253 (overlay-put ovl prop value)))
5254(defun org-overlays-at (pos)
5255 (if (featurep 'xemacs) (extents-at pos) (overlays-at pos)))
5256(defun org-overlay-start (o)
5257 (if (featurep 'xemacs) (extent-start-position o) (overlay-start o)))
5258(defun org-overlay-end (o)
5259 (if (featurep 'xemacs) (extent-end-position o) (overlay-end o)))
4962 5260
4963(defvar org-occur-highlights nil) 5261(defvar org-occur-highlights nil)
5262(make-variable-buffer-local 'org-occur-highlights)
4964(defun org-highlight-new-match (beg end) 5263(defun org-highlight-new-match (beg end)
4965 "Highlight from BEG to END and mark the highlight is an occur headline." 5264 "Highlight from BEG to END and mark the highlight is an occur headline."
4966 (let ((ov (org-make-overlay beg end))) 5265 (let ((ov (org-make-overlay beg end)))
@@ -5425,7 +5724,7 @@ With prefix ARG, change by that many units."
5425 "Increase the date in the time stamp by one day. 5724 "Increase the date in the time stamp by one day.
5426With prefix ARG, change that many days." 5725With prefix ARG, change that many days."
5427 (interactive "p") 5726 (interactive "p")
5428 (if (and (not (org-at-timestamp-p)) 5727 (if (and (not (org-at-timestamp-p t))
5429 (org-on-heading-p)) 5728 (org-on-heading-p))
5430 (org-todo 'up) 5729 (org-todo 'up)
5431 (org-timestamp-change (prefix-numeric-value arg) 'day))) 5730 (org-timestamp-change (prefix-numeric-value arg) 'day)))
@@ -5434,7 +5733,7 @@ With prefix ARG, change that many days."
5434 "Decrease the date in the time stamp by one day. 5733 "Decrease the date in the time stamp by one day.
5435With prefix ARG, change that many days." 5734With prefix ARG, change that many days."
5436 (interactive "p") 5735 (interactive "p")
5437 (if (and (not (org-at-timestamp-p)) 5736 (if (and (not (org-at-timestamp-p t))
5438 (org-on-heading-p)) 5737 (org-on-heading-p))
5439 (org-todo 'down) 5738 (org-todo 'down)
5440 (org-timestamp-change (- (prefix-numeric-value arg)) 'day))) 5739 (org-timestamp-change (- (prefix-numeric-value arg)) 'day)))
@@ -5444,14 +5743,14 @@ With prefix ARG, change that many days."
5444 (<= (match-beginning n) pos) 5743 (<= (match-beginning n) pos)
5445 (>= (match-end n) pos))) 5744 (>= (match-end n) pos)))
5446 5745
5447(defun org-at-timestamp-p () 5746(defun org-at-timestamp-p (&optional also-inactive)
5448 "Determine if the cursor is in or at a timestamp." 5747 "Determine if the cursor is in or at a timestamp."
5449 (interactive) 5748 (interactive)
5450 (let* ((tsr org-ts-regexp2) 5749 (let* ((tsr (if also-inactive org-ts-regexp3 org-ts-regexp2))
5451 (pos (point)) 5750 (pos (point))
5452 (ans (or (looking-at tsr) 5751 (ans (or (looking-at tsr)
5453 (save-excursion 5752 (save-excursion
5454 (skip-chars-backward "^<\n\r\t") 5753 (skip-chars-backward "^[<\n\r\t")
5455 (if (> (point) 1) (backward-char 1)) 5754 (if (> (point) 1) (backward-char 1))
5456 (and (looking-at tsr) 5755 (and (looking-at tsr)
5457 (> (- (match-end 0) pos) -1)))))) 5756 (> (- (match-end 0) pos) -1))))))
@@ -5476,7 +5775,7 @@ in the timestamp determines what will be changed."
5476 org-ts-what 5775 org-ts-what
5477 (pos (point)) 5776 (pos (point))
5478 ts time time0) 5777 ts time time0)
5479 (if (not (org-at-timestamp-p)) 5778 (if (not (org-at-timestamp-p t))
5480 (error "Not at a timestamp")) 5779 (error "Not at a timestamp"))
5481 (setq org-ts-what (or what org-ts-what)) 5780 (setq org-ts-what (or what org-ts-what))
5482 (setq fmt (if (<= (abs (- (cdr org-ts-lengths) 5781 (setq fmt (if (<= (abs (- (cdr org-ts-lengths)
@@ -5484,6 +5783,8 @@ in the timestamp determines what will be changed."
5484 1) 5783 1)
5485 (cdr org-time-stamp-formats) 5784 (cdr org-time-stamp-formats)
5486 (car org-time-stamp-formats))) 5785 (car org-time-stamp-formats)))
5786 (if (= (char-after (match-beginning 0)) ?\[)
5787 (setq fmt (concat "[" (substring fmt 1 -1) "]")))
5487 (setq ts (match-string 0)) 5788 (setq ts (match-string 0))
5488 (replace-match "") 5789 (replace-match "")
5489 (setq time0 (org-parse-time-string ts)) 5790 (setq time0 (org-parse-time-string ts))
@@ -5643,7 +5944,7 @@ Puts the resulting times in minutes as a text property on each headline."
5643 (ltimes (make-vector lmax 0)) 5944 (ltimes (make-vector lmax 0))
5644 (t1 0) 5945 (t1 0)
5645 (level 0) 5946 (level 0)
5646 (lastlevel 0) time) 5947 time)
5647 (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t)) 5948 (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t))
5648 (save-excursion 5949 (save-excursion
5649 (goto-char (point-max)) 5950 (goto-char (point-max))
@@ -5688,6 +5989,8 @@ in the echo area."
5688 (message "Total file time: %d:%02d (%d hours and %d minutes)" h m h m))) 5989 (message "Total file time: %d:%02d (%d hours and %d minutes)" h m h m)))
5689 5990
5690(defvar org-clock-overlays nil) 5991(defvar org-clock-overlays nil)
5992(make-variable-buffer-local 'org-clock-overlays)
5993
5691(defun org-put-clock-overlay (time &optional level) 5994(defun org-put-clock-overlay (time &optional level)
5692 "Put an overlays on the current line, displaying TIME. 5995 "Put an overlays on the current line, displaying TIME.
5693If LEVEL is given, prefix time with a corresponding number of stars. 5996If LEVEL is given, prefix time with a corresponding number of stars.
@@ -5769,9 +6072,8 @@ The BEGIN line can contain parameters. Allowed are:
5769 "Write the standard clocktable." 6072 "Write the standard clocktable."
5770 (let ((hlchars '((1 . "*") (2 . ?/))) 6073 (let ((hlchars '((1 . "*") (2 . ?/)))
5771 (emph nil) 6074 (emph nil)
5772 (pos (point)) ipos
5773 (ins (make-marker)) 6075 (ins (make-marker))
5774 time h m p level hlc hdl maxlevel) 6076 ipos time h m p level hlc hdl maxlevel)
5775 (setq maxlevel (or (plist-get params :maxlevel) 3) 6077 (setq maxlevel (or (plist-get params :maxlevel) 3)
5776 emph (plist-get params :emphasize)) 6078 emph (plist-get params :emphasize))
5777 (move-marker ins (point)) 6079 (move-marker ins (point))
@@ -5912,6 +6214,7 @@ The following commands are available:
5912(define-key org-agenda-mode-map "o" 'delete-other-windows) 6214(define-key org-agenda-mode-map "o" 'delete-other-windows)
5913(define-key org-agenda-mode-map "L" 'org-agenda-recenter) 6215(define-key org-agenda-mode-map "L" 'org-agenda-recenter)
5914(define-key org-agenda-mode-map "t" 'org-agenda-todo) 6216(define-key org-agenda-mode-map "t" 'org-agenda-todo)
6217(define-key org-agenda-mode-map "a" 'org-agenda-toggle-archive-tag)
5915(define-key org-agenda-mode-map ":" 'org-agenda-set-tags) 6218(define-key org-agenda-mode-map ":" 'org-agenda-set-tags)
5916(define-key org-agenda-mode-map "." 'org-agenda-goto-today) 6219(define-key org-agenda-mode-map "." 'org-agenda-goto-today)
5917(define-key org-agenda-mode-map "d" 'org-agenda-day-view) 6220(define-key org-agenda-mode-map "d" 'org-agenda-day-view)
@@ -5935,6 +6238,7 @@ The following commands are available:
5935(define-key org-agenda-mode-map "r" 'org-agenda-redo) 6238(define-key org-agenda-mode-map "r" 'org-agenda-redo)
5936(define-key org-agenda-mode-map "q" 'org-agenda-quit) 6239(define-key org-agenda-mode-map "q" 'org-agenda-quit)
5937(define-key org-agenda-mode-map "x" 'org-agenda-exit) 6240(define-key org-agenda-mode-map "x" 'org-agenda-exit)
6241(define-key org-agenda-mode-map "s" 'org-save-all-org-buffers)
5938(define-key org-agenda-mode-map "P" 'org-agenda-show-priority) 6242(define-key org-agenda-mode-map "P" 'org-agenda-show-priority)
5939(define-key org-agenda-mode-map "T" 'org-agenda-show-tags) 6243(define-key org-agenda-mode-map "T" 'org-agenda-show-tags)
5940(define-key org-agenda-mode-map "n" 'next-line) 6244(define-key org-agenda-mode-map "n" 'next-line)
@@ -5951,7 +6255,6 @@ The following commands are available:
5951(define-key org-agenda-mode-map "C" 'org-agenda-convert-date) 6255(define-key org-agenda-mode-map "C" 'org-agenda-convert-date)
5952(define-key org-agenda-mode-map "m" 'org-agenda-phases-of-moon) 6256(define-key org-agenda-mode-map "m" 'org-agenda-phases-of-moon)
5953(define-key org-agenda-mode-map "M" 'org-agenda-phases-of-moon) 6257(define-key org-agenda-mode-map "M" 'org-agenda-phases-of-moon)
5954(define-key org-agenda-mode-map "s" 'org-agenda-sunrise-sunset)
5955(define-key org-agenda-mode-map "S" 'org-agenda-sunrise-sunset) 6258(define-key org-agenda-mode-map "S" 'org-agenda-sunrise-sunset)
5956(define-key org-agenda-mode-map "h" 'org-agenda-holidays) 6259(define-key org-agenda-mode-map "h" 'org-agenda-holidays)
5957(define-key org-agenda-mode-map "H" 'org-agenda-holidays) 6260(define-key org-agenda-mode-map "H" 'org-agenda-holidays)
@@ -6005,6 +6308,7 @@ The following commands are available:
6005 "--" 6308 "--"
6006 ;; ["New agenda command" org-agenda t] 6309 ;; ["New agenda command" org-agenda t]
6007 ["Rebuild buffer" org-agenda-redo t] 6310 ["Rebuild buffer" org-agenda-redo t]
6311 ["Save all Org-mode Buffers" org-save-all-org-buffers t]
6008 "--" 6312 "--"
6009 ["Goto Today" org-agenda-goto-today (org-agenda-check-type nil 'agenda 'timeline)] 6313 ["Goto Today" org-agenda-goto-today (org-agenda-check-type nil 'agenda 'timeline)]
6010 ["Next Dates" org-agenda-later (org-agenda-check-type nil 'agenda)] 6314 ["Next Dates" org-agenda-later (org-agenda-check-type nil 'agenda)]
@@ -6058,7 +6362,7 @@ first press `1' to indicate that the agenda should be temporarily (until the
6058next use of \\[org-agenda]) restricted to the current file." 6362next use of \\[org-agenda]) restricted to the current file."
6059 (interactive "P") 6363 (interactive "P")
6060 (catch 'exit 6364 (catch 'exit
6061 (let ((restrict-ok (and buffer-file-name (eq major-mode 'org-mode))) 6365 (let ((restrict-ok (and buffer-file-name (org-mode-p)))
6062 (bfn buffer-file-name) 6366 (bfn buffer-file-name)
6063 (custom org-agenda-custom-commands) 6367 (custom org-agenda-custom-commands)
6064 c entry key type string) 6368 c entry key type string)
@@ -6133,7 +6437,7 @@ C Configure your own agenda commands")
6133 6437
6134(defun org-check-for-org-mode () 6438(defun org-check-for-org-mode ()
6135 "Make sure current buffer is in org-mode. Error if not." 6439 "Make sure current buffer is in org-mode. Error if not."
6136 (or (eq major-mode 'org-mode) 6440 (or (org-mode-p)
6137 (error "Cannot execute org-mode agenda command on buffer in %s." 6441 (error "Cannot execute org-mode agenda command on buffer in %s."
6138 major-mode))) 6442 major-mode)))
6139 6443
@@ -6279,6 +6583,7 @@ dates."
6279 (past t) 6583 (past t)
6280 args 6584 args
6281 s e rtn d emptyp) 6585 s e rtn d emptyp)
6586 (org-prepare-agenda-buffers org-agenda-files)
6282 (setq org-agenda-redo-command 6587 (setq org-agenda-redo-command
6283 (list 'progn 6588 (list 'progn
6284 (list 'switch-to-buffer-other-window (current-buffer)) 6589 (list 'switch-to-buffer-other-window (current-buffer))
@@ -6373,6 +6678,7 @@ NDAYS defaults to `org-agenda-ndays'."
6373 (day-numbers (list start)) 6678 (day-numbers (list start))
6374 (inhibit-redisplay t) 6679 (inhibit-redisplay t)
6375 s e rtn rtnall file date d start-pos end-pos todayp nd) 6680 s e rtn rtnall file date d start-pos end-pos todayp nd)
6681 (org-prepare-agenda-buffers files)
6376 (setq org-agenda-redo-command 6682 (setq org-agenda-redo-command
6377 (list 'org-agenda-list (list 'quote include-all) start-day ndays t)) 6683 (list 'org-agenda-list (list 'quote include-all) start-day ndays t))
6378 ;; Make the list of days 6684 ;; Make the list of days
@@ -6508,6 +6814,7 @@ for a keyword. A numeric prefix directly selects the Nth keyword in
6508 '(org-todo-list (or current-prefix-arg last-arg) t)) 6814 '(org-todo-list (or current-prefix-arg last-arg) t))
6509 (setq files (org-agenda-files) 6815 (setq files (org-agenda-files)
6510 rtnall nil) 6816 rtnall nil)
6817 (org-prepare-agenda-buffers files)
6511 (while (setq file (pop files)) 6818 (while (setq file (pop files))
6512 (catch 'nextfile 6819 (catch 'nextfile
6513 (org-check-agenda-file file) 6820 (org-check-agenda-file file)
@@ -6573,6 +6880,14 @@ Org-mode buffers visited directly by the user will not be touched."
6573 (setq org-agenda-new-buffers nil) 6880 (setq org-agenda-new-buffers nil)
6574 (org-agenda-quit)) 6881 (org-agenda-quit))
6575 6882
6883;; FIXME: move this function.
6884(defun org-save-all-org-buffers ()
6885 "Save all Org-mode buffers without user confirmation."
6886 (interactive)
6887 (message "Saving all Org-mode buffers...")
6888 (save-some-buffers t 'org-mode-p)
6889 (message "Saving all Org-mode buffers... done"))
6890
6576(defun org-agenda-redo () 6891(defun org-agenda-redo ()
6577 "Rebuild Agenda. 6892 "Rebuild Agenda.
6578When this is the global TODO list, a prefix argument will be interpreted." 6893When this is the global TODO list, a prefix argument will be interpreted."
@@ -7034,7 +7349,7 @@ the documentation of `org-diary'."
7034 ;; If file does not exist, make sure an error message ends up in diary 7349 ;; If file does not exist, make sure an error message ends up in diary
7035 (list (format "ORG-AGENDA-ERROR: No such org-file %s" file)) 7350 (list (format "ORG-AGENDA-ERROR: No such org-file %s" file))
7036 (with-current-buffer buffer 7351 (with-current-buffer buffer
7037 (unless (eq major-mode 'org-mode) 7352 (unless (org-mode-p)
7038 (error "Agenda file %s is not in `org-mode'" file)) 7353 (error "Agenda file %s is not in `org-mode'" file))
7039 (setq org-category-table (org-get-category-table)) 7354 (setq org-category-table (org-get-category-table))
7040 (let ((case-fold-search nil)) 7355 (let ((case-fold-search nil))
@@ -7116,8 +7431,11 @@ the documentation of `org-diary'."
7116 ee txt) 7431 ee txt)
7117 (goto-char (point-min)) 7432 (goto-char (point-min))
7118 (while (re-search-forward regexp nil t) 7433 (while (re-search-forward regexp nil t)
7119 (when (not (and org-agenda-todo-ignore-scheduled 7434 (catch :skip
7120 (save-match-data (looking-at sched-re)))) 7435 (and org-agenda-todo-ignore-scheduled
7436 (looking-at sched-re)
7437 (throw :skip nil))
7438 (org-agenda-skip)
7121 (goto-char (match-beginning 1)) 7439 (goto-char (match-beginning 1))
7122 (setq marker (org-agenda-new-marker (1+ (match-beginning 0))) 7440 (setq marker (org-agenda-new-marker (1+ (match-beginning 0)))
7123 category (org-get-category) 7441 category (org-get-category)
@@ -7129,14 +7447,14 @@ the documentation of `org-diary'."
7129 (- org-todo-kwd-max-priority -2 7447 (- org-todo-kwd-max-priority -2
7130 (length 7448 (length
7131 (member (match-string 2) org-todo-keywords))) 7449 (member (match-string 2) org-todo-keywords)))
7132 1))) 7450 1)))
7133 (org-add-props txt props 7451 (org-add-props txt props
7134 'org-marker marker 'org-hd-marker marker 7452 'org-marker marker 'org-hd-marker marker
7135 'priority priority 'category category) 7453 'priority priority 'category category)
7136 (push txt ee)) 7454 (push txt ee)
7137 (if org-agenda-todo-list-sublevels 7455 (if org-agenda-todo-list-sublevels
7138 (goto-char (match-end 1)) 7456 (goto-char (match-end 1))
7139 (org-end-of-subtree 'invisible))) 7457 (org-end-of-subtree 'invisible))))
7140 (nreverse ee))) 7458 (nreverse ee)))
7141 7459
7142(defconst org-agenda-no-heading-message 7460(defconst org-agenda-no-heading-message
@@ -7162,50 +7480,51 @@ the documentation of `org-diary'."
7162 ee txt timestr tags) 7480 ee txt timestr tags)
7163 (goto-char (point-min)) 7481 (goto-char (point-min))
7164 (while (re-search-forward regexp nil t) 7482 (while (re-search-forward regexp nil t)
7165 (if (not (save-match-data (org-at-date-range-p))) 7483 (catch :skip
7166 (progn 7484 (and (save-match-data (org-at-date-range-p)) (throw :skip nil))
7167 (setq marker (org-agenda-new-marker (match-beginning 0)) 7485 (org-agenda-skip)
7168 category (org-get-category (match-beginning 0)) 7486 (setq marker (org-agenda-new-marker (match-beginning 0))
7169 tmp (buffer-substring (max (point-min) 7487 category (org-get-category (match-beginning 0))
7170 (- (match-beginning 0) 7488 tmp (buffer-substring (max (point-min)
7171 org-ds-keyword-length)) 7489 (- (match-beginning 0)
7172 (match-beginning 0)) 7490 org-ds-keyword-length))
7173 timestr (buffer-substring (match-beginning 0) (point-at-eol)) 7491 (match-beginning 0))
7174 deadlinep (string-match org-deadline-regexp tmp) 7492 timestr (buffer-substring (match-beginning 0) (point-at-eol))
7175 scheduledp (string-match org-scheduled-regexp tmp) 7493 deadlinep (string-match org-deadline-regexp tmp)
7176 donep (org-entry-is-done-p)) 7494 scheduledp (string-match org-scheduled-regexp tmp)
7177 (if (string-match ">" timestr) 7495 donep (org-entry-is-done-p))
7178 ;; substring should only run to end of time stamp 7496 (if (string-match ">" timestr)
7179 (setq timestr (substring timestr 0 (match-end 0)))) 7497 ;; substring should only run to end of time stamp
7180 (save-excursion 7498 (setq timestr (substring timestr 0 (match-end 0))))
7181 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t) 7499 (save-excursion
7182 (progn 7500 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t)
7183 (goto-char (match-end 1)) 7501 (progn
7184 (setq hdmarker (org-agenda-new-marker) 7502 (goto-char (match-end 1))
7185 tags (org-get-tags-at)) 7503 (setq hdmarker (org-agenda-new-marker)
7186 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)") 7504 tags (org-get-tags-at))
7187 (setq txt (org-format-agenda-item 7505 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
7188 (format "%s%s" 7506 (setq txt (org-format-agenda-item
7189 (if deadlinep "Deadline: " "") 7507 (format "%s%s"
7190 (if scheduledp "Scheduled: " "")) 7508 (if deadlinep "Deadline: " "")
7191 (match-string 1) category tags timestr))) 7509 (if scheduledp "Scheduled: " ""))
7192 (setq txt org-agenda-no-heading-message)) 7510 (match-string 1) category tags timestr)))
7193 (setq priority (org-get-priority txt)) 7511 (setq txt org-agenda-no-heading-message))
7194 (org-add-props txt props 7512 (setq priority (org-get-priority txt))
7195 'org-marker marker 'org-hd-marker hdmarker) 7513 (org-add-props txt props
7196 (if deadlinep 7514 'org-marker marker 'org-hd-marker hdmarker)
7197 (org-add-props txt nil 7515 (if deadlinep
7198 'face (if donep 'org-done 'org-warning) 7516 (org-add-props txt nil
7199 'undone-face 'org-warning 'done-face 'org-done 7517 'face (if donep 'org-done 'org-warning)
7200 'category category 'priority (+ 100 priority)) 7518 'undone-face 'org-warning 'done-face 'org-done
7201 (if scheduledp 7519 'category category 'priority (+ 100 priority))
7202 (org-add-props txt nil 7520 (if scheduledp
7203 'face 'org-scheduled-today 7521 (org-add-props txt nil
7204 'undone-face 'org-scheduled-today 'done-face 'org-done 7522 'face 'org-scheduled-today
7205 'category category 'priority (+ 99 priority)) 7523 'undone-face 'org-scheduled-today 'done-face 'org-done
7206 (org-add-props txt nil 'priority priority 'category category))) 7524 'category category 'priority (+ 99 priority))
7207 (push txt ee)) 7525 (org-add-props txt nil 'priority priority 'category category)))
7208 (outline-next-heading)))) 7526 (push txt ee))
7527 (outline-next-heading)))
7209 (nreverse ee))) 7528 (nreverse ee)))
7210 7529
7211(defun org-agenda-get-closed () 7530(defun org-agenda-get-closed ()
@@ -7229,35 +7548,35 @@ the documentation of `org-diary'."
7229 ee txt timestr) 7548 ee txt timestr)
7230 (goto-char (point-min)) 7549 (goto-char (point-min))
7231 (while (re-search-forward regexp nil t) 7550 (while (re-search-forward regexp nil t)
7232 (if (not (save-match-data (org-at-date-range-p))) 7551 (catch :skip
7233 (progn 7552 (org-agenda-skip)
7234 (setq marker (org-agenda-new-marker (match-beginning 0)) 7553 (setq marker (org-agenda-new-marker (match-beginning 0))
7235 closedp (equal (match-string 1) org-closed-string) 7554 closedp (equal (match-string 1) org-closed-string)
7236 category (org-get-category (match-beginning 0)) 7555 category (org-get-category (match-beginning 0))
7237 timestr (buffer-substring (match-beginning 0) (point-at-eol)) 7556 timestr (buffer-substring (match-beginning 0) (point-at-eol))
7238 ;; donep (org-entry-is-done-p) 7557 ;; donep (org-entry-is-done-p)
7239 ) 7558 )
7240 (if (string-match "\\]" timestr) 7559 (if (string-match "\\]" timestr)
7241 ;; substring should only run to end of time stamp 7560 ;; substring should only run to end of time stamp
7242 (setq timestr (substring timestr 0 (match-end 0)))) 7561 (setq timestr (substring timestr 0 (match-end 0))))
7243 (save-excursion 7562 (save-excursion
7244 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t) 7563 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t)
7245 (progn 7564 (progn
7246 (goto-char (match-end 1)) 7565 (goto-char (match-end 1))
7247 (setq hdmarker (org-agenda-new-marker) 7566 (setq hdmarker (org-agenda-new-marker)
7248 tags (org-get-tags-at)) 7567 tags (org-get-tags-at))
7249 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)") 7568 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
7250 (setq txt (org-format-agenda-item 7569 (setq txt (org-format-agenda-item
7251 (if closedp "Closed: " "Clocked: ") 7570 (if closedp "Closed: " "Clocked: ")
7252 (match-string 1) category tags timestr))) 7571 (match-string 1) category tags timestr)))
7253 (setq txt org-agenda-no-heading-message)) 7572 (setq txt org-agenda-no-heading-message))
7254 (setq priority 100000) 7573 (setq priority 100000)
7255 (org-add-props txt props 7574 (org-add-props txt props
7256 'org-marker marker 'org-hd-marker hdmarker 'face 'org-done 7575 'org-marker marker 'org-hd-marker hdmarker 'face 'org-done
7257 'priority priority 'category category 7576 'priority priority 'category category
7258 'undone-face 'org-warning 'done-face 'org-done) 7577 'undone-face 'org-warning 'done-face 'org-done)
7259 (push txt ee)) 7578 (push txt ee))
7260 (outline-next-heading)))) 7579 (outline-next-heading)))
7261 (nreverse ee))) 7580 (nreverse ee)))
7262 7581
7263(defun org-agenda-get-deadlines () 7582(defun org-agenda-get-deadlines ()
@@ -7276,41 +7595,43 @@ the documentation of `org-diary'."
7276 ee txt head face) 7595 ee txt head face)
7277 (goto-char (point-min)) 7596 (goto-char (point-min))
7278 (while (re-search-forward regexp nil t) 7597 (while (re-search-forward regexp nil t)
7279 (setq pos (1- (match-beginning 1)) 7598 (catch :skip
7280 d2 (time-to-days 7599 (org-agenda-skip)
7281 (org-time-string-to-time (match-string 1))) 7600 (setq pos (1- (match-beginning 1))
7282 diff (- d2 d1)) 7601 d2 (time-to-days
7283 ;; When to show a deadline in the calendar: 7602 (org-time-string-to-time (match-string 1)))
7284 ;; If the expiration is within wdays warning time. 7603 diff (- d2 d1))
7285 ;; Past-due deadlines are only shown on the current date 7604 ;; When to show a deadline in the calendar:
7286 (if (and (< diff wdays) todayp (not (= diff 0))) 7605 ;; If the expiration is within wdays warning time.
7287 (save-excursion 7606 ;; Past-due deadlines are only shown on the current date
7288 (setq category (org-get-category)) 7607 (if (and (< diff wdays) todayp (not (= diff 0)))
7289 (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t) 7608 (save-excursion
7290 (progn 7609 (setq category (org-get-category))
7291 (goto-char (match-end 0)) 7610 (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t)
7292 (setq pos1 (match-end 1)) 7611 (progn
7293 (setq tags (org-get-tags-at pos1)) 7612 (goto-char (match-end 0))
7294 (setq head (buffer-substring-no-properties 7613 (setq pos1 (match-end 1))
7295 (point) 7614 (setq tags (org-get-tags-at pos1))
7296 (progn (skip-chars-forward "^\r\n") 7615 (setq head (buffer-substring-no-properties
7297 (point)))) 7616 (point)
7298 (if (string-match org-looking-at-done-regexp head) 7617 (progn (skip-chars-forward "^\r\n")
7299 (setq txt nil) 7618 (point))))
7300 (setq txt (org-format-agenda-item 7619 (if (string-match org-looking-at-done-regexp head)
7301 (format "In %3d d.: " diff) head category tags)))) 7620 (setq txt nil)
7302 (setq txt org-agenda-no-heading-message)) 7621 (setq txt (org-format-agenda-item
7303 (when txt 7622 (format "In %3d d.: " diff) head category tags))))
7304 (setq face (cond ((<= diff 0) 'org-warning) 7623 (setq txt org-agenda-no-heading-message))
7305 ((<= diff 5) 'org-upcoming-deadline) 7624 (when txt
7306 (t nil))) 7625 (setq face (cond ((<= diff 0) 'org-warning)
7307 (org-add-props txt props 7626 ((<= diff 5) 'org-upcoming-deadline)
7308 'org-marker (org-agenda-new-marker pos) 7627 (t nil)))
7309 'org-hd-marker (org-agenda-new-marker pos1) 7628 (org-add-props txt props
7310 'priority (+ (- 10 diff) (org-get-priority txt)) 7629 'org-marker (org-agenda-new-marker pos)
7311 'category category 7630 'org-hd-marker (org-agenda-new-marker pos1)
7312 'face face 'undone-face face 'done-face 'org-done) 7631 'priority (+ (- 10 diff) (org-get-priority txt))
7313 (push txt ee))))) 7632 'category category
7633 'face face 'undone-face face 'done-face 'org-done)
7634 (push txt ee))))))
7314 ee)) 7635 ee))
7315 7636
7316(defun org-agenda-get-scheduled () 7637(defun org-agenda-get-scheduled ()
@@ -7331,36 +7652,38 @@ the documentation of `org-diary'."
7331 ee txt head) 7652 ee txt head)
7332 (goto-char (point-min)) 7653 (goto-char (point-min))
7333 (while (re-search-forward regexp nil t) 7654 (while (re-search-forward regexp nil t)
7334 (setq pos (1- (match-beginning 1)) 7655 (catch :skip
7335 d2 (time-to-days 7656 (org-agenda-skip)
7336 (org-time-string-to-time (match-string 1))) 7657 (setq pos (1- (match-beginning 1))
7337 diff (- d2 d1)) 7658 d2 (time-to-days
7338 ;; When to show a scheduled item in the calendar: 7659 (org-time-string-to-time (match-string 1)))
7339 ;; If it is on or past the date. 7660 diff (- d2 d1))
7340 (if (and (< diff 0) todayp) 7661 ;; When to show a scheduled item in the calendar:
7341 (save-excursion 7662 ;; If it is on or past the date.
7342 (setq category (org-get-category)) 7663 (if (and (< diff 0) todayp)
7343 (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t) 7664 (save-excursion
7344 (progn 7665 (setq category (org-get-category))
7345 (goto-char (match-end 0)) 7666 (if (re-search-backward "\\(^\\|\r\\)\\*+[ \t]*" nil t)
7346 (setq pos1 (match-end 1)) 7667 (progn
7347 (setq tags (org-get-tags-at)) 7668 (goto-char (match-end 0))
7348 (setq head (buffer-substring-no-properties 7669 (setq pos1 (match-end 1))
7349 (point) 7670 (setq tags (org-get-tags-at))
7350 (progn (skip-chars-forward "^\r\n") (point)))) 7671 (setq head (buffer-substring-no-properties
7351 (if (string-match org-looking-at-done-regexp head) 7672 (point)
7352 (setq txt nil) 7673 (progn (skip-chars-forward "^\r\n") (point))))
7353 (setq txt (org-format-agenda-item 7674 (if (string-match org-looking-at-done-regexp head)
7354 (format "Sched.%2dx: " (- 1 diff)) head 7675 (setq txt nil)
7355 category tags)))) 7676 (setq txt (org-format-agenda-item
7356 (setq txt org-agenda-no-heading-message)) 7677 (format "Sched.%2dx: " (- 1 diff)) head
7357 (when txt 7678 category tags))))
7358 (org-add-props txt props 7679 (setq txt org-agenda-no-heading-message))
7359 'org-marker (org-agenda-new-marker pos) 7680 (when txt
7360 'org-hd-marker (org-agenda-new-marker pos1) 7681 (org-add-props txt props
7361 'priority (+ (- 5 diff) (org-get-priority txt)) 7682 'org-marker (org-agenda-new-marker pos)
7362 'category category) 7683 'org-hd-marker (org-agenda-new-marker pos1)
7363 (push txt ee))))) 7684 'priority (+ (- 5 diff) (org-get-priority txt))
7685 'category category)
7686 (push txt ee))))))
7364 ee)) 7687 ee))
7365 7688
7366(defun org-agenda-get-blocks () 7689(defun org-agenda-get-blocks ()
@@ -7377,34 +7700,36 @@ the documentation of `org-diary'."
7377 marker hdmarker ee txt d1 d2 s1 s2 timestr category tags) 7700 marker hdmarker ee txt d1 d2 s1 s2 timestr category tags)
7378 (goto-char (point-min)) 7701 (goto-char (point-min))
7379 (while (re-search-forward regexp nil t) 7702 (while (re-search-forward regexp nil t)
7380 (setq timestr (match-string 0) 7703 (catch :skip
7381 s1 (match-string 1) 7704 (org-agenda-skip)
7382 s2 (match-string 2) 7705 (setq timestr (match-string 0)
7383 d1 (time-to-days (org-time-string-to-time s1)) 7706 s1 (match-string 1)
7384 d2 (time-to-days (org-time-string-to-time s2))) 7707 s2 (match-string 2)
7385 (if (and (> (- d0 d1) -1) (> (- d2 d0) -1)) 7708 d1 (time-to-days (org-time-string-to-time s1))
7386 ;; Only allow days between the limits, because the normal 7709 d2 (time-to-days (org-time-string-to-time s2)))
7387 ;; date stamps will catch the limits. 7710 (if (and (> (- d0 d1) -1) (> (- d2 d0) -1))
7388 (save-excursion 7711 ;; Only allow days between the limits, because the normal
7389 (setq marker (org-agenda-new-marker (point))) 7712 ;; date stamps will catch the limits.
7390 (setq category (org-get-category)) 7713 (save-excursion
7391 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t) 7714 (setq marker (org-agenda-new-marker (point)))
7392 (progn 7715 (setq category (org-get-category))
7393 (setq hdmarker (org-agenda-new-marker (match-end 1))) 7716 (if (re-search-backward "\\(^\\|\r\\)\\*+" nil t)
7394 (goto-char (match-end 1)) 7717 (progn
7395 (setq tags (org-get-tags-at)) 7718 (setq hdmarker (org-agenda-new-marker (match-end 1)))
7396 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)") 7719 (goto-char (match-end 1))
7397 (setq txt (org-format-agenda-item 7720 (setq tags (org-get-tags-at))
7398 (format (if (= d1 d2) "" "(%d/%d): ") 7721 (looking-at "\\*+[ \t]*\\([^\r\n]+\\)")
7399 (1+ (- d0 d1)) (1+ (- d2 d1))) 7722 (setq txt (org-format-agenda-item
7400 (match-string 1) category tags 7723 (format (if (= d1 d2) "" "(%d/%d): ")
7401 (if (= d0 d1) timestr)))) 7724 (1+ (- d0 d1)) (1+ (- d2 d1)))
7402 (setq txt org-agenda-no-heading-message)) 7725 (match-string 1) category tags
7403 (org-add-props txt props 7726 (if (= d0 d1) timestr))))
7404 'org-marker marker 'org-hd-marker hdmarker 7727 (setq txt org-agenda-no-heading-message))
7405 'priority (org-get-priority txt) 'category category) 7728 (org-add-props txt props
7406 (push txt ee))) 7729 'org-marker marker 'org-hd-marker hdmarker
7407 (outline-next-heading)) 7730 'priority (org-get-priority txt) 'category category)
7731 (push txt ee)))
7732 (outline-next-heading)))
7408 ;; Sort the entries by expiration date. 7733 ;; Sort the entries by expiration date.
7409 (nreverse ee))) 7734 (nreverse ee)))
7410 7735
@@ -7696,7 +8021,7 @@ and by additional input from the age of a schedules or deadline entry."
7696 (switch-to-buffer-other-window buffer) 8021 (switch-to-buffer-other-window buffer)
7697 (widen) 8022 (widen)
7698 (goto-char pos) 8023 (goto-char pos)
7699 (when (eq major-mode 'org-mode) 8024 (when (org-mode-p)
7700 (org-show-hidden-entry) 8025 (org-show-hidden-entry)
7701 (save-excursion 8026 (save-excursion
7702 (and (outline-next-heading) 8027 (and (outline-next-heading)
@@ -7714,7 +8039,7 @@ and by additional input from the age of a schedules or deadline entry."
7714 (delete-other-windows) 8039 (delete-other-windows)
7715 (widen) 8040 (widen)
7716 (goto-char pos) 8041 (goto-char pos)
7717 (when (eq major-mode 'org-mode) 8042 (when (org-mode-p)
7718 (org-show-hidden-entry) 8043 (org-show-hidden-entry)
7719 (save-excursion 8044 (save-excursion
7720 (and (outline-next-heading) 8045 (and (outline-next-heading)
@@ -8005,9 +8330,7 @@ be used to request time specification in the time stamp."
8005 (org-agenda-check-no-diary) 8330 (org-agenda-check-no-diary)
8006 (let* ((marker (or (get-text-property (point) 'org-marker) 8331 (let* ((marker (or (get-text-property (point) 'org-marker)
8007 (org-agenda-error))) 8332 (org-agenda-error)))
8008 (buffer (marker-buffer marker)) 8333 (pos (marker-position marker)))
8009 (pos (marker-position marker))
8010 (hdmarker (get-text-property (point) 'org-hd-marker)))
8011 (with-current-buffer (marker-buffer marker) 8334 (with-current-buffer (marker-buffer marker)
8012 (widen) 8335 (widen)
8013 (goto-char pos) 8336 (goto-char pos)
@@ -8173,53 +8496,59 @@ are included in the output."
8173 lspos 8496 lspos
8174 tags tags-list tags-alist (llast 0) rtn level category i txt 8497 tags tags-list tags-alist (llast 0) rtn level category i txt
8175 todo marker) 8498 todo marker)
8176
8177 (save-excursion 8499 (save-excursion
8178 (goto-char (point-min)) 8500 (goto-char (point-min))
8179 (when (eq action 'sparse-tree) (org-overview)) 8501 (when (eq action 'sparse-tree) (org-overview))
8180 (while (re-search-forward re nil t) 8502 (while (re-search-forward re nil t)
8181 (setq todo (if (match-end 1) (match-string 2)) 8503 (catch :skip
8182 tags (if (match-end 4) (match-string 4))) 8504 (and (eq action 'agenda) (org-agenda-skip))
8183 (goto-char (setq lspos (1+ (match-beginning 0)))) 8505 (setq todo (if (match-end 1) (match-string 2))
8184 (setq level (funcall outline-level) 8506 tags (if (match-end 4) (match-string 4)))
8185 category (org-get-category)) 8507 (goto-char (setq lspos (1+ (match-beginning 0))))
8186 (setq i llast llast level) 8508 (setq level (funcall outline-level)
8187 ;; remove tag lists from same and sublevels 8509 category (org-get-category))
8188 (while (>= i level) 8510 (setq i llast llast level)
8189 (when (setq entry (assoc i tags-alist)) 8511 ;; remove tag lists from same and sublevels
8190 (setq tags-alist (delete entry tags-alist))) 8512 (while (>= i level)
8191 (setq i (1- i))) 8513 (when (setq entry (assoc i tags-alist))
8192 ;; add the nex tags 8514 (setq tags-alist (delete entry tags-alist)))
8193 (when tags 8515 (setq i (1- i)))
8194 (setq tags (mapcar 'downcase (org-split-string tags ":")) 8516 ;; add the nex tags
8195 tags-alist 8517 (when tags
8196 (cons (cons level tags) tags-alist))) 8518 (setq tags (mapcar 'downcase (org-split-string tags ":"))
8197 ;; compile tags for current headline 8519 tags-alist
8198 (setq tags-list 8520 (cons (cons level tags) tags-alist)))
8199 (if org-use-tag-inheritance 8521 ;; compile tags for current headline
8200 (apply 'append (mapcar 'cdr tags-alist)) 8522 (setq tags-list
8201 tags)) 8523 (if org-use-tag-inheritance
8202 (when (and (or (not todo-only) todo) 8524 (apply 'append (mapcar 'cdr tags-alist))
8203 (eval matcher)) 8525 tags))
8204 ;; list this headline 8526 (when (and (or (not todo-only) todo)
8205 (if (eq action 'sparse-tree) 8527 (eval matcher)
8206 (progn 8528 (or (not org-agenda-skip-archived-trees)
8207 (org-show-hierarchy-above)) 8529 (not (member org-archive-tag tags-list))))
8208 (setq txt (org-format-agenda-item 8530 ;; list this headline
8209 "" 8531 (if (eq action 'sparse-tree)
8210 (concat 8532 (progn
8211 (if org-tags-match-list-sublevels 8533 (org-show-hierarchy-above))
8212 (make-string (1- level) ?.) "") 8534 (setq txt (org-format-agenda-item
8213 (org-get-heading)) 8535 ""
8214 category tags-list)) 8536 (concat
8215 (goto-char lspos) 8537 (if org-tags-match-list-sublevels
8216 (setq marker (org-agenda-new-marker)) 8538 (make-string (1- level) ?.) "")
8217 (org-add-props txt props 8539 (org-get-heading))
8218 'org-marker marker 'org-hd-marker marker 'category category) 8540 category tags-list))
8219 (push txt rtn)) 8541 (goto-char lspos)
8220 ;; if we are to skip sublevels, jump to end of subtree 8542 (setq marker (org-agenda-new-marker))
8221 (point) 8543 (org-add-props txt props
8222 (or org-tags-match-list-sublevels (org-end-of-subtree))))) 8544 'org-marker marker 'org-hd-marker marker 'category category)
8545 (push txt rtn))
8546 ;; if we are to skip sublevels, jump to end of subtree
8547 (point)
8548 (or org-tags-match-list-sublevels (org-end-of-subtree))))))
8549 (when (and (eq action 'sparse-tree)
8550 (not org-sparse-tree-open-archived-trees))
8551 (org-hide-archived-subtrees (point-min) (point-max)))
8223 (nreverse rtn))) 8552 (nreverse rtn)))
8224 8553
8225(defun org-tags-sparse-tree (&optional arg match) 8554(defun org-tags-sparse-tree (&optional arg match)
@@ -8290,6 +8619,7 @@ The prefix arg TODO-ONLY limits the search to TODO entries."
8290 (list 'if 'current-prefix-arg nil match) t)) 8619 (list 'if 'current-prefix-arg nil match) t))
8291 (setq files (org-agenda-files) 8620 (setq files (org-agenda-files)
8292 rtnall nil) 8621 rtnall nil)
8622 (org-prepare-agenda-buffers files)
8293 (while (setq file (pop files)) 8623 (while (setq file (pop files))
8294 (catch 'nextfile 8624 (catch 'nextfile
8295 (org-check-agenda-file file) 8625 (org-check-agenda-file file)
@@ -8302,7 +8632,7 @@ The prefix arg TODO-ONLY limits the search to TODO entries."
8302 (format "ORG-AGENDA-ERROR: No such org-file %s" file)) 8632 (format "ORG-AGENDA-ERROR: No such org-file %s" file))
8303 rtnall (append rtnall rtn)) 8633 rtnall (append rtnall rtn))
8304 (with-current-buffer buffer 8634 (with-current-buffer buffer
8305 (unless (eq major-mode 'org-mode) 8635 (unless (org-mode-p)
8306 (error "Agenda file %s is not in `org-mode'" file)) 8636 (error "Agenda file %s is not in `org-mode'" file))
8307 (setq org-category-table (org-get-category-table)) 8637 (setq org-category-table (org-get-category-table))
8308 (save-excursion 8638 (save-excursion
@@ -8380,7 +8710,13 @@ With prefix ARG, realign all tags in headings in the current buffer."
8380 (setq hd (match-string 1)) 8710 (setq hd (match-string 1))
8381 (delete-region (match-beginning 0) (match-end 0)) 8711 (delete-region (match-beginning 0) (match-end 0))
8382 (insert-before-markers (org-trim hd) (if empty "" " "))) 8712 (insert-before-markers (org-trim hd) (if empty "" " ")))
8383 (unless (equal tags "") 8713 (if (equal tags "")
8714 (save-excursion
8715 (beginning-of-line 1)
8716 (skip-chars-forward "*")
8717 (if (= (char-after) ?\ ) (forward-char 1))
8718 (and (re-search-forward "[ \t]+$" (point-at-eol) t)
8719 (replace-match "")))
8384 (move-to-column (max (current-column) 8720 (move-to-column (max (current-column)
8385 (if (> org-tags-column 0) 8721 (if (> org-tags-column 0)
8386 org-tags-column 8722 org-tags-column
@@ -8825,7 +9161,7 @@ in all files."
8825 ((string-match "^/\\(.*\\)/$" s) 9161 ((string-match "^/\\(.*\\)/$" s)
8826 ;; A regular expression 9162 ;; A regular expression
8827 (cond 9163 (cond
8828 ((eq major-mode 'org-mode) 9164 ((org-mode-p)
8829 (org-occur (match-string 1 s))) 9165 (org-occur (match-string 1 s)))
8830 ;;((eq major-mode 'dired-mode) 9166 ;;((eq major-mode 'dired-mode)
8831 ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *"))) 9167 ;; (grep (concat "grep -n -e '" (match-string 1 s) "' *")))
@@ -8881,12 +9217,12 @@ in all files."
8881 (if (search-forward s nil t) 9217 (if (search-forward s nil t)
8882 (goto-char (match-beginning 0)) 9218 (goto-char (match-beginning 0))
8883 (error "No match")))) 9219 (error "No match"))))
8884 (and (eq major-mode 'org-mode) (org-show-hierarchy-above)))) 9220 (and (org-mode-p) (org-show-hierarchy-above))))
8885 9221
8886(defun org-search-not-link (&rest args) 9222(defun org-search-not-link (&rest args)
8887 "Execute `re-search-forward', but only accept matches that are not a link." 9223 "Execute `re-search-forward', but only accept matches that are not a link."
8888 (catch 'exit 9224 (catch 'exit
8889 (let ((pos (point)) p1) 9225 (let (p1)
8890 (while (apply 're-search-forward args) 9226 (while (apply 're-search-forward args)
8891 (setq p1 (point)) 9227 (setq p1 (point))
8892 (if (not (save-match-data 9228 (if (not (save-match-data
@@ -9286,24 +9622,23 @@ If the file does not exist, an error is thrown."
9286 (setq in-emacs (or in-emacs line search)) 9622 (setq in-emacs (or in-emacs line search))
9287 (let* ((file (if (equal path "") 9623 (let* ((file (if (equal path "")
9288 buffer-file-name 9624 buffer-file-name
9289 (convert-standard-filename (org-expand-file-name path)))) 9625 path))
9290 (dirp (file-directory-p file)) 9626 (apps (append org-file-apps (org-default-apps)))
9627 (remp (and (assq 'remote apps) (org-file-remote-p file)))
9628 (dirp (if remp nil (file-directory-p file)))
9291 (dfile (downcase file)) 9629 (dfile (downcase file))
9292 (old-buffer (current-buffer)) 9630 (old-buffer (current-buffer))
9293 (old-pos (point)) 9631 (old-pos (point))
9294 (old-mode major-mode) 9632 (old-mode major-mode)
9295 ext cmd apps) 9633 ext cmd)
9296 (if (and (not (file-exists-p file))
9297 (not org-open-non-existing-files))
9298 (error "No such file: %s" file))
9299 (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\.gz\\)$" dfile) 9634 (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\.gz\\)$" dfile)
9300 (setq ext (match-string 1 dfile)) 9635 (setq ext (match-string 1 dfile))
9301 (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\)$" dfile) 9636 (if (string-match "^.*\\.\\([a-zA-Z0-9]+\\)$" dfile)
9302 (setq ext (match-string 1 dfile)))) 9637 (setq ext (match-string 1 dfile))))
9303 (setq apps (append org-file-apps (org-default-apps)))
9304 (if in-emacs 9638 (if in-emacs
9305 (setq cmd 'emacs) 9639 (setq cmd 'emacs)
9306 (setq cmd (or (and dirp (cdr (assoc 'directory apps))) 9640 (setq cmd (or (and remp (cdr (assoc 'remote apps)))
9641 (and dirp (cdr (assoc 'directory apps)))
9307 (cdr (assoc ext apps)) 9642 (cdr (assoc ext apps))
9308 (cdr (assoc t apps))))) 9643 (cdr (assoc t apps)))))
9309 (when (eq cmd 'mailcap) 9644 (when (eq cmd 'mailcap)
@@ -9314,6 +9649,10 @@ If the file does not exist, an error is thrown."
9314 (if (stringp command) 9649 (if (stringp command)
9315 (setq cmd command) 9650 (setq cmd command)
9316 (setq cmd 'emacs)))) 9651 (setq cmd 'emacs))))
9652 (if (and (not (eq cmd 'emacs)) ; Emacs has not problems with non-ex files
9653 (not (file-exists-p file))
9654 (not org-open-non-existing-files))
9655 (error "No such file: %s" file))
9317 (cond 9656 (cond
9318 ((and (stringp cmd) (not (string-match "^\\s-*$" cmd))) 9657 ((and (stringp cmd) (not (string-match "^\\s-*$" cmd)))
9319 ;; Normalize use of quote, this can vary. 9658 ;; Normalize use of quote, this can vary.
@@ -9324,14 +9663,15 @@ If the file does not exist, an error is thrown."
9324 (shell-command (concat cmd " &")))) 9663 (shell-command (concat cmd " &"))))
9325 ((or (stringp cmd) 9664 ((or (stringp cmd)
9326 (eq cmd 'emacs)) 9665 (eq cmd 'emacs))
9327 (unless (equal (file-truename file) (file-truename (or buffer-file-name ""))) 9666; (unless (equal (file-truename file) (file-truename (or buffer-file-name "")))
9328 (funcall (cdr (assq 'file org-link-frame-setup)) file)) 9667; (funcall (cdr (assq 'file org-link-frame-setup)) file))
9668 (funcall (cdr (assq 'file org-link-frame-setup)) file)
9329 (if line (goto-line line) 9669 (if line (goto-line line)
9330 (if search (org-link-search search)))) 9670 (if search (org-link-search search))))
9331 ((consp cmd) 9671 ((consp cmd)
9332 (eval cmd)) 9672 (eval cmd))
9333 (t (funcall (cdr (assq 'file org-link-frame-setup)) file))) 9673 (t (funcall (cdr (assq 'file org-link-frame-setup)) file)))
9334 (and (eq major-mode 'org-mode) (eq old-mode 'org-mode) 9674 (and (org-mode-p) (eq old-mode 'org-mode)
9335 (or (not (equal old-buffer (current-buffer))) 9675 (or (not (equal old-buffer (current-buffer)))
9336 (not (equal old-pos (point)))) 9676 (not (equal old-pos (point))))
9337 (org-mark-ring-push old-pos old-buffer)))) 9677 (org-mark-ring-push old-pos old-buffer))))
@@ -9349,6 +9689,20 @@ If the file does not exist, an error is thrown."
9349 "Replace special path abbreviations and expand the file name." 9689 "Replace special path abbreviations and expand the file name."
9350 (expand-file-name path)) 9690 (expand-file-name path))
9351 9691
9692(defun org-file-remote-p (file)
9693 "Test whether FILE specifies a location on a remote system.
9694Return non-nil if the location is indeed remote.
9695
9696For example, the filename \"/user@host:/foo\" specifies a location
9697on the system \"/user@host:\"."
9698 (cond ((fboundp 'file-remote-p)
9699 (file-remote-p file))
9700 ((fboundp 'tramp-handle-file-remote-p)
9701 (tramp-handle-file-remote-p file))
9702 ((and (boundp 'ange-ftp-name-format)
9703 (string-match ange-ftp-name-format file))
9704 t)
9705 (t nil)))
9352 9706
9353(defvar org-insert-link-history nil 9707(defvar org-insert-link-history nil
9354 "Minibuffer history for links inserted with `org-insert-link'.") 9708 "Minibuffer history for links inserted with `org-insert-link'.")
@@ -9496,7 +9850,7 @@ For file links, arg negates `org-context-in-file-links'."
9496 (abbreviate-file-name buffer-file-name)) 9850 (abbreviate-file-name buffer-file-name))
9497 link (org-make-link cpltxt))) 9851 link (org-make-link cpltxt)))
9498 9852
9499 ((eq major-mode 'org-mode) 9853 ((org-mode-p)
9500 ;; Just link to current headline 9854 ;; Just link to current headline
9501 (setq cpltxt (concat "file:" 9855 (setq cpltxt (concat "file:"
9502 (abbreviate-file-name buffer-file-name))) 9856 (abbreviate-file-name buffer-file-name)))
@@ -10212,7 +10566,7 @@ This is being used to correctly align a single field after TAB or RET.")
10212 (linepos (+ (if (bolp) 1 0) (count-lines (point-min) (point)))) 10566 (linepos (+ (if (bolp) 1 0) (count-lines (point-min) (point))))
10213 (colpos (org-table-current-column)) 10567 (colpos (org-table-current-column))
10214 (winstart (window-start)) 10568 (winstart (window-start))
10215 text lines (new "") lengths l typenums ty fields maxfields i 10569 lines (new "") lengths l typenums ty fields maxfields i
10216 column 10570 column
10217 (indent "") cnt frac 10571 (indent "") cnt frac
10218 rfmt hfmt 10572 rfmt hfmt
@@ -10223,7 +10577,7 @@ This is being used to correctly align a single field after TAB or RET.")
10223 (make-string sp2 ?\ ) "%%%s%ds" (make-string sp1 ?\ ) "|")) 10577 (make-string sp2 ?\ ) "%%%s%ds" (make-string sp1 ?\ ) "|"))
10224 (hfmt1 (concat 10578 (hfmt1 (concat
10225 (make-string sp2 ?-) "%s" (make-string sp1 ?-) "+")) 10579 (make-string sp2 ?-) "%s" (make-string sp1 ?-) "+"))
10226 emptystrings xx links narrow fmax fmin f1 len c e) 10580 emptystrings links narrow fmax f1 len c e)
10227 (untabify beg end) 10581 (untabify beg end)
10228 (remove-text-properties beg end '(org-cwidth t display t)) 10582 (remove-text-properties beg end '(org-cwidth t display t))
10229 ;; Check if we have links 10583 ;; Check if we have links
@@ -10341,7 +10695,7 @@ This is being used to correctly align a single field after TAB or RET.")
10341 (move-marker org-table-aligned-begin-marker (point)) 10695 (move-marker org-table-aligned-begin-marker (point))
10342 (insert new) 10696 (insert new)
10343 (move-marker org-table-aligned-end-marker (point)) 10697 (move-marker org-table-aligned-end-marker (point))
10344 (when (and orgtbl-mode (not (eq major-mode 'org-mode))) 10698 (when (and orgtbl-mode (not (org-mode-p)))
10345 (goto-char org-table-aligned-begin-marker) 10699 (goto-char org-table-aligned-begin-marker)
10346 (while (org-hide-wide-columns org-table-aligned-end-marker))) 10700 (while (org-hide-wide-columns org-table-aligned-end-marker)))
10347 ;; Try to move to the old location (approximately) 10701 ;; Try to move to the old location (approximately)
@@ -11781,10 +12135,10 @@ not overwrite the stored one."
11781 ;; Insert ranges in current column 12135 ;; Insert ranges in current column
11782 (while (string-match "\\&[-I0-9]+" form) 12136 (while (string-match "\\&[-I0-9]+" form)
11783 (setq form (replace-match 12137 (setq form (replace-match
11784 (save-match-data 12138 (save-match-data
11785 (org-table-get-vertical-vector (match-string 0 form) 12139 (org-table-get-vertical-vector (match-string 0 form)
11786 nil n0)) 12140 nil n0))
11787 t t form))) 12141 t t form)))
11788 (if lispp 12142 (if lispp
11789 (setq ev (eval (eval (read form))) 12143 (setq ev (eval (eval (read form)))
11790 ev (if (numberp ev) (number-to-string ev) ev)) 12144 ev (if (numberp ev) (number-to-string ev) ev))
@@ -12107,7 +12461,7 @@ table editor in arbitrary modes.")
12107(defun orgtbl-mode (&optional arg) 12461(defun orgtbl-mode (&optional arg)
12108 "The `org-mode' table editor as a minor mode for use in other modes." 12462 "The `org-mode' table editor as a minor mode for use in other modes."
12109 (interactive) 12463 (interactive)
12110 (if (eq major-mode 'org-mode) 12464 (if (org-mode-p)
12111 ;; Exit without error, in case some hook functions calls this 12465 ;; Exit without error, in case some hook functions calls this
12112 ;; by accident in org-mode. 12466 ;; by accident in org-mode.
12113 (message "Orgtbl-mode is not useful in org-mode, command ignored") 12467 (message "Orgtbl-mode is not useful in org-mode, command ignored")
@@ -12359,9 +12713,11 @@ overwritten, and the table is not marked as requiring realignment."
12359 (:headline-levels . org-export-headline-levels) 12713 (:headline-levels . org-export-headline-levels)
12360 (:section-numbers . org-export-with-section-numbers) 12714 (:section-numbers . org-export-with-section-numbers)
12361 (:table-of-contents . org-export-with-toc) 12715 (:table-of-contents . org-export-with-toc)
12716 (:archived-trees . org-export-with-archived-trees)
12362 (:emphasize . org-export-with-emphasize) 12717 (:emphasize . org-export-with-emphasize)
12363 (:sub-superscript . org-export-with-sub-superscripts) 12718 (:sub-superscript . org-export-with-sub-superscripts)
12364 (:TeX-macros . org-export-with-TeX-macros) 12719 (:TeX-macros . org-export-with-TeX-macros)
12720 (:LaTeX-fragments . org-export-with-LaTeX-fragments)
12365 (:fixed-width . org-export-with-fixed-width) 12721 (:fixed-width . org-export-with-fixed-width)
12366 (:timestamps . org-export-with-timestamps) 12722 (:timestamps . org-export-with-timestamps)
12367 (:tables . org-export-with-tables) 12723 (:tables . org-export-with-tables)
@@ -12392,7 +12748,6 @@ overwritten, and the table is not marked as requiring realignment."
12392 (goto-char 0) 12748 (goto-char 0)
12393 (let ((re (org-make-options-regexp 12749 (let ((re (org-make-options-regexp
12394 '("TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE"))) 12750 '("TITLE" "AUTHOR" "EMAIL" "TEXT" "OPTIONS" "LANGUAGE")))
12395 (text nil)
12396 p key val text options) 12751 p key val text options)
12397 (while (re-search-forward re nil t) 12752 (while (re-search-forward re nil t)
12398 (setq key (org-match-string-no-properties 1) 12753 (setq key (org-match-string-no-properties 1)
@@ -12416,7 +12771,8 @@ overwritten, and the table is not marked as requiring realignment."
12416 ("|" . :tables) 12771 ("|" . :tables)
12417 ("^" . :sub-superscript) 12772 ("^" . :sub-superscript)
12418 ("*" . :emphasize) 12773 ("*" . :emphasize)
12419 ("TeX" . :TeX-macros))) 12774 ("TeX" . :TeX-macros)
12775 ("LaTeX" . :LaTeX-fragments)))
12420 o) 12776 o)
12421 (while (setq o (pop op)) 12777 (while (setq o (pop op))
12422 (if (string-match (concat (regexp-quote (car o)) 12778 (if (string-match (concat (regexp-quote (car o))
@@ -12831,32 +13187,56 @@ translations. There is currently no way for users to extend this.")
12831(defun org-cleaned-string-for-export (string &rest parameters) 13187(defun org-cleaned-string-for-export (string &rest parameters)
12832 "Cleanup a buffer substring so that links can be created safely." 13188 "Cleanup a buffer substring so that links can be created safely."
12833 (interactive) 13189 (interactive)
12834 (let* ((cb (current-buffer)) 13190 (let* ((re-radio (and org-target-link-regexp
12835 (re-radio (and org-target-link-regexp
12836 (concat "\\([^<]\\)\\(" org-target-link-regexp "\\)"))) 13191 (concat "\\([^<]\\)\\(" org-target-link-regexp "\\)")))
12837 (re-plain-link (concat "\\([^[<]\\)" org-plain-link-re)) 13192 (re-plain-link (concat "\\([^[<]\\)" org-plain-link-re))
12838 (re-angle-link (concat "\\([^[]\\)" org-angle-link-re)) 13193 (re-angle-link (concat "\\([^[]\\)" org-angle-link-re))
13194 (re-archive (concat ":" org-archive-tag ":"))
12839 rtn) 13195 rtn)
12840 (save-excursion 13196 (save-excursion
12841 (set-buffer (get-buffer-create " org-mode-tmp")) 13197 (set-buffer (get-buffer-create " org-mode-tmp"))
12842 (erase-buffer) 13198 (erase-buffer)
12843 (insert string) 13199 (insert string)
12844 (org-mode) 13200 (let ((org-inhibit-startup t)) (org-mode))
13201
13202 ;; Get rid of archived trees
13203 (when (not (eq org-export-with-archived-trees t))
13204 (goto-char (point-min))
13205 (while (re-search-forward re-archive nil t)
13206 (if (not (org-on-heading-p))
13207 (org-end-of-subtree t)
13208 (beginning-of-line 1)
13209 (delete-region
13210 (if org-export-with-archived-trees (1+ (point-at-eol)) (point))
13211 (org-end-of-subtree)))))
13212
12845 ;; Find targets in comments and move them out of comments, 13213 ;; Find targets in comments and move them out of comments,
12846 ;; but mark them as targets that should be invisible 13214 ;; but mark them as targets that should be invisible
12847 (goto-char (point-min)) 13215 (goto-char (point-min))
12848 (while (re-search-forward "^#.*?\\(<<<?[^>\r\n]+>>>?\\).*" nil t) 13216 (while (re-search-forward "^#.*?\\(<<<?[^>\r\n]+>>>?\\).*" nil t)
12849 (replace-match "\\1(INVISIBLE)")) 13217 (replace-match "\\1(INVISIBLE)"))
13218
12850 ;; Find matches for radio targets and turn them into internal links 13219 ;; Find matches for radio targets and turn them into internal links
12851 (goto-char (point-min)) 13220 (goto-char (point-min))
12852 (when re-radio 13221 (when re-radio
12853 (while (re-search-forward re-radio nil t) 13222 (while (re-search-forward re-radio nil t)
12854 (replace-match "\\1[[\\2]]"))) 13223 (replace-match "\\1[[\\2]]")))
13224
12855 ;; Find all links that contain a newline and put them into a single line 13225 ;; Find all links that contain a newline and put them into a single line
12856 (goto-char (point-min)) 13226 (goto-char (point-min))
12857 (while (re-search-forward "\\(\\(\\[\\|\\]\\)\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\(\\[\\|\\]\\)\\)" nil t) 13227 (while (re-search-forward "\\(\\(\\[\\|\\]\\)\\[[^]]*?\\)[ \t]*\n[ \t]*\\([^]]*\\]\\(\\[\\|\\]\\)\\)" nil t)
12858 (replace-match "\\1 \\3") 13228 (replace-match "\\1 \\3")
12859 (goto-char (match-beginning 0))) 13229 (goto-char (match-beginning 0)))
13230
13231 ;; Convert LaTeX fragments to images
13232 (when (memq :LaTeX-fragments parameters)
13233 (org-format-latex
13234 (concat "ltxpng/" (file-name-sans-extension
13235 (file-name-nondirectory
13236 org-current-export-file)))
13237 org-current-export-dir nil "Creating LaTeX image %s"))
13238 (message "Exporting...")
13239
12860 ;; Normalize links: Convert angle and plain links into bracket links 13240 ;; Normalize links: Convert angle and plain links into bracket links
12861 (goto-char (point-min)) 13241 (goto-char (point-min))
12862 (while (re-search-forward re-plain-link nil t) 13242 (while (re-search-forward re-plain-link nil t)
@@ -12870,6 +13250,7 @@ translations. There is currently no way for users to extend this.")
12870 (concat 13250 (concat
12871 (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]") 13251 (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]")
12872 t t)) 13252 t t))
13253
12873 ;; Find multiline emphasis and put them into single line 13254 ;; Find multiline emphasis and put them into single line
12874 (when (memq :emph-multiline parameters) 13255 (when (memq :emph-multiline parameters)
12875 (goto-char (point-min)) 13256 (goto-char (point-min))
@@ -12976,7 +13357,6 @@ underlined headlines. The default is 3."
12976 (title (or (plist-get opt-plist :title) 13357 (title (or (plist-get opt-plist :title)
12977 (file-name-sans-extension 13358 (file-name-sans-extension
12978 (file-name-nondirectory buffer-file-name)))) 13359 (file-name-nondirectory buffer-file-name))))
12979 (options nil)
12980 (email (plist-get opt-plist :email)) 13360 (email (plist-get opt-plist :email))
12981 (language (plist-get opt-plist :language)) 13361 (language (plist-get opt-plist :language))
12982 (text nil) 13362 (text nil)
@@ -13077,7 +13457,7 @@ underlined headlines. The default is 3."
13077 (normal-mode) 13457 (normal-mode)
13078 (save-buffer) 13458 (save-buffer)
13079 ;; remove display and invisible chars 13459 ;; remove display and invisible chars
13080 (let (beg end s) 13460 (let (beg end)
13081 (goto-char (point-min)) 13461 (goto-char (point-min))
13082 (while (setq beg (next-single-property-change (point) 'display)) 13462 (while (setq beg (next-single-property-change (point) 'display))
13083 (setq end (next-single-property-change beg 'display)) 13463 (setq end (next-single-property-change beg 'display))
@@ -13154,9 +13534,9 @@ underlined headlines. The default is 3."
13154(defun org-export-visible (type arg) 13534(defun org-export-visible (type arg)
13155 "Create a copy of the visible part of the current buffer, and export it. 13535 "Create a copy of the visible part of the current buffer, and export it.
13156The copy is created in a temporary buffer and removed after use. 13536The copy is created in a temporary buffer and removed after use.
13157TYPE is the final key (as a string) of the `C-c C-x' key sequence that will 13537TYPE is the final key (as a string) that also select the export command in
13158run the export command - in interactive use, the command prompts for this 13538the `C-c C-e' export dispatcher.
13159key. As a special case, if the you type SPC at the prompt, the temporary 13539As a special case, if the you type SPC at the prompt, the temporary
13160org-mode file will not be removed but presented to you so that you can 13540org-mode file will not be removed but presented to you so that you can
13161continue to use it. The prefix arg ARG is passed through to the exporting 13541continue to use it. The prefix arg ARG is passed through to the exporting
13162command." 13542command."
@@ -13235,7 +13615,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
13235#+EMAIL: %s 13615#+EMAIL: %s
13236#+LANGUAGE: %s 13616#+LANGUAGE: %s
13237#+TEXT: Some descriptive text to be emitted. Several lines OK. 13617#+TEXT: Some descriptive text to be emitted. Several lines OK.
13238#+OPTIONS: H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s *:%s TeX:%s 13618#+OPTIONS: H:%d num:%s toc:%s \\n:%s @:%s ::%s |:%s ^:%s *:%s TeX:%s LaTeX:%s
13239#+CATEGORY: %s 13619#+CATEGORY: %s
13240#+SEQ_TODO: %s 13620#+SEQ_TODO: %s
13241#+TYP_TODO: %s 13621#+TYP_TODO: %s
@@ -13254,6 +13634,7 @@ Does include HTML export options as well as TODO and CATEGORY stuff."
13254 org-export-with-sub-superscripts 13634 org-export-with-sub-superscripts
13255 org-export-with-emphasize 13635 org-export-with-emphasize
13256 org-export-with-TeX-macros 13636 org-export-with-TeX-macros
13637 org-export-with-LaTeX-fragments
13257 (file-name-nondirectory buffer-file-name) 13638 (file-name-nondirectory buffer-file-name)
13258 (if (equal org-todo-interpretation 'sequence) 13639 (if (equal org-todo-interpretation 'sequence)
13259 (mapconcat 'identity org-todo-keywords " ") 13640 (mapconcat 'identity org-todo-keywords " ")
@@ -13351,6 +13732,7 @@ When HIDDEN is non-nil, don't display the HTML buffer.
13351EXT-PLIST is a property list with external parameters overriding 13732EXT-PLIST is a property list with external parameters overriding
13352org-mode's default settings, but still inferior to file-local settings." 13733org-mode's default settings, but still inferior to file-local settings."
13353 (interactive "P") 13734 (interactive "P")
13735 (message "Exporting...")
13354 (setq-default org-todo-line-regexp org-todo-line-regexp) 13736 (setq-default org-todo-line-regexp org-todo-line-regexp)
13355 (setq-default org-deadline-line-regexp org-deadline-line-regexp) 13737 (setq-default org-deadline-line-regexp org-deadline-line-regexp)
13356 (setq-default org-done-string org-done-string) 13738 (setq-default org-done-string org-done-string)
@@ -13367,10 +13749,16 @@ org-mode's default settings, but still inferior to file-local settings."
13367 (buffer-substring 13749 (buffer-substring
13368 (if region-p (region-beginning) (point-min)) 13750 (if region-p (region-beginning) (point-min))
13369 (if region-p (region-end) (point-max)))) 13751 (if region-p (region-end) (point-max))))
13752 ;; The following two are dynamically scoped into other
13753 ;; routines below.
13754 (org-current-export-dir (org-export-directory :html opt-plist))
13755 (org-current-export-file buffer-file-name)
13370 (all_lines 13756 (all_lines
13371 (org-skip-comments (org-split-string 13757 (org-skip-comments (org-split-string
13372 (org-cleaned-string-for-export 13758 (org-cleaned-string-for-export
13373 region :emph-multiline) 13759 region :emph-multiline
13760 (if (plist-get opt-plist :LaTeX-fragments)
13761 :LaTeX-fragments))
13374 "[\r\n]"))) 13762 "[\r\n]")))
13375 (lines (org-export-find-first-heading-line all_lines)) 13763 (lines (org-export-find-first-heading-line all_lines))
13376 (level 0) (line "") (origline "") txt todo 13764 (level 0) (line "") (origline "") txt todo
@@ -13482,7 +13870,7 @@ lang=\"%s\" xml:lang=\"%s\">
13482 level (org-tr-level level) 13870 level (org-tr-level level)
13483 txt (save-match-data 13871 txt (save-match-data
13484 (org-html-expand 13872 (org-html-expand
13485 (org-html-cleanup-toc-line 13873 (org-export-cleanup-toc-line
13486 (match-string 3 line)))) 13874 (match-string 3 line))))
13487 todo 13875 todo
13488 (or (and org-export-mark-todo-in-toc 13876 (or (and org-export-mark-todo-in-toc
@@ -13718,9 +14106,9 @@ lang=\"%s\" xml:lang=\"%s\">
13718 ;; Normal lines 14106 ;; Normal lines
13719 (when (string-match 14107 (when (string-match
13720 (cond 14108 (cond
13721 ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") 14109 ((eq llt t) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+[.)]\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)")
13722 ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") 14110 ((= llt ?.) "^\\([ \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+\\.\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)")
13723 ((= llt ?\)) "^\\( \t]*\\)\\(\\([-+*]\\)\\|\\([0-9]+)\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)") 14111 ((= llt ?\)) "^\\( \t]*\\)\\(\\([-+*] \\)\\|\\([0-9]+)\\) \\)?\\( *[^ \t\n\r]\\|[ \t]*$\\)")
13724 (t (error "Invalid value of `org-plain-list-ordered-item-terminator'"))) 14112 (t (error "Invalid value of `org-plain-list-ordered-item-terminator'")))
13725 line) 14113 line)
13726 (setq ind (org-get-string-indentation line) 14114 (setq ind (org-get-string-indentation line)
@@ -13815,7 +14203,9 @@ lang=\"%s\" xml:lang=\"%s\">
13815 (while (re-search-forward "<li>[ \r\n\t]*</li>\n?" nil t) 14203 (while (re-search-forward "<li>[ \r\n\t]*</li>\n?" nil t)
13816 (replace-match "")) 14204 (replace-match ""))
13817 (save-buffer) 14205 (save-buffer)
13818 (goto-char (point-min))))) 14206 (goto-char (point-min))
14207 (message "Exporting... done"))))
14208
13819 14209
13820(defun org-format-table-html (lines olines) 14210(defun org-format-table-html (lines olines)
13821 "Find out which HTML converter to use and return the HTML code." 14211 "Find out which HTML converter to use and return the HTML code."
@@ -14006,12 +14396,13 @@ But it has the disadvantage, that Org-mode's HTML conversions cannot be used."
14006 (setq s (replace-match "&gt;" t t s)))) 14396 (setq s (replace-match "&gt;" t t s))))
14007 s) 14397 s)
14008 14398
14009(defun org-html-cleanup-toc-line (s) 14399(defun org-export-cleanup-toc-line (s)
14010 "Remove tags and time staps from lines going into the toc." 14400 "Remove tags and time staps from lines going into the toc."
14011 (if (string-match " +:[a-zA-Z0-9_@:]+: *$" s) 14401 (if (string-match " +:[a-zA-Z0-9_@:]+: *$" s)
14012 (setq s (replace-match "" t t s))) 14402 (setq s (replace-match "" t t s)))
14013 (while (string-match org-maybe-keyword-time-regexp s) 14403 (when org-export-remove-timestamps-from-toc
14014 (setq s (replace-match "" t t s))) 14404 (while (string-match org-maybe-keyword-time-regexp s)
14405 (setq s (replace-match "" t t s))))
14015 s) 14406 s)
14016 14407
14017(defun org-html-expand (string) 14408(defun org-html-expand (string)
@@ -14469,6 +14860,293 @@ a time), or the day by one (if it does not contain a time)."
14469 (setq fmt (if have-time ":%Y%m%dT%H%M%S" ";VALUE=DATE:%Y%m%d")) 14860 (setq fmt (if have-time ":%Y%m%dT%H%M%S" ";VALUE=DATE:%Y%m%d"))
14470 (concat keyword (format-time-string fmt time)))) 14861 (concat keyword (format-time-string fmt time))))
14471 14862
14863;;; LaTeX stuff
14864
14865(defvar org-cdlatex-mode-map (make-sparse-keymap)
14866 "Keymap for the minor `org-cdlatex-mode'.")
14867
14868(define-key org-cdlatex-mode-map "_" 'org-cdlatex-underscore-caret)
14869(define-key org-cdlatex-mode-map "^" 'org-cdlatex-underscore-caret)
14870(define-key org-cdlatex-mode-map "`" 'cdlatex-math-symbol)
14871(define-key org-cdlatex-mode-map "'" 'org-cdlatex-math-modify)
14872(define-key org-cdlatex-mode-map "\C-c{" 'cdlatex-environment)
14873
14874(defvar org-cdlatex-texmathp-advice-is-done nil
14875 "Flag remembering if we have applied the advice to texmathp already.")
14876
14877(define-minor-mode org-cdlatex-mode
14878 "Toggle the minor `org-cdlatex-mode'.
14879This mode supports entering LaTeX environment and math in LaTeX fragments
14880in Org-mode.
14881\\{org-cdlatex-mode-map}"
14882 nil " OCDL" nil
14883 (when org-cdlatex-mode (require 'cdlatex))
14884 (unless org-cdlatex-texmathp-advice-is-done
14885 (setq org-cdlatex-texmathp-advice-is-done t)
14886 (defadvice texmathp (around org-math-always-on activate)
14887 "Always return t in org-mode buffers.
14888This is because we want to insert math symbols without dollars even outside
14889the LaTeX math segments. If Orgmode thinks that point is actually inside
14890en embedded LaTeX fragement, let texmathp do its job.
14891\\[org-cdlatex-mode-map]"
14892 (interactive)
14893 (let (p)
14894 (cond
14895 ((not (org-mode-p)) ad-do-it)
14896 ((eq this-command 'cdlatex-math-symbol)
14897 (setq ad-return-value t
14898 texmathp-why '("cdlatex-math-symbol in org-mode" . 0)))
14899 (t
14900 (let ((p (org-inside-LaTeX-fragment-p)))
14901 (if (and p (member (car p) (plist-get org-format-latex-options :matchers)))
14902 (setq ad-return-value t
14903 texmathp-why '("Org-mode embedded math" . 0))
14904 (if p ad-do-it)))))))))
14905
14906(defun turn-on-org-cdlatex ()
14907 "Unconditionally turn on `org-cdlatex-mode'."
14908 (org-cdlatex-mode 1))
14909
14910(defun org-inside-LaTeX-fragment-p ()
14911 "Test if point is inside a LaTeX fragment.
14912I.e. after a \\begin, \\(, \\[, $, or $$, without the corresponding closing
14913sequence appearing also before point.
14914Even though the matchers for math are configurable, this function assumes
14915that \\begin, \\(, \\[, and $$ are always used. Only the single dollar
14916delimiters are skipped when they have been removed by customization.
14917The return value is nil, or a cons cell with the delimiter and
14918and the position of this delimiter.
14919
14920This function does a reasonably good job, but can locally be fooled by
14921for example currency specifications. For example it will assume being in
14922inline math after \"$22.34\". The LaTeX fragment formatter will only format
14923fragments that are properly closed, but during editing, we have to live
14924with the uncertainty caused by missing closing delimiters. This function
14925looks only before point, not after."
14926 (catch 'exit
14927 (let ((pos (point))
14928 (dodollar (member "$" (plist-get org-format-latex-options :matchers)))
14929 (lim (progn
14930 (re-search-backward (concat "^\\(" paragraph-start "\\)") nil t)
14931 (point)))
14932 dd-on str (start 0) m re)
14933 (goto-char pos)
14934 (when dodollar
14935 (setq str (concat (buffer-substring lim (point)) "\000 X$.")
14936 re (nth 1 (assoc "$" org-latex-regexps)))
14937 (while (string-match re str start)
14938 (cond
14939 ((= (match-end 0) (length str))
14940 (throw 'exit (cons "$" (+ lim (match-beginning 0)))))
14941 ((= (match-end 0) (- (length str) 5))
14942 (throw 'exit nil))
14943 (t (setq start (match-end 0))))))
14944 (when (setq m (re-search-backward "\\(\\\\begin{[^}]*}\\|\\\\(\\|\\\\\\[\\)\\|\\(\\\\end{[^}]*}\\|\\\\)\\|\\\\\\]\\)\\|\\(\\$\\$\\)" lim t))
14945 (goto-char pos)
14946 (and (match-beginning 1) (throw 'exit (cons (match-string 1) m)))
14947 (and (match-beginning 2) (throw 'exit nil))
14948 ;; count $$
14949 (while (re-search-backward "\\$\\$" lim t)
14950 (setq dd-on (not dd-on)))
14951 (goto-char pos)
14952 (if dd-on (cons "$$" m))))))
14953
14954
14955(defun org-try-cdlatex-tab ()
14956 "Check if it makes sense to execute `cdlatex-tab', and do it if yes.
14957It makes sense to do so if `org-cdlatex-mode' is active and if the cursor is
14958 - inside a LaTeX fragment, or
14959 - after the first word in a line, where an abbreviation expansion could
14960 insert a LaTeX environment."
14961 ;; FIXME: This may still need refinement.
14962 (when org-cdlatex-mode
14963 (cond
14964 ((save-excursion
14965 (skip-chars-backward "a-zA-Z0-9*")
14966 (skip-chars-backward " \t")
14967 (bolp))
14968 (cdlatex-tab) t)
14969 ((org-inside-LaTeX-fragment-p)
14970 (cdlatex-tab) t)
14971 (t nil))))
14972
14973(defun org-cdlatex-underscore-caret (&optional arg)
14974 "Execute `cdlatex-sub-superscript' in LaTeX fragments.
14975Revert to the normal definition outside of these fragments."
14976 (interactive "P")
14977 (if (org-inside-LaTeX-fragment-p)
14978 (call-interactively 'cdlatex-sub-superscript)
14979 (let (org-cdlatex-mode)
14980 (call-interactively (key-binding (vector last-input-event))))))
14981
14982(defun org-cdlatex-math-modify (&optional arg)
14983 "Execute `cdlatex-math-modify' in LaTeX fragments.
14984Revert to the normal definition outside of these fragments."
14985 (interactive "P")
14986 (if (org-inside-LaTeX-fragment-p)
14987 (call-interactively 'cdlatex-math-modify)
14988 (let (org-cdlatex-mode)
14989 (call-interactively (key-binding (vector last-input-event))))))
14990
14991(defvar org-latex-fragment-image-overlays nil
14992 "List of overlays carrying the images of latex fragments.")
14993(make-variable-buffer-local 'org-latex-fragment-image-overlays)
14994
14995(defun org-remove-latex-fragment-image-overlays ()
14996 "Remove all overlays with LaTeX fragment images in current buffer."
14997 (mapc 'org-delete-overlay org-latex-fragment-image-overlays)
14998 (setq org-latex-fragment-image-overlays nil))
14999
15000(defun org-preview-latex-fragment (&optional subtree)
15001 "Preview the LaTeX fragment at point, or all locally or globally.
15002If the cursor is in a LaTeX fragment, create the image and overlay
15003it over the source code. If there is no fragment at point, display
15004all fragments in the current text, from one headline to the next. With
15005prefix SUBTREE, display all fragments in the current subtree. With a
15006double prefix `C-u C-u', or when the cursor is before the first headline,
15007display all fragments in the buffer.
15008The images can be removed again with \\[org-ctrl-c-ctrl-c]."
15009 (interactive "P")
15010 (org-remove-latex-fragment-image-overlays)
15011 (save-excursion
15012 (save-restriction
15013 (let (beg end at msg)
15014 (cond
15015 ((or (equal subtree '(16))
15016 (not (save-excursion
15017 (re-search-backward (concat "^" outline-regexp) nil t))))
15018 (setq beg (point-min) end (point-max)
15019 msg "Creating images for buffer...%s"))
15020 ((equal subtree '(4))
15021 (org-back-to-heading)
15022 (setq beg (point) end (org-end-of-subtree)
15023 msg "Creating images for subtree...%s"))
15024 (t
15025 (if (setq at (org-inside-LaTeX-fragment-p))
15026 (goto-char (max (point-min) (- (cdr at) 2)))
15027 (org-back-to-heading))
15028 (setq beg (point) end (progn (outline-next-heading) (point))
15029 msg (if at "Creating image...%s"
15030 "Creating images for entry...%s"))))
15031 (message msg "")
15032 (narrow-to-region beg end)
15033 (org-format-latex
15034 (concat "ltxpng/" (file-name-sans-extension
15035 (file-name-nondirectory
15036 buffer-file-name)))
15037 default-directory 'overlays msg at)
15038 (message msg "done. Use `C-c C-c' to remove images.")))))
15039
15040(defvar org-latex-regexps
15041 '(("begin" "^[ \t]*\\(\\\\begin{\\([a-zA-Z0-9\\*]+\\)[^\000]+?\\\\end{\\2}\\)" 1 t)
15042 ;; ("$" "\\([ (]\\|^\\)\\(\\(\\([$]\\)\\([^ \r\n,.$].*?\\(\n.*?\\)\\{0,5\\}[^ \r\n,.$]\\)\\4\\)\\)\\([ .,?;:'\")]\\|$\\)" 2 nil)
15043 ;; \000 in the following regex is needed for org-inside-LaTeX-fragment-p
15044 ("$" "\\([^$]\\)\\(\\(\\$\\([^ \r\n,;.$][^$\n\r]*?\\(\n[^$\n\r]*?\\)\\{0,2\\}[^ \r\n,.$]\\)\\$\\)\\)\\([ .,?;:'\")\000]\\|$\\)" 2 nil)
15045 ("\\(" "\\\\([^\000]*?\\\\)" 0 nil)
15046 ("\\[" "\\\\\\[[^\000]*?\\\\\\]" 0 t)
15047 ("$$" "\\$\\$[^\000]*?\\$\\$" 0 t))
15048 "Regular expressions for matching embedded LaTeX.")
15049
15050(defun org-format-latex (prefix &optional dir overlays msg at)
15051 "Replace LaTeX fragments with links to an image, and produce images."
15052 (if (and overlays (fboundp 'clear-image-cache)) (clear-image-cache))
15053 (let* ((prefixnodir (file-name-nondirectory prefix))
15054 (absprefix (expand-file-name prefix dir))
15055 (todir (file-name-directory absprefix))
15056 (opt org-format-latex-options)
15057 (matchers (plist-get opt :matchers))
15058 (re-list org-latex-regexps)
15059 (cnt 0) txt link beg end re e oldfiles
15060 m n block linkfile movefile ov)
15061 ;; Make sure the directory exists
15062 (or (file-directory-p todir) (make-directory todir))
15063 ;; Check if there are old images files with this prefix, and remove them
15064 (setq oldfiles (directory-files
15065 todir 'full
15066 (concat (regexp-quote prefixnodir) "_[0-9]+\\.png$")))
15067 (while oldfiles (delete-file (pop oldfiles)))
15068 ;; Check the different regular expressions
15069 (while (setq e (pop re-list))
15070 (setq m (car e) re (nth 1 e) n (nth 2 e)
15071 block (if (nth 3 e) "\n\n" ""))
15072 (when (member m matchers)
15073 (goto-char (point-min))
15074 (while (re-search-forward re nil t)
15075 (when (or (not at) (equal (cdr at) (match-beginning n)))
15076 (setq txt (match-string n)
15077 beg (match-beginning n) end (match-end n)
15078 cnt (1+ cnt)
15079 linkfile (format "%s_%04d.png" prefix cnt)
15080 movefile (format "%s_%04d.png" absprefix cnt)
15081 link (concat block "[[file:" linkfile "]]" block))
15082 (if msg (message msg cnt))
15083 (goto-char beg)
15084 (org-create-formula-image
15085 txt movefile opt)
15086 (if overlays
15087 (progn
15088 (setq ov (org-make-overlay beg end))
15089 (if (featurep 'xemacs)
15090 (progn
15091 (org-overlay-put ov 'invisible t)
15092 (org-overlay-put
15093 ov 'end-glyph
15094 (make-glyph (vector 'png :file movefile))))
15095 (org-overlay-put
15096 ov 'display
15097 (list 'image :type 'png :file movefile :ascent 'center)))
15098 (push ov org-latex-fragment-image-overlays)
15099 (goto-char end))
15100 (delete-region beg end)
15101 (insert link))))))))
15102
15103;; This function borrows from Ganesh Swami's latex2png.el
15104(defun org-create-formula-image (string tofile options)
15105 (let* ((tmpdir (if (featurep 'xemacs)
15106 (temp-directory)
15107 temporary-file-directory))
15108 (texfilebase (make-temp-name
15109 (expand-file-name "orgtex" tmpdir)))
15110
15111;(texfilebase (make-temp-file "orgtex"))
15112; (dummy (delete-file texfilebase))
15113 (texfile (concat texfilebase ".tex"))
15114 (dvifile (concat texfilebase ".dvi"))
15115 (pngfile (concat texfilebase ".png"))
15116 (scale (number-to-string (* 1000 (or (plist-get options :scale) 1.0))))
15117 (fg (or (plist-get options :foreground) "Black"))
15118 (bg (or (plist-get options :background) "Transparent")))
15119 (with-temp-file texfile
15120 (insert "\\documentclass{article}
15121\\usepackage{fullpage}
15122\\usepackage{amssymb}
15123\\usepackage[usenames]{color}
15124\\usepackage{amsmath}
15125\\usepackage{latexsym}
15126\\usepackage[mathscr]{eucal}
15127\\pagestyle{empty}
15128\\begin{document}\n" string "\n\\end{document}\n"))
15129 (let ((dir default-directory))
15130 (condition-case nil
15131 (progn
15132 (cd tmpdir)
15133 (call-process "latex" nil nil nil texfile))
15134 (error nil))
15135 (cd dir))
15136 (if (not (file-exists-p dvifile))
15137 (progn (message "Failed to create dvi file from %s" texfile) nil)
15138 (call-process "dvipng" nil nil nil
15139 "-E" "-fg" fg "-bg" bg
15140 "-x" scale "-y" scale "-T" "tight"
15141 "-o" pngfile
15142 dvifile)
15143 (if (not (file-exists-p pngfile))
15144 (progn (message "Failed to create png file from %s" texfile) nil)
15145 ;; Use the requested file name and clean up
15146 (copy-file pngfile tofile 'replace)
15147 (loop for e in '(".dvi" ".tex" ".aux" ".log" ".png") do
15148 (delete-file (concat texfilebase e)))
15149 pngfile))))
14472 15150
14473;;; Key bindings 15151;;; Key bindings
14474 15152
@@ -14536,6 +15214,7 @@ a time), or the day by one (if it does not contain a time)."
14536(define-key org-mode-map "\C-c\C-a" 'show-all) ; in case allout messed up. 15214(define-key org-mode-map "\C-c\C-a" 'show-all) ; in case allout messed up.
14537(define-key org-mode-map "\C-xns" 'org-narrow-to-subtree) 15215(define-key org-mode-map "\C-xns" 'org-narrow-to-subtree)
14538(define-key org-mode-map "\C-c$" 'org-archive-subtree) 15216(define-key org-mode-map "\C-c$" 'org-archive-subtree)
15217(define-key org-mode-map "\C-c\C-x\C-a" 'org-toggle-archive-tag)
14539(define-key org-mode-map "\C-c\C-j" 'org-goto) 15218(define-key org-mode-map "\C-c\C-j" 'org-goto)
14540(define-key org-mode-map "\C-c\C-t" 'org-todo) 15219(define-key org-mode-map "\C-c\C-t" 'org-todo)
14541(define-key org-mode-map "\C-c\C-s" 'org-schedule) 15220(define-key org-mode-map "\C-c\C-s" 'org-schedule)
@@ -14590,8 +15269,9 @@ a time), or the day by one (if it does not contain a time)."
14590(define-key org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel) 15269(define-key org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel)
14591(define-key org-mode-map "\C-c\C-x\C-d" 'org-clock-display) 15270(define-key org-mode-map "\C-c\C-x\C-d" 'org-clock-display)
14592(define-key org-mode-map "\C-c\C-x\C-r" 'org-clock-report) 15271(define-key org-mode-map "\C-c\C-x\C-r" 'org-clock-report)
14593
14594(define-key org-mode-map "\C-c\C-x\C-u" 'org-dblock-update) 15272(define-key org-mode-map "\C-c\C-x\C-u" 'org-dblock-update)
15273(define-key org-mode-map "\C-c\C-x\C-l" 'org-preview-latex-fragment)
15274(define-key org-mode-map "\C-c\C-x\C-b" 'org-toggle-checkbox)
14595 15275
14596(when (featurep 'xemacs) 15276(when (featurep 'xemacs)
14597 (define-key org-mode-map 'button3 'popup-mode-menu)) 15277 (define-key org-mode-map 'button3 'popup-mode-menu))
@@ -14808,7 +15488,7 @@ Calls `org-timestamp-up' or `org-priority-up', depending on context.
14808See the individual commands for more information." 15488See the individual commands for more information."
14809 (interactive "P") 15489 (interactive "P")
14810 (cond 15490 (cond
14811 ((org-at-timestamp-p) (call-interactively 'org-timestamp-up)) 15491 ((org-at-timestamp-p t) (call-interactively 'org-timestamp-up))
14812 ((org-on-heading-p) (call-interactively 'org-priority-up)) 15492 ((org-on-heading-p) (call-interactively 'org-priority-up))
14813 ((org-at-item-p) (call-interactively 'org-previous-item)) 15493 ((org-at-item-p) (call-interactively 'org-previous-item))
14814 (t (call-interactively 'org-beginning-of-item) (beginning-of-line 1)))) 15494 (t (call-interactively 'org-beginning-of-item) (beginning-of-line 1))))
@@ -14819,7 +15499,7 @@ Calls `org-timestamp-down' or `org-priority-down', depending on context.
14819See the individual commands for more information." 15499See the individual commands for more information."
14820 (interactive "P") 15500 (interactive "P")
14821 (cond 15501 (cond
14822 ((org-at-timestamp-p) (call-interactively 'org-timestamp-down)) 15502 ((org-at-timestamp-p t) (call-interactively 'org-timestamp-down))
14823 ((org-on-heading-p) (call-interactively 'org-priority-down)) 15503 ((org-on-heading-p) (call-interactively 'org-priority-down))
14824 (t (call-interactively 'org-next-item)))) 15504 (t (call-interactively 'org-next-item))))
14825 15505
@@ -14827,7 +15507,7 @@ See the individual commands for more information."
14827 "Next TODO keyword or timestamp one day later, depending on context." 15507 "Next TODO keyword or timestamp one day later, depending on context."
14828 (interactive) 15508 (interactive)
14829 (cond 15509 (cond
14830 ((org-at-timestamp-p) (call-interactively 'org-timestamp-up-day)) 15510 ((org-at-timestamp-p t) (call-interactively 'org-timestamp-up-day))
14831 ((org-on-heading-p) (org-call-with-arg 'org-todo 'right)) 15511 ((org-on-heading-p) (org-call-with-arg 'org-todo 'right))
14832 (t (org-shiftcursor-error)))) 15512 (t (org-shiftcursor-error))))
14833 15513
@@ -14835,7 +15515,7 @@ See the individual commands for more information."
14835 "Previous TODO keyword or timestamp one day earlier, depending on context." 15515 "Previous TODO keyword or timestamp one day earlier, depending on context."
14836 (interactive) 15516 (interactive)
14837 (cond 15517 (cond
14838 ((org-at-timestamp-p) (call-interactively 'org-timestamp-down-day)) 15518 ((org-at-timestamp-p t) (call-interactively 'org-timestamp-down-day))
14839 ((org-on-heading-p) (org-call-with-arg 'org-todo 'left)) 15519 ((org-on-heading-p) (org-call-with-arg 'org-todo 'left))
14840 (t (org-shiftcursor-error)))) 15520 (t (org-shiftcursor-error))))
14841 15521
@@ -14898,12 +15578,12 @@ This command does many different things, depending on context:
14898 (interactive "P") 15578 (interactive "P")
14899 (let ((org-enable-table-editor t)) 15579 (let ((org-enable-table-editor t))
14900 (cond 15580 (cond
14901 (org-clock-overlays 15581 ((or org-clock-overlays org-occur-highlights
15582 org-latex-fragment-image-overlays)
14902 (org-remove-clock-overlays) 15583 (org-remove-clock-overlays)
14903 (message "Clock overlays removed"))
14904 (org-occur-highlights
14905 (org-remove-occur-highlights) 15584 (org-remove-occur-highlights)
14906 (message "occur highlights removed")) 15585 (org-remove-latex-fragment-image-overlays)
15586 (message "Temporary highlights/overlays removed from current buffer"))
14907 ((and (local-variable-p 'org-finish-function (current-buffer)) 15587 ((and (local-variable-p 'org-finish-function (current-buffer))
14908 (fboundp org-finish-function)) 15588 (fboundp org-finish-function))
14909 (funcall org-finish-function)) 15589 (funcall org-finish-function))
@@ -15053,10 +15733,26 @@ See the individual commands for more information."
15053 ["Demote Heading" org-metaright (not (org-at-table-p))] 15733 ["Demote Heading" org-metaright (not (org-at-table-p))]
15054 ["Demote Subtree" org-shiftmetaright (not (org-at-table-p))] 15734 ["Demote Subtree" org-shiftmetaright (not (org-at-table-p))]
15055 "--" 15735 "--"
15056 ["Archive Subtree" org-archive-subtree t]
15057 "--"
15058 ["Convert to odd levels" org-convert-to-odd-levels t] 15736 ["Convert to odd levels" org-convert-to-odd-levels t]
15059 ["Convert to odd/even levels" org-convert-to-oddeven-levels t]) 15737 ["Convert to odd/even levels" org-convert-to-oddeven-levels t])
15738 ("Archive"
15739 ["Toggle ARCHIVE tag" org-toggle-archive-tag t]
15740 ["Check and Tag Children" (org-toggle-archive-tag (4))
15741 :active t :keys "C-u C-c C-x C-a"]
15742 ["Sparse trees open ARCHIVE trees"
15743 (setq org-sparse-tree-open-archived-trees
15744 (not org-sparse-tree-open-archived-trees))
15745 :style toggle :selected org-sparse-tree-open-archived-trees]
15746 ["Cycling opens ARCHIVE trees"
15747 (setq org-cycle-open-archived-trees (not org-cycle-open-archived-trees))
15748 :style toggle :selected org-cycle-open-archived-trees]
15749 ["Agenda includes ARCHIVE trees"
15750 (setq org-agenda-skip-archived-trees (not org-agenda-skip-archived-trees))
15751 :style toggle :selected (not org-agenda-skip-archived-trees)]
15752 "--"
15753 ["Move Subtree to Archive" org-archive-subtree t]
15754 ["Check and Move Children" (org-archive-subtree '(4))
15755 :active t :keys "C-u C-c $"])
15060 "--" 15756 "--"
15061 ("TODO Lists" 15757 ("TODO Lists"
15062 ["TODO/DONE/-" org-todo t] 15758 ["TODO/DONE/-" org-todo t]
@@ -15120,6 +15816,16 @@ See the individual commands for more information."
15120 (re-search-forward "<[a-z]+:" nil t))]) 15816 (re-search-forward "<[a-z]+:" nil t))])
15121 "--" 15817 "--"
15122 ["Export/Publish" org-export t] 15818 ["Export/Publish" org-export t]
15819 ("LaTeX"
15820 ["Org CDLaTeX mode" org-cdlatex-mode :style toggle
15821 :selected org-cdlatex-mode]
15822 ["Insert Environment" cdlatex-environment (fboundp 'cdlatex-environment)]
15823 ["Insert math symbol" cdlatex-math-symbol (fboundp 'cdlatex-math-symbol)]
15824 ["Modify math symbol" org-cdlatex-math-modify
15825 (org-inside-LaTeX-fragment-p)]
15826 ["Export LaTeX fragments as images"
15827 (setq org-export-with-LaTeX-fragments (not org-export-with-LaTeX-fragments))
15828 :style toggle :selected org-export-with-LaTeX-fragments])
15123 "--" 15829 "--"
15124 ("Documentation" 15830 ("Documentation"
15125 ["Show Version" org-version t] 15831 ["Show Version" org-version t]
@@ -15145,8 +15851,8 @@ With optional NODE, go directly to that node."
15145 (save-excursion 15851 (save-excursion
15146 (while bl 15852 (while bl
15147 (set-buffer (pop bl)) 15853 (set-buffer (pop bl))
15148 (if (eq major-mode 'org-mode) (setq bl nil))) 15854 (if (org-mode-p) (setq bl nil)))
15149 (when (eq major-mode 'org-mode) 15855 (when (org-mode-p)
15150 (easy-menu-change 15856 (easy-menu-change
15151 '("Org") "File List for Agenda" 15857 '("Org") "File List for Agenda"
15152 (append 15858 (append
@@ -15198,6 +15904,7 @@ contexts are:
15198:tags on the TAGS in a headline 15904:tags on the TAGS in a headline
15199:priority on the priority cookie in a headline 15905:priority on the priority cookie in a headline
15200:item on the first line of a plain list item 15906:item on the first line of a plain list item
15907:item-bullet on the bullet/number of a plain list item
15201:checkbox on the checkbox in a plain list item 15908:checkbox on the checkbox in a plain list item
15202:table in an org-mode table 15909:table in an org-mode table
15203:table-special on a special filed in a table 15910:table-special on a special filed in a table
@@ -15206,13 +15913,15 @@ contexts are:
15206:keyword on a keyword: SCHEDULED, DEADLINE, CLOSE,COMMENT, QUOTE. 15913:keyword on a keyword: SCHEDULED, DEADLINE, CLOSE,COMMENT, QUOTE.
15207:target on a <<target>> 15914:target on a <<target>>
15208:radio-target on a <<<radio-target>>> 15915:radio-target on a <<<radio-target>>>
15916:latex-fragment on a LaTeX fragment
15917:latex-preview on a LaTeX fragment with overlayed preview image
15209 15918
15210This function expects the position to be visible because it uses font-lock 15919This function expects the position to be visible because it uses font-lock
15211faces as a help to recognize the following contexts: :table-special, :link, 15920faces as a help to recognize the following contexts: :table-special, :link,
15212and :keyword." 15921and :keyword."
15213 (let* ((f (get-text-property (point) 'face)) 15922 (let* ((f (get-text-property (point) 'face))
15214 (faces (if (listp f) f (list f))) 15923 (faces (if (listp f) f (list f)))
15215 (p (point)) clist) 15924 (p (point)) clist o)
15216 ;; First the large context 15925 ;; First the large context
15217 (cond 15926 (cond
15218 ((org-on-heading-p) 15927 ((org-on-heading-p)
@@ -15229,6 +15938,7 @@ and :keyword."
15229 (push (org-point-in-group p 0 :priority) clist))) 15938 (push (org-point-in-group p 0 :priority) clist)))
15230 15939
15231 ((org-at-item-p) 15940 ((org-at-item-p)
15941 (push (org-point-in-group p 2 :item-bullet) clist)
15232 (push (list :item (point-at-bol) 15942 (push (list :item (point-at-bol)
15233 (save-excursion (org-end-of-item) (point))) 15943 (save-excursion (org-end-of-item) (point)))
15234 clist) 15944 clist)
@@ -15262,7 +15972,19 @@ and :keyword."
15262 (goto-char (1- (match-beginning 0))) 15972 (goto-char (1- (match-beginning 0)))
15263 (if (looking-at org-radio-target-regexp) 15973 (if (looking-at org-radio-target-regexp)
15264 (push (org-point-in-group p 0 :radio-target) clist)) 15974 (push (org-point-in-group p 0 :radio-target) clist))
15265 (goto-char p))) 15975 (goto-char p))
15976 ((setq o (car (delq nil
15977 (mapcar
15978 (lambda (x)
15979 (if (memq x org-latex-fragment-image-overlays) x))
15980 (org-overlays-at (point))))))
15981 (push (list :latex-fragment
15982 (org-overlay-start o) (org-overlay-end o)) clist)
15983 (push (list :latex-preview
15984 (org-overlay-start o) (org-overlay-end o)) clist))
15985 ((org-inside-LaTeX-fragment-p)
15986 ;; FIXME: positions wring.
15987 (push (list :latex-fragment (point) (point)) clist)))
15266 15988
15267 (setq clist (nreverse (delq nil clist))) 15989 (setq clist (nreverse (delq nil clist)))
15268 clist)) 15990 clist))
@@ -15313,10 +16035,11 @@ return nil."
15313 ;; In the paragraph separator we include headlines, because filling 16035 ;; In the paragraph separator we include headlines, because filling
15314 ;; text in a line directly attached to a headline would otherwise 16036 ;; text in a line directly attached to a headline would otherwise
15315 ;; fill the headline as well. 16037 ;; fill the headline as well.
16038 (set (make-local-variable 'comment-start-skip) "^#+[ \t]*")
15316 (set (make-local-variable 'paragraph-separate) "\f\\|\\*\\|[ ]*$\\|[ \t]*[:|]") 16039 (set (make-local-variable 'paragraph-separate) "\f\\|\\*\\|[ ]*$\\|[ \t]*[:|]")
15317 ;; The paragraph starter includes hand-formatted lists. 16040 ;; The paragraph starter includes hand-formatted lists.
15318 (set (make-local-variable 'paragraph-start) 16041 (set (make-local-variable 'paragraph-start)
15319 "\f\\|[ ]*$\\|\\([*\f]+\\)\\|[ \t]*\\([-+*]\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]") 16042 "\f\\|[ ]*$\\|\\([*\f]+\\)\\|[ \t]*\\([-+*][ \t]+\\|[0-9]+[.)][ \t]+\\)\\|[ \t]*[:|]")
15320 ;; Inhibit auto-fill for headers, tables and fixed-width lines. 16043 ;; Inhibit auto-fill for headers, tables and fixed-width lines.
15321 ;; But only if the user has not turned off tables or fixed-width regions 16044 ;; But only if the user has not turned off tables or fixed-width regions
15322 (set (make-local-variable 'auto-fill-inhibit-regexp) 16045 (set (make-local-variable 'auto-fill-inhibit-regexp)
@@ -15630,13 +16353,12 @@ Show the heading too, if it is currently invisible."
15630 16353
15631(defun org-bookmark-jump-unhide () 16354(defun org-bookmark-jump-unhide ()
15632 "Unhide the current position, to show the bookmark location." 16355 "Unhide the current position, to show the bookmark location."
15633 (and (eq major-mode 'org-mode) 16356 (and (org-mode-p)
15634 (or (org-invisible-p) 16357 (or (org-invisible-p)
15635 (save-excursion (goto-char (max (point-min) (1- (point)))) 16358 (save-excursion (goto-char (max (point-min) (1- (point))))
15636 (org-invisible-p))) 16359 (org-invisible-p)))
15637 (org-show-hierarchy-above))) 16360 (org-show-hierarchy-above)))
15638 16361
15639
15640;;; Experimental code 16362;;; Experimental code
15641 16363
15642 16364
diff --git a/lisp/thingatpt.el b/lisp/thingatpt.el
index 27fecacdd36..c0aa80ef1ae 100644
--- a/lisp/thingatpt.el
+++ b/lisp/thingatpt.el
@@ -53,7 +53,7 @@
53 53
54;;;###autoload 54;;;###autoload
55(defun forward-thing (thing &optional n) 55(defun forward-thing (thing &optional n)
56 "Move forward to the end of the next THING." 56 "Move forward to the end of the Nth next THING."
57 (let ((forward-op (or (get thing 'forward-op) 57 (let ((forward-op (or (get thing 'forward-op)
58 (intern-soft (format "forward-%s" thing))))) 58 (intern-soft (format "forward-%s" thing)))))
59 (if (functionp forward-op) 59 (if (functionp forward-op)
@@ -80,16 +80,13 @@ of the textual entity that was found."
80 (condition-case nil 80 (condition-case nil
81 (save-excursion 81 (save-excursion
82 ;; Try moving forward, then back. 82 ;; Try moving forward, then back.
83 (let ((end (progn 83 (funcall ;; First move to end.
84 (funcall 84 (or (get thing 'end-op)
85 (or (get thing 'end-op) 85 (lambda () (forward-thing thing 1))))
86 (function (lambda () (forward-thing thing 1))))) 86 (funcall ;; Then move to beg.
87 (point))) 87 (or (get thing 'beginning-op)
88 (beg (progn 88 (lambda () (forward-thing thing -1))))
89 (funcall 89 (let ((beg (point)))
90 (or (get thing 'beginning-op)
91 (function (lambda () (forward-thing thing -1)))))
92 (point))))
93 (if (not (and beg (> beg orig))) 90 (if (not (and beg (> beg orig)))
94 ;; If that brings us all the way back to ORIG, 91 ;; If that brings us all the way back to ORIG,
95 ;; it worked. But END may not be the real end. 92 ;; it worked. But END may not be the real end.
@@ -98,28 +95,25 @@ of the textual entity that was found."
98 (progn 95 (progn
99 (funcall 96 (funcall
100 (or (get thing 'end-op) 97 (or (get thing 'end-op)
101 (function (lambda () (forward-thing thing 1))))) 98 (lambda () (forward-thing thing 1))))
102 (point)))) 99 (point))))
103 (if (and beg real-end (<= beg orig) (<= orig real-end)) 100 (if (and beg real-end (<= beg orig) (<= orig real-end))
104 (cons beg real-end))) 101 (cons beg real-end)))
105 (goto-char orig) 102 (goto-char orig)
106 ;; Try a second time, moving backward first and then forward, 103 ;; Try a second time, moving backward first and then forward,
107 ;; so that we can find a thing that ends at ORIG. 104 ;; so that we can find a thing that ends at ORIG.
108 (let ((beg (progn 105 (funcall ;; First, move to beg.
109 (funcall 106 (or (get thing 'beginning-op)
110 (or (get thing 'beginning-op) 107 (lambda () (forward-thing thing -1))))
111 (function (lambda () (forward-thing thing -1))))) 108 (funcall ;; Then move to end.
112 (point))) 109 (or (get thing 'end-op)
113 (end (progn 110 (lambda () (forward-thing thing 1))))
114 (funcall 111 (let ((end (point))
115 (or (get thing 'end-op) 112 (real-beg
116 (function (lambda () (forward-thing thing 1)))))
117 (point)))
118 (real-beg
119 (progn 113 (progn
120 (funcall 114 (funcall
121 (or (get thing 'beginning-op) 115 (or (get thing 'beginning-op)
122 (function (lambda () (forward-thing thing -1))))) 116 (lambda () (forward-thing thing -1))))
123 (point)))) 117 (point))))
124 (if (and real-beg end (<= real-beg orig) (<= orig end)) 118 (if (and real-beg end (<= real-beg orig) (<= orig end))
125 (cons real-beg end)))))) 119 (cons real-beg end))))))
@@ -160,7 +154,7 @@ a symbol as a valid THING."
160;; and it has no final newline. 154;; and it has no final newline.
161 155
162(put 'line 'beginning-op 156(put 'line 'beginning-op
163 (function (lambda () (if (bolp) (forward-line -1) (beginning-of-line))))) 157 (lambda () (if (bolp) (forward-line -1) (beginning-of-line))))
164 158
165;; Sexps 159;; Sexps
166 160
@@ -190,7 +184,7 @@ a symbol as a valid THING."
190 184
191;; Lists 185;; Lists
192 186
193(put 'list 'end-op (function (lambda () (up-list 1)))) 187(put 'list 'end-op (lambda () (up-list 1)))
194(put 'list 'beginning-op 'backward-sexp) 188(put 'list 'beginning-op 'backward-sexp)
195 189
196;; Filenames and URLs www.com/foo%32bar 190;; Filenames and URLs www.com/foo%32bar
@@ -229,7 +223,7 @@ Hostname matching is stricter in this case than for
229 "afs:" "tn3270:" "mailserver:" 223 "afs:" "tn3270:" "mailserver:"
230 ;; Compatibility 224 ;; Compatibility
231 "snews:") 225 "snews:")
232 "Uniform Resource Identifier (URI) Schemes") 226 "Uniform Resource Identifier (URI) Schemes.")
233 227
234(defvar thing-at-point-url-regexp 228(defvar thing-at-point-url-regexp
235 (concat "\\<\\(" (mapconcat 'identity thing-at-point-uri-schemes "\\|") "\\)" 229 (concat "\\<\\(" (mapconcat 'identity thing-at-point-uri-schemes "\\|") "\\)"
@@ -243,18 +237,19 @@ This may contain whitespace (including newlines) .")
243 237
244(put 'url 'bounds-of-thing-at-point 'thing-at-point-bounds-of-url-at-point) 238(put 'url 'bounds-of-thing-at-point 'thing-at-point-bounds-of-url-at-point)
245(defun thing-at-point-bounds-of-url-at-point () 239(defun thing-at-point-bounds-of-url-at-point ()
246 (let ((url "") short strip) 240 (let ((strip (thing-at-point-looking-at
247 (if (or (setq strip (thing-at-point-looking-at 241 thing-at-point-markedup-url-regexp))) ;; (url "") short
248 thing-at-point-markedup-url-regexp)) 242 (if (or strip
249 (thing-at-point-looking-at thing-at-point-url-regexp) 243` (thing-at-point-looking-at thing-at-point-url-regexp)
250 ;; Access scheme omitted? 244 ;; Access scheme omitted?
251 (setq short (thing-at-point-looking-at 245 ;; (setq short (thing-at-point-looking-at
252 thing-at-point-short-url-regexp))) 246 ;; thing-at-point-short-url-regexp))
247 )
253 (let ((beginning (match-beginning 0)) 248 (let ((beginning (match-beginning 0))
254 (end (match-end 0))) 249 (end (match-end 0)))
255 (cond (strip 250 (when strip
256 (setq beginning (+ beginning 5)) 251 (setq beginning (+ beginning 5))
257 (setq end (- end 1)))) 252 (setq end (- end 1)))
258 (cons beginning end))))) 253 (cons beginning end)))))
259 254
260(put 'url 'thing-at-point 'thing-at-point-url-at-point) 255(put 'url 'thing-at-point 'thing-at-point-url-at-point)
@@ -327,17 +322,17 @@ point."
327 (looking-at regexp))))) 322 (looking-at regexp)))))
328 323
329(put 'url 'end-op 324(put 'url 'end-op
330 (function (lambda () 325 (lambda ()
331 (let ((bounds (thing-at-point-bounds-of-url-at-point))) 326 (let ((bounds (thing-at-point-bounds-of-url-at-point)))
332 (if bounds 327 (if bounds
333 (goto-char (cdr bounds)) 328 (goto-char (cdr bounds))
334 (error "No URL here")))))) 329 (error "No URL here")))))
335(put 'url 'beginning-op 330(put 'url 'beginning-op
336 (function (lambda () 331 (lambda ()
337 (let ((bounds (thing-at-point-bounds-of-url-at-point))) 332 (let ((bounds (thing-at-point-bounds-of-url-at-point)))
338 (if bounds 333 (if bounds
339 (goto-char (car bounds)) 334 (goto-char (car bounds))
340 (error "No URL here")))))) 335 (error "No URL here")))))
341 336
342;; Whitespace 337;; Whitespace
343 338
@@ -385,7 +380,7 @@ point."
385(defun sentence-at-point () (thing-at-point 'sentence)) 380(defun sentence-at-point () (thing-at-point 'sentence))
386 381
387(defun read-from-whole-string (str) 382(defun read-from-whole-string (str)
388 "Read a lisp expression from STR. 383 "Read a Lisp expression from STR.
389Signal an error if the entire string was not used." 384Signal an error if the entire string was not used."
390 (let* ((read-data (read-from-string str)) 385 (let* ((read-data (read-from-string str))
391 (more-left 386 (more-left
@@ -407,11 +402,13 @@ Signal an error if the entire string was not used."
407;;;###autoload 402;;;###autoload
408(defun sexp-at-point () (form-at-point 'sexp)) 403(defun sexp-at-point () (form-at-point 'sexp))
409;;;###autoload 404;;;###autoload
410(defun symbol-at-point () (form-at-point 'sexp 'symbolp)) 405(defun symbol-at-point ()
406 (let ((thing (thing-at-point 'symbol)))
407 (if thing (intern thing))))
411;;;###autoload 408;;;###autoload
412(defun number-at-point () (form-at-point 'sexp 'numberp)) 409(defun number-at-point () (form-at-point 'sexp 'numberp))
413;;;###autoload 410;;;###autoload
414(defun list-at-point () (form-at-point 'list 'listp)) 411(defun list-at-point () (form-at-point 'list 'listp))
415 412
416;;; arch-tag: bb65a163-dae2-4055-aedc-fe11f497f698 413;; arch-tag: bb65a163-dae2-4055-aedc-fe11f497f698
417;;; thingatpt.el ends here 414;;; thingatpt.el ends here
diff --git a/lisp/tooltip.el b/lisp/tooltip.el
index cacd6f59670..596db839e84 100644
--- a/lisp/tooltip.el
+++ b/lisp/tooltip.el
@@ -40,12 +40,6 @@
40 40
41;;; Switching tooltips on/off 41;;; Switching tooltips on/off
42 42
43;; We don't set track-mouse globally because this is a big redisplay
44;; problem in buffers having a pre-command-hook or such installed,
45;; which does a set-buffer, like the summary buffer of Gnus. Calling
46;; set-buffer prevents redisplay optimizations, so every mouse motion
47;; would be accompanied by a full redisplay.
48
49(define-minor-mode tooltip-mode 43(define-minor-mode tooltip-mode
50 "Toggle Tooltip mode. 44 "Toggle Tooltip mode.
51With ARG, turn Tooltip mode on if and only if ARG is positive. 45With ARG, turn Tooltip mode on if and only if ARG is positive.
diff --git a/lisp/vc.el b/lisp/vc.el
index 54237800e3c..8290fd5b943 100644
--- a/lisp/vc.el
+++ b/lisp/vc.el
@@ -567,6 +567,13 @@ specific to any particular backend."
567 :group 'vc 567 :group 'vc
568 :version "21.1") 568 :version "21.1")
569 569
570(defcustom vc-diff-knows-L nil
571 "*Indicates whether diff understands the -L option.
572The value is either `yes', `no', or nil. If it is nil, VC tries
573to use -L and sets this variable to remember whether it worked."
574 :type '(choice (const :tag "Work out" nil) (const yes) (const no))
575 :group 'vc)
576
570(defcustom vc-allow-async-revert nil 577(defcustom vc-allow-async-revert nil
571 "Specifies whether the diff during \\[vc-revert-buffer] may be asynchronous. 578 "Specifies whether the diff during \\[vc-revert-buffer] may be asynchronous.
572Enabling this option means that you can confirm a revert operation even 579Enabling this option means that you can confirm a revert operation even
@@ -1837,18 +1844,36 @@ actually call the backend, but performs a local diff."
1837 (vc-version-backup-file file rev2))) 1844 (vc-version-backup-file file rev2)))
1838 (coding-system-for-read (vc-coding-system-for-diff file))) 1845 (coding-system-for-read (vc-coding-system-for-diff file)))
1839 (if (and file-rev1 file-rev2) 1846 (if (and file-rev1 file-rev2)
1840 (apply 'vc-do-command "*vc-diff*" 1 "diff" nil 1847 (let ((status
1841 (append (vc-switches nil 'diff) 1848 (if (eq vc-diff-knows-L 'no)
1842 ;; Provide explicit labels like RCS or CVS would do 1849 (apply 'vc-do-command "*vc-diff*" 1 "diff" nil
1843 ;; so diff-mode refers to `file' rather than to 1850 (append (vc-switches nil 'diff)
1844 ;; `file-rev1' when trying to find/apply/undo hunks. 1851 (list (file-relative-name file-rev1)
1845 (list "-L" (vc-diff-label file file-rev1 rev1) 1852 (file-relative-name file-rev2))))
1846 "-L" (vc-diff-label file file-rev2 rev2) 1853 (apply 'vc-do-command "*vc-diff*" 2 "diff" nil
1847 (file-relative-name file-rev1) 1854 (append (vc-switches nil 'diff)
1848 (file-relative-name file-rev2)))) 1855 ;; Provide explicit labels like RCS or
1856 ;; CVS would do so diff-mode refers to
1857 ;; `file' rather than to `file-rev1'
1858 ;; when trying to find/apply/undo
1859 ;; hunks.
1860 (list "-L" (vc-diff-label file file-rev1 rev1)
1861 "-L" (vc-diff-label file file-rev2 rev2)
1862 (file-relative-name file-rev1)
1863 (file-relative-name file-rev2)))))))
1864 (if (eq status 2)
1865 (if (not vc-diff-knows-L)
1866 (setq vc-diff-knows-L 'no
1867 status (apply 'vc-do-command "*vc-diff*" 1 "diff" nil
1868 (append
1869 (vc-switches nil 'diff)
1870 (list (file-relative-name file-rev1)
1871 (file-relative-name file-rev2)))))
1872 (error "diff failed"))
1873 (if (not vc-diff-knows-L) (setq vc-diff-knows-L 'yes)))
1874 status)
1849 (vc-call diff file rev1 rev2)))) 1875 (vc-call diff file rev1 rev2))))
1850 1876
1851
1852(defun vc-switches (backend op) 1877(defun vc-switches (backend op)
1853 (let ((switches 1878 (let ((switches
1854 (or (if backend 1879 (or (if backend
diff --git a/lisp/window.el b/lisp/window.el
index ef9dd5d896d..2ae1a2c9e79 100644
--- a/lisp/window.el
+++ b/lisp/window.el
@@ -532,7 +532,11 @@ the height exactly, but attempts to be conservative, by allocating more
532lines than are actually needed in the case where some error may be present." 532lines than are actually needed in the case where some error may be present."
533 (let ((delta (- height (window-text-height window)))) 533 (let ((delta (- height (window-text-height window))))
534 (unless (zerop delta) 534 (unless (zerop delta)
535 (let ((window-min-height 1)) 535 ;; Setting window-min-height to a value like 1 can lead to very
536 ;; bizarre displays because it also allows Emacs to make *other*
537 ;; windows 1-line tall, which means that there's no more space for
538 ;; the modeline.
539 (let ((window-min-height (min 2 height))) ;One text line plus a modeline.
536 (if (and window (not (eq window (selected-window)))) 540 (if (and window (not (eq window (selected-window))))
537 (save-selected-window 541 (save-selected-window
538 (select-window window) 542 (select-window window)