aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorMiles Bader2006-06-20 07:35:06 +0000
committerMiles Bader2006-06-20 07:35:06 +0000
commit7ffefb0856637762050ca248013d2b2f1cf7554e (patch)
treeaadd0178b0d1f637ea0a8fffce9c7a3fa1cf4dc0 /lisp
parent47067d3ec0ec1eea6ba561306349576a890cc274 (diff)
parent1e0fd4cd530948277283d0fe7b07e00a73fee934 (diff)
downloademacs-7ffefb0856637762050ca248013d2b2f1cf7554e.tar.gz
emacs-7ffefb0856637762050ca248013d2b2f1cf7554e.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 314-319) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 107) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-78
Diffstat (limited to 'lisp')
-rw-r--r--lisp/ChangeLog95
-rw-r--r--lisp/bindings.el3
-rw-r--r--lisp/cus-edit.el4
-rw-r--r--lisp/ediff-diff.el74
-rw-r--r--lisp/ediff-mult.el36
-rw-r--r--lisp/ediff-vers.el26
-rw-r--r--lisp/ediff-wind.el2
-rw-r--r--lisp/ediff.el80
-rw-r--r--lisp/emulation/viper-cmd.el90
-rw-r--r--lisp/emulation/viper-util.el4
-rw-r--r--lisp/emulation/viper.el6
-rw-r--r--lisp/files.el51
-rw-r--r--lisp/gnus/ChangeLog4
-rw-r--r--lisp/gnus/message.el2
-rw-r--r--lisp/international/characters.el5
-rw-r--r--lisp/mouse.el21
-rw-r--r--lisp/textmodes/org.el694
-rw-r--r--lisp/textmodes/tex-mode.el2
18 files changed, 865 insertions, 334 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 9666bfa58aa..1869e0a33f7 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,98 @@
12006-06-20 Kenichi Handa <handa@m17n.org>
2
3 * international/characters.el (word-combining-categories): Add
4 entries for 2-byte Han characters.
5
62006-06-19 Richard Stallman <rms@gnu.org>
7
8 * bindings.el (mode-line-format): Save some mode line space.
9
10 * files.el (find-file-noselect): Improve the question wording.
11 (basic-save-buffer-2): Mask UMASK against 666.
12
13 * mouse.el (mouse-drag-vertical-line-rightward-window): New function.
14 (mouse-drag-vertical-line): Call it.
15
16 * cus-edit.el (customize-option, customize-option-other-window):
17 Error if SYMBOL is nil.
18
192006-06-19 Carsten Dominik <dominik@science.uva.nl>
20
21 * textmodes/org.el: Require noutline, also on XEmacs.
22 (org-end-of-subtree): Return point.
23 (org-dblock-start-re, org-dblock-end-re): New constants.
24 (org-create-dblock, org-prepare-dblock, org-map-dblocks)
25 (org-dblock-update, org-update-dblock, org-beginning-of-dblock)
26 (org-update-all-dblocks, org-find-dblock): New functions.
27 (org-collect-clock-time-entries): New function.
28 (org-html-handle-time-stamps): Never export CLOCK timeranges.
29 (org-fixup-indentation): Modified to deadl correctly with lines
30 starting with TAB. Only one argument DIFF now.
31 (org-demote, org-promote): Call `org-fixup-indentation' with just
32 one argument, DIFF.
33 (org-mode): Don't mark buffer as modified when aligning tables.
34 (org-clock-sum): Don't makr buffer modified when adding time sum
35 properties.
36 (org-export-as-html): Added support for a link validation
37 function.
38 (org-archive-all-done): New function.
39 (org-archive-subtree): New prefix argument. When set, archive all
40 done subtrees in this buffer.
41 (org-remove-clock-overlays)
42 (org-remove-occur-highlights): Use
43 `org-inhibit-highlight-removal'.
44 (org-inhibit-highlight-removal): New variable, for dynamic
45 scoping.
46 (org-put-clock-overlay): Don't swallow last headline character
47 when displaying overlay.
48 (org-store-link): Link to `image-mode' with just the file name.
49
50
512006-06-18 Michael Kifer <kifer@cs.stonybrook.edu>
52
53 * viper-cmd.el (viper-special-read-and-insert-char): use
54 read-key-sequence.
55 (viper-after-change-undo-hook): enhancements.
56 (viper-after-change-undo-hook): new hook.
57 (viper-undo): use viper-after-change-undo-hook.
58 (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
60 clicking on that widget/button.
61
62 * viper.el (viper-mode): allow for a separate cursor color in Emacs
63 state.
64
65 * ediff-diff (ediff-test-patch-utility): catch errors.
66 (ediff-actual-diff-options, ediff-actual-diff3-options): new variables.
67 (ediff-set-actual-diff-options): new function.
68 (ediff-reset-diff-options, ediff-toggle-ignore-case):
69 use ediff-set-actual-diff-options.
70 (ediff-extract-diffs): catch errors.
71 (ediff-whitespace): add nonbreakable space.
72 (ediff-same-file-contents): catch errors.
73
74 * ediff-mult.el (ediff-collect-custom-diffs): save
75 coding-system-for-read.
76
77 * ediff-vers.el (ediff-keep-tmp-versions): new var.
78 (ediff-vc-internal, ediff-vc-merge-internal): use
79 ediff-delete-version-file.
80 (ediff-delete-version-file): new function.
81
82 * ediff-wind.el (ediff-control-frame-parameters): set frame fringes.
83
84 * ediff.el (ediff-directories, ediff-directory-revisions,
85 ediff-merge-directories, ediff-merge-directories-with-ancestor,
86 ediff-directories-internal, ediff-merge-directory-revisions,
87 ediff-merge-directory-revisions-with-ancestor,
88 ediff-directories3): use read-directory-name.
89
902006-06-18 Ralf Angeli <angeli@caeruleus.net>
91
92 * textmodes/tex-mode.el (tex-font-lock-match-suscript): Remove
93 superfluous part of regexp for brace matching which is handled by
94 `scan-lists' call.
95
12006-06-16 Richard Stallman <rms@gnu.org> 962006-06-16 Richard Stallman <rms@gnu.org>
2 97
3 * obsolete/options.el (list-options): Put "obsolete" msg in buffer. 98 * obsolete/options.el (list-options): Put "obsolete" msg in buffer.
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 4fdfb172e3e..da039716507 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -299,8 +299,7 @@ Keymap to display on minor modes.")
299 'mode-line-buffer-identification 299 'mode-line-buffer-identification
300 (propertize " " 'help-echo help-echo) 300 (propertize " " 'help-echo help-echo)
301 'mode-line-position 301 'mode-line-position
302 '(vc-mode vc-mode) 302 `(vc-mode ("" vc-mode ,(propertize " " 'help-echo help-echo)))
303 (propertize " " 'help-echo help-echo)
304 'mode-line-modes 303 'mode-line-modes
305 `(which-func-mode ("" which-func-format ,dashes)) 304 `(which-func-mode ("" which-func-format ,dashes))
306 `(global-mode-string (,dashes global-mode-string)) 305 `(global-mode-string (,dashes global-mode-string))
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index e700cd47d16..53f92f2243b 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -1055,6 +1055,8 @@ then prompt for the MODE to customize."
1055(defun customize-option (symbol) 1055(defun customize-option (symbol)
1056 "Customize SYMBOL, which must be a user option variable." 1056 "Customize SYMBOL, which must be a user option variable."
1057 (interactive (custom-variable-prompt)) 1057 (interactive (custom-variable-prompt))
1058 (unless symbol
1059 (error "No variable specified"))
1058 (let ((basevar (indirect-variable symbol))) 1060 (let ((basevar (indirect-variable symbol)))
1059 (custom-buffer-create (list (list basevar 'custom-variable)) 1061 (custom-buffer-create (list (list basevar 'custom-variable))
1060 (format "*Customize Option: %s*" 1062 (format "*Customize Option: %s*"
@@ -1070,6 +1072,8 @@ then prompt for the MODE to customize."
1070 "Customize SYMBOL, which must be a user option variable. 1072 "Customize SYMBOL, which must be a user option variable.
1071Show the buffer in another window, but don't select it." 1073Show the buffer in another window, but don't select it."
1072 (interactive (custom-variable-prompt)) 1074 (interactive (custom-variable-prompt))
1075 (unless symbol
1076 (error "No variable specified"))
1073 (let ((basevar (indirect-variable symbol))) 1077 (let ((basevar (indirect-variable symbol)))
1074 (custom-buffer-create-other-window 1078 (custom-buffer-create-other-window
1075 (list (list basevar 'custom-variable)) 1079 (list (list basevar 'custom-variable))
diff --git a/lisp/ediff-diff.el b/lisp/ediff-diff.el
index 7746954292d..e3675064010 100644
--- a/lisp/ediff-diff.el
+++ b/lisp/ediff-diff.el
@@ -65,10 +65,11 @@ Must produce output compatible with Unix's diff3 program."
65;; The following functions needed for setting diff/diff3 options 65;; The following functions needed for setting diff/diff3 options
66;; test if diff supports the --binary option 66;; test if diff supports the --binary option
67(defsubst ediff-test-utility (diff-util option &optional files) 67(defsubst ediff-test-utility (diff-util option &optional files)
68 (condition-case () 68 (condition-case nil
69 (eq 0 (apply 'call-process 69 (eq 0 (apply 'call-process
70 (append (list diff-util nil nil nil option) files))) 70 (append (list diff-util nil nil nil option) files)))
71 (file-error nil))) 71 (error (format "Cannot execute program %S." diff-util)))
72 )
72 73
73(defun ediff-diff-mandatory-option (diff-util) 74(defun ediff-diff-mandatory-option (diff-util)
74 (let ((file (if (boundp 'null-device) null-device "/dev/null"))) 75 (let ((file (if (boundp 'null-device) null-device "/dev/null")))
@@ -77,13 +78,17 @@ Must produce output compatible with Unix's diff3 program."
77 ((and (string= diff-util ediff-diff-program) 78 ((and (string= diff-util ediff-diff-program)
78 (ediff-test-utility 79 (ediff-test-utility
79 ediff-diff-program "--binary" (list file file))) 80 ediff-diff-program "--binary" (list file file)))
80 "--binary") 81 "--binary ")
81 ((and (string= diff-util ediff-diff3-program) 82 ((and (string= diff-util ediff-diff3-program)
82 (ediff-test-utility 83 (ediff-test-utility
83 ediff-diff3-program "--binary" (list file file file))) 84 ediff-diff3-program "--binary" (list file file file)))
84 "--binary") 85 "--binary ")
85 (t "")))) 86 (t ""))))
86 87
88
89;; must be before ediff-reset-diff-options to avoid compiler errors
90(fset 'ediff-set-actual-diff-options '(lambda () nil))
91
87;; make sure that mandatory options are added even if the user changes 92;; make sure that mandatory options are added even if the user changes
88;; ediff-diff-options or ediff-diff3-options in the customization widget 93;; ediff-diff-options or ediff-diff3-options in the customization widget
89(defun ediff-reset-diff-options (symb val) 94(defun ediff-reset-diff-options (symb val)
@@ -91,12 +96,9 @@ Must produce output compatible with Unix's diff3 program."
91 (if (eq symb 'ediff-diff-options) 96 (if (eq symb 'ediff-diff-options)
92 ediff-diff-program 97 ediff-diff-program
93 ediff-diff3-program)) 98 ediff-diff3-program))
94 (mandatory-option (ediff-diff-mandatory-option diff-program)) 99 (mandatory-option (ediff-diff-mandatory-option diff-program)))
95 (spacer (if (string-equal mandatory-option "") "" " "))) 100 (set symb (concat mandatory-option val))
96 (set symb 101 (ediff-set-actual-diff-options)
97 (if (string-match mandatory-option val)
98 val
99 (concat mandatory-option spacer val)))
100 )) 102 ))
101 103
102 104
@@ -155,7 +157,7 @@ GNU diff3 doesn't have such an option."
155 :group 'ediff-diff) 157 :group 'ediff-diff)
156 158
157;; the actual options used in comparison 159;; the actual options used in comparison
158(ediff-defvar-local ediff-actual-diff-options "" "") 160(ediff-defvar-local ediff-actual-diff-options ediff-diff-options "")
159 161
160(defcustom ediff-custom-diff-program ediff-diff-program 162(defcustom ediff-custom-diff-program ediff-diff-program
161 "*Program to use for generating custom diff output for saving it in a file. 163 "*Program to use for generating custom diff output for saving it in a file.
@@ -178,7 +180,7 @@ This output is not used by Ediff internally."
178 :group 'ediff-diff) 180 :group 'ediff-diff)
179 181
180;; the actual options used in comparison 182;; the actual options used in comparison
181(ediff-defvar-local ediff-actual-diff3-options "" "") 183(ediff-defvar-local ediff-actual-diff3-options ediff-diff3-options "")
182 184
183(defcustom ediff-diff3-ok-lines-regexp 185(defcustom ediff-diff3-ok-lines-regexp
184 "^\\([1-3]:\\|====\\| \\|.*Warning *:\\|.*No newline\\|.*missing newline\\|^\C-m$\\)" 186 "^\\([1-3]:\\|====\\| \\|.*Warning *:\\|.*No newline\\|.*missing newline\\|^\C-m$\\)"
@@ -1272,7 +1274,9 @@ delimiter regions"))
1272 ;; Similarly for Windows-* 1274 ;; Similarly for Windows-*
1273 ;; In DOS, must synchronize because DOS doesn't have 1275 ;; In DOS, must synchronize because DOS doesn't have
1274 ;; asynchronous processes. 1276 ;; asynchronous processes.
1275 (apply 'call-process program nil buffer nil args) 1277 (condition-case nil
1278 (apply 'call-process program nil buffer nil args)
1279 (error (format "Cannot execute program %S." program)))
1276 ;; On other systems, do it asynchronously. 1280 ;; On other systems, do it asynchronously.
1277 (setq proc (get-buffer-process buffer)) 1281 (setq proc (get-buffer-process buffer))
1278 (if proc (kill-process proc)) 1282 (if proc (kill-process proc))
@@ -1328,7 +1332,8 @@ delimiter regions"))
1328Used for splitting difference regions into individual words.") 1332Used for splitting difference regions into individual words.")
1329(make-variable-buffer-local 'ediff-forward-word-function) 1333(make-variable-buffer-local 'ediff-forward-word-function)
1330 1334
1331(defvar ediff-whitespace " \n\t\f" 1335;; \240 is unicode symbol for nonbreakable whitespace
1336(defvar ediff-whitespace " \n\t\f\r\240"
1332 "*Characters constituting white space. 1337 "*Characters constituting white space.
1333These characters are ignored when differing regions are split into words.") 1338These characters are ignored when differing regions are split into words.")
1334(make-variable-buffer-local 'ediff-whitespace) 1339(make-variable-buffer-local 'ediff-whitespace)
@@ -1442,11 +1447,13 @@ arguments to `skip-chars-forward'."
1442 "Return t if files F1 and F2 have identical contents." 1447 "Return t if files F1 and F2 have identical contents."
1443 (if (and (not (file-directory-p f1)) 1448 (if (and (not (file-directory-p f1))
1444 (not (file-directory-p f2))) 1449 (not (file-directory-p f2)))
1445 (let ((res 1450 (condition-case nil
1446 (apply 'call-process ediff-cmp-program nil nil nil 1451 (let ((res
1447 (append ediff-cmp-options (list f1 f2))))) 1452 (apply 'call-process ediff-cmp-program nil nil nil
1448 (and (numberp res) (eq res 0)))) 1453 (append ediff-cmp-options (list f1 f2)))))
1449 ) 1454 (and (numberp res) (eq res 0)))
1455 (error (format "Cannot execute program %S." ediff-cmp-program)))
1456 ))
1450 1457
1451 1458
1452(defun ediff-same-contents (d1 d2 &optional filter-re) 1459(defun ediff-same-contents (d1 d2 &optional filter-re)
@@ -1521,21 +1528,30 @@ affects only files whose names match the expression."
1521 (setq file-list-list (cdr file-list-list))) 1528 (setq file-list-list (cdr file-list-list)))
1522 (reverse result))) 1529 (reverse result)))
1523 1530
1531
1532(defun ediff-set-actual-diff-options ()
1533 (if ediff-ignore-case
1534 (setq ediff-actual-diff-options
1535 (concat ediff-diff-options " " ediff-ignore-case-option)
1536 ediff-actual-diff3-options
1537 (concat ediff-diff3-options " " ediff-ignore-case-option3))
1538 (setq ediff-actual-diff-options ediff-diff-options
1539 ediff-actual-diff3-options ediff-diff3-options)
1540 )
1541 (setq-default ediff-actual-diff-options ediff-actual-diff-options
1542 ediff-actual-diff3-options ediff-actual-diff3-options)
1543 )
1544
1545
1524;; Ignore case handling - some ideas from drew.adams@@oracle.com 1546;; Ignore case handling - some ideas from drew.adams@@oracle.com
1525(defun ediff-toggle-ignore-case () 1547(defun ediff-toggle-ignore-case ()
1526 (interactive) 1548 (interactive)
1527 (ediff-barf-if-not-control-buffer) 1549 (ediff-barf-if-not-control-buffer)
1528 (setq ediff-ignore-case (not ediff-ignore-case)) 1550 (setq ediff-ignore-case (not ediff-ignore-case))
1529 (cond (ediff-ignore-case 1551 (ediff-set-actual-diff-options)
1530 (setq ediff-actual-diff-options 1552 (if ediff-ignore-case
1531 (concat ediff-diff-options " " ediff-ignore-case-option) 1553 (message "Ignoring regions that differ only in case")
1532 ediff-actual-diff3-options 1554 (message "Ignoring case differences turned OFF"))
1533 (concat ediff-diff3-options " " ediff-ignore-case-option3))
1534 (message "Ignoring regions that differ only in case"))
1535 (t
1536 (setq ediff-actual-diff-options ediff-diff-options
1537 ediff-actual-diff3-options ediff-diff3-options)
1538 (message "Ignoring case differences turned OFF")))
1539 (cond (ediff-merge-job 1555 (cond (ediff-merge-job
1540 (message "Ignoring letter case is too dangerous in merge jobs")) 1556 (message "Ignoring letter case is too dangerous in merge jobs"))
1541 ((and ediff-diff3-job (string= ediff-ignore-case-option3 "")) 1557 ((and ediff-diff3-job (string= ediff-ignore-case-option3 ""))
diff --git a/lisp/ediff-mult.el b/lisp/ediff-mult.el
index 0bbd3298c7a..71859a5d4c5 100644
--- a/lisp/ediff-mult.el
+++ b/lisp/ediff-mult.el
@@ -1656,22 +1656,26 @@ This operation is defined only for `ediff-directories' and
1656multifile patches. For `ediff-directory-revisions', we insist that 1656multifile patches. For `ediff-directory-revisions', we insist that
1657all marked sessions must be active." 1657all marked sessions must be active."
1658 (interactive) 1658 (interactive)
1659 (or (ediff-buffer-live-p ediff-meta-diff-buffer) 1659 (let ((coding-system-for-read ediff-coding-system-for-read))
1660 (setq ediff-meta-diff-buffer 1660 (or (ediff-buffer-live-p ediff-meta-diff-buffer)
1661 (get-buffer-create 1661 (setq ediff-meta-diff-buffer
1662 (ediff-unique-buffer-name "*Ediff Multifile Diffs" "*")))) 1662 (get-buffer-create
1663 (ediff-with-current-buffer ediff-meta-diff-buffer 1663 (ediff-unique-buffer-name "*Ediff Multifile Diffs" "*"))))
1664 (setq buffer-read-only nil) 1664 (ediff-with-current-buffer ediff-meta-diff-buffer
1665 (erase-buffer)) 1665 (setq buffer-read-only nil)
1666 (if (> (ediff-operate-on-marked-sessions 'ediff-append-custom-diff) 0) 1666 (erase-buffer))
1667 ;; did something 1667 (if (> (ediff-operate-on-marked-sessions 'ediff-append-custom-diff) 0)
1668 (progn 1668 ;; did something
1669 (display-buffer ediff-meta-diff-buffer 'not-this-window) 1669 (progn
1670 (ediff-with-current-buffer ediff-meta-diff-buffer 1670 (display-buffer ediff-meta-diff-buffer 'not-this-window)
1671 (set-buffer-modified-p nil) 1671 (ediff-with-current-buffer ediff-meta-diff-buffer
1672 (setq buffer-read-only t))) 1672 (set-buffer-modified-p nil)
1673 (beep) 1673 (setq buffer-read-only t))
1674 (message "No marked sessions found"))) 1674 (if (fboundp 'diff-mode)
1675 (with-current-buffer ediff-meta-diff-buffer
1676 (diff-mode))))
1677 (beep)
1678 (message "No marked sessions found"))))
1675 1679
1676(defun ediff-meta-show-patch () 1680(defun ediff-meta-show-patch ()
1677 "Show the multi-file patch associated with this group session." 1681 "Show the multi-file patch associated with this group session."
diff --git a/lisp/ediff-vers.el b/lisp/ediff-vers.el
index 3e8b1c37572..4cd1492a1c7 100644
--- a/lisp/ediff-vers.el
+++ b/lisp/ediff-vers.el
@@ -52,6 +52,13 @@
52 ))) 52 )))
53;; end pacifier 53;; end pacifier
54 54
55(defcustom ediff-keep-tmp-versions nil
56 "*If t, do not delete temporary previous versions for the files on which
57comparison or merge operations are being performed."
58 :type 'boolean
59 :group 'ediff-vers
60 )
61
55;; VC.el support 62;; VC.el support
56 63
57(defun ediff-vc-latest-version (file) 64(defun ediff-vc-latest-version (file)
@@ -87,8 +94,8 @@
87 file2 (buffer-file-name))) 94 file2 (buffer-file-name)))
88 (setq startup-hooks 95 (setq startup-hooks
89 (cons `(lambda () 96 (cons `(lambda ()
90 (delete-file ,file1) 97 (ediff-delete-version-file ,file1)
91 (or ,(string= rev2 "") (delete-file ,file2))) 98 (or ,(string= rev2 "") (ediff-delete-version-file ,file2)))
92 startup-hooks))) 99 startup-hooks)))
93 (ediff-buffers 100 (ediff-buffers
94 rev1buf rev2buf 101 rev1buf rev2buf
@@ -199,12 +206,12 @@
199 (setq startup-hooks 206 (setq startup-hooks
200 (cons 207 (cons
201 `(lambda () 208 `(lambda ()
202 (delete-file ,(buffer-file-name buf1)) 209 (ediff-delete-version-file ,(buffer-file-name buf1))
203 (or ,(string= rev2 "") 210 (or ,(string= rev2 "")
204 (delete-file ,(buffer-file-name buf2))) 211 (ediff-delete-version-file ,(buffer-file-name buf2)))
205 (or ,(string= ancestor-rev "") 212 (or ,(string= ancestor-rev "")
206 ,(not ancestor-rev) 213 ,(not ancestor-rev)
207 (delete-file ,(buffer-file-name ancestor-buf))) 214 (ediff-delete-version-file ,(buffer-file-name ancestor-buf)))
208 ) 215 )
209 startup-hooks))) 216 startup-hooks)))
210 (if ancestor-rev 217 (if ancestor-rev
@@ -305,8 +312,13 @@
305 (find-file-noselect (cvs-fileinfo->full-name fileinfo))) 312 (find-file-noselect (cvs-fileinfo->full-name fileinfo)))
306 nil ; startup-hooks 313 nil ; startup-hooks
307 'ediff-revisions))) 314 'ediff-revisions)))
308 (if (stringp tmp-file) (delete-file tmp-file)) 315 (if (stringp tmp-file) (ediff-delete-version-file tmp-file))
309 (if (stringp ancestor-file) (delete-file ancestor-file)))) 316 (if (stringp ancestor-file) (ediff-delete-version-file ancestor-file))))
317
318
319;; delete version file on exit unless ediff-keep-tmp-versions is true
320(defun ediff-delete-version-file (file)
321 (or ediff-keep-tmp-versions (delete-file file)))
310 322
311 323
312(provide 'ediff-vers) 324(provide 'ediff-vers)
diff --git a/lisp/ediff-wind.el b/lisp/ediff-wind.el
index 28369f9f6bd..c0786b9cc43 100644
--- a/lisp/ediff-wind.el
+++ b/lisp/ediff-wind.el
@@ -158,6 +158,8 @@ In this case, Ediff will use those frames to display these buffers."
158 '(scrollbar-height . 0) ; XEmacs only 158 '(scrollbar-height . 0) ; XEmacs only
159 '(menu-bar-lines . 0) ; Emacs only 159 '(menu-bar-lines . 0) ; Emacs only
160 '(tool-bar-lines . 0) ; Emacs 21+ only 160 '(tool-bar-lines . 0) ; Emacs 21+ only
161 '(left-fringe . 0)
162 '(right-fringe . 0)
161 ;; don't lower but auto-raise 163 ;; don't lower but auto-raise
162 '(auto-lower . nil) 164 '(auto-lower . nil)
163 '(auto-raise . t) 165 '(auto-raise . t)
diff --git a/lisp/ediff.el b/lisp/ediff.el
index 14f634f0cd2..3e0be86b18b 100644
--- a/lisp/ediff.el
+++ b/lisp/ediff.el
@@ -500,12 +500,13 @@ expression; only file names that match the regexp are considered."
500 (let ((dir-A (ediff-get-default-directory-name)) 500 (let ((dir-A (ediff-get-default-directory-name))
501 (default-regexp (eval ediff-default-filtering-regexp)) 501 (default-regexp (eval ediff-default-filtering-regexp))
502 f) 502 f)
503 (list (setq f (ediff-read-file-name "Directory A to compare:" dir-A nil)) 503 (list (setq f (read-directory-name
504 (ediff-read-file-name "Directory B to compare:" 504 "Directory A to compare:" dir-A nil 'must-match))
505 (if ediff-use-last-dir 505 (read-directory-name "Directory B to compare:"
506 ediff-last-dir-B 506 (if ediff-use-last-dir
507 (ediff-strip-last-dir f)) 507 ediff-last-dir-B
508 nil) 508 (ediff-strip-last-dir f))
509 nil 'must-match)
509 (read-string 510 (read-string
510 (if (stringp default-regexp) 511 (if (stringp default-regexp)
511 (format "Filter through regular expression (default %s): " 512 (format "Filter through regular expression (default %s): "
@@ -532,8 +533,8 @@ names. Only the files that are under revision control are taken into account."
532 (let ((dir-A (ediff-get-default-directory-name)) 533 (let ((dir-A (ediff-get-default-directory-name))
533 (default-regexp (eval ediff-default-filtering-regexp)) 534 (default-regexp (eval ediff-default-filtering-regexp))
534 ) 535 )
535 (list (ediff-read-file-name 536 (list (read-directory-name
536 "Directory to compare with revision:" dir-A nil) 537 "Directory to compare with revision:" dir-A nil 'must-match)
537 (read-string 538 (read-string
538 (if (stringp default-regexp) 539 (if (stringp default-regexp)
539 (format "Filter through regular expression (default %s): " 540 (format "Filter through regular expression (default %s): "
@@ -561,17 +562,17 @@ regular expression; only file names that match the regexp are considered."
561 (let ((dir-A (ediff-get-default-directory-name)) 562 (let ((dir-A (ediff-get-default-directory-name))
562 (default-regexp (eval ediff-default-filtering-regexp)) 563 (default-regexp (eval ediff-default-filtering-regexp))
563 f) 564 f)
564 (list (setq f (ediff-read-file-name "Directory A to compare:" dir-A nil)) 565 (list (setq f (read-directory-name "Directory A to compare:" dir-A nil))
565 (setq f (ediff-read-file-name "Directory B to compare:" 566 (setq f (read-directory-name "Directory B to compare:"
566 (if ediff-use-last-dir 567 (if ediff-use-last-dir
567 ediff-last-dir-B 568 ediff-last-dir-B
568 (ediff-strip-last-dir f)) 569 (ediff-strip-last-dir f))
569 nil)) 570 nil 'must-match))
570 (ediff-read-file-name "Directory C to compare:" 571 (read-directory-name "Directory C to compare:"
571 (if ediff-use-last-dir 572 (if ediff-use-last-dir
572 ediff-last-dir-C 573 ediff-last-dir-C
573 (ediff-strip-last-dir f)) 574 (ediff-strip-last-dir f))
574 nil) 575 nil 'must-match)
575 (read-string 576 (read-string
576 (if (stringp default-regexp) 577 (if (stringp default-regexp)
577 (format "Filter through regular expression (default %s): " 578 (format "Filter through regular expression (default %s): "
@@ -597,12 +598,13 @@ expression; only file names that match the regexp are considered."
597 (let ((dir-A (ediff-get-default-directory-name)) 598 (let ((dir-A (ediff-get-default-directory-name))
598 (default-regexp (eval ediff-default-filtering-regexp)) 599 (default-regexp (eval ediff-default-filtering-regexp))
599 f) 600 f)
600 (list (setq f (ediff-read-file-name "Directory A to merge:" dir-A nil)) 601 (list (setq f (read-directory-name "Directory A to merge:"
601 (ediff-read-file-name "Directory B to merge:" 602 dir-A nil 'must-match))
602 (if ediff-use-last-dir 603 (read-directory-name "Directory B to merge:"
603 ediff-last-dir-B 604 (if ediff-use-last-dir
604 (ediff-strip-last-dir f)) 605 ediff-last-dir-B
605 nil) 606 (ediff-strip-last-dir f))
607 nil 'must-match)
606 (read-string 608 (read-string
607 (if (stringp default-regexp) 609 (if (stringp default-regexp)
608 (format "Filter through regular expression (default %s): " 610 (format "Filter through regular expression (default %s): "
@@ -633,17 +635,17 @@ only file names that match the regexp are considered."
633 (let ((dir-A (ediff-get-default-directory-name)) 635 (let ((dir-A (ediff-get-default-directory-name))
634 (default-regexp (eval ediff-default-filtering-regexp)) 636 (default-regexp (eval ediff-default-filtering-regexp))
635 f) 637 f)
636 (list (setq f (ediff-read-file-name "Directory A to merge:" dir-A nil)) 638 (list (setq f (read-directory-name "Directory A to merge:" dir-A nil))
637 (setq f (ediff-read-file-name "Directory B to merge:" 639 (setq f (read-directory-name "Directory B to merge:"
638 (if ediff-use-last-dir 640 (if ediff-use-last-dir
639 ediff-last-dir-B 641 ediff-last-dir-B
640 (ediff-strip-last-dir f)) 642 (ediff-strip-last-dir f))
641 nil)) 643 nil 'must-match))
642 (ediff-read-file-name "Ancestor directory:" 644 (read-directory-name "Ancestor directory:"
643 (if ediff-use-last-dir 645 (if ediff-use-last-dir
644 ediff-last-dir-C 646 ediff-last-dir-C
645 (ediff-strip-last-dir f)) 647 (ediff-strip-last-dir f))
646 nil) 648 nil 'must-match)
647 (read-string 649 (read-string
648 (if (stringp default-regexp) 650 (if (stringp default-regexp)
649 (format "Filter through regular expression (default %s): " 651 (format "Filter through regular expression (default %s): "
@@ -669,8 +671,8 @@ names. Only the files that are under revision control are taken into account."
669 (let ((dir-A (ediff-get-default-directory-name)) 671 (let ((dir-A (ediff-get-default-directory-name))
670 (default-regexp (eval ediff-default-filtering-regexp)) 672 (default-regexp (eval ediff-default-filtering-regexp))
671 ) 673 )
672 (list (ediff-read-file-name 674 (list (read-directory-name
673 "Directory to merge with revisions:" dir-A nil) 675 "Directory to merge with revisions:" dir-A nil 'must-match)
674 (read-string 676 (read-string
675 (if (stringp default-regexp) 677 (if (stringp default-regexp)
676 (format "Filter through regular expression (default %s): " 678 (format "Filter through regular expression (default %s): "
@@ -699,8 +701,9 @@ names. Only the files that are under revision control are taken into account."
699 (let ((dir-A (ediff-get-default-directory-name)) 701 (let ((dir-A (ediff-get-default-directory-name))
700 (default-regexp (eval ediff-default-filtering-regexp)) 702 (default-regexp (eval ediff-default-filtering-regexp))
701 ) 703 )
702 (list (ediff-read-file-name 704 (list (read-directory-name
703 "Directory to merge with revisions and ancestors:" dir-A nil) 705 "Directory to merge with revisions and ancestors:"
706 dir-A nil 'must-match)
704 (read-string 707 (read-string
705 (if (stringp default-regexp) 708 (if (stringp default-regexp)
706 (format "Filter through regular expression (default %s): " 709 (format "Filter through regular expression (default %s): "
@@ -733,11 +736,6 @@ names. Only the files that are under revision control are taken into account."
733(defun ediff-directories-internal (dir1 dir2 dir3 regexp action jobname 736(defun ediff-directories-internal (dir1 dir2 dir3 regexp action jobname
734 &optional startup-hooks 737 &optional startup-hooks
735 merge-autostore-dir) 738 merge-autostore-dir)
736 ;; ediff-read-file-name is set to attach a previously entered file name if
737 ;; the currently entered file is a directory. This code takes care of that.
738 (setq dir1 (if (file-directory-p dir1) dir1 (file-name-directory dir1))
739 dir2 (if (file-directory-p dir2) dir2 (file-name-directory dir2)))
740
741 (if (stringp dir3) 739 (if (stringp dir3)
742 (setq dir3 (if (file-directory-p dir3) dir3 (file-name-directory dir3)))) 740 (setq dir3 (if (file-directory-p dir3) dir3 (file-name-directory dir3))))
743 741
@@ -763,7 +761,7 @@ names. Only the files that are under revision control are taken into account."
763 (ediff-merge-metajob jobname) 761 (ediff-merge-metajob jobname)
764 (not merge-autostore-dir)) 762 (not merge-autostore-dir))
765 (setq merge-autostore-dir 763 (setq merge-autostore-dir
766 (read-file-name "Save merged files in directory: " 764 (read-directory-name "Save merged files in directory: "
767 (if ediff-use-last-dir 765 (if ediff-use-last-dir
768 ediff-last-merge-autostore-dir 766 ediff-last-merge-autostore-dir
769 (ediff-strip-last-dir dir1)) 767 (ediff-strip-last-dir dir1))
@@ -823,7 +821,7 @@ names. Only the files that are under revision control are taken into account."
823 (ediff-merge-metajob jobname) 821 (ediff-merge-metajob jobname)
824 (not merge-autostore-dir)) 822 (not merge-autostore-dir))
825 (setq merge-autostore-dir 823 (setq merge-autostore-dir
826 (read-file-name "Save merged files in directory: " 824 (read-directory-name "Save merged files in directory: "
827 (if ediff-use-last-dir 825 (if ediff-use-last-dir
828 ediff-last-merge-autostore-dir 826 ediff-last-merge-autostore-dir
829 (ediff-strip-last-dir dir1)) 827 (ediff-strip-last-dir dir1))
diff --git a/lisp/emulation/viper-cmd.el b/lisp/emulation/viper-cmd.el
index 645f4f26eaf..0dce3b94ff0 100644
--- a/lisp/emulation/viper-cmd.el
+++ b/lisp/emulation/viper-cmd.el
@@ -887,12 +887,15 @@ Vi's prefix argument will be used. Otherwise, the prefix argument passed to
887 (setq ch (aref (read-key-sequence nil) 0))) 887 (setq ch (aref (read-key-sequence nil) 0)))
888 (insert ch)) 888 (insert ch))
889 (t 889 (t
890 (setq ch (read-char-exclusive)) 890 ;;(setq ch (read-char-exclusive))
891 (setq ch (aref (read-key-sequence nil) 0))
891 ;; replace ^M with the newline 892 ;; replace ^M with the newline
892 (if (eq ch ?\C-m) (setq ch ?\n)) 893 (if (eq ch ?\C-m) (setq ch ?\n))
893 ;; Make sure ^V and ^Q work as quotation chars 894 ;; Make sure ^V and ^Q work as quotation chars
894 (if (memq ch '(?\C-v ?\C-q)) 895 (if (memq ch '(?\C-v ?\C-q))
895 (setq ch (read-char-exclusive))) 896 ;;(setq ch (read-char-exclusive))
897 (setq ch (aref (read-key-sequence nil) 0))
898 )
896 (insert ch)) 899 (insert ch))
897 ) 900 )
898 (setq last-command-event 901 (setq last-command-event
@@ -1730,20 +1733,34 @@ invokes the command before that, etc."
1730 1733
1731;; undoing 1734;; undoing
1732 1735
1736;; hook used inside undo
1737(defvar viper-undo-functions nil)
1738
1739;; Runs viper-before-change-functions inside before-change-functions
1740(defun viper-undo-sentinel (beg end length)
1741 (run-hook-with-args 'viper-undo-functions beg end length))
1742
1743(add-hook 'after-change-functions 'viper-undo-sentinel)
1744
1745;; Hook used in viper-undo
1746(defun viper-after-change-undo-hook (beg end len)
1747 (setq undo-beg-posn beg
1748 undo-end-posn (or end beg))
1749 ;; some other hooks may be changing various text properties in
1750 ;; the buffer in response to 'undo'; so remove this hook to avoid
1751 ;; its repeated invocation
1752 (remove-hook 'viper-undo-functions 'viper-after-change-undo-hook 'local))
1753
1733(defun viper-undo () 1754(defun viper-undo ()
1734 "Undo previous change." 1755 "Undo previous change."
1735 (interactive) 1756 (interactive)
1736 (message "undo!") 1757 (message "undo!")
1737 (let ((modified (buffer-modified-p)) 1758 (let ((modified (buffer-modified-p))
1738 (before-undo-pt (point-marker)) 1759 (before-undo-pt (point-marker))
1739 (after-change-functions after-change-functions)
1740 undo-beg-posn undo-end-posn) 1760 undo-beg-posn undo-end-posn)
1741 1761
1742 ;; no need to remove this hook, since this var has scope inside a let. 1762 ;; the viper-after-change-undo-hook removes itself after the 1st invocation
1743 (add-hook 'after-change-functions 1763 (add-hook 'viper-undo-functions 'viper-after-change-undo-hook nil 'local)
1744 '(lambda (beg end len)
1745 (setq undo-beg-posn beg
1746 undo-end-posn (or end beg))))
1747 1764
1748 (undo-start) 1765 (undo-start)
1749 (undo-more 2) 1766 (undo-more 2)
@@ -1765,7 +1782,8 @@ invokes the command before that, etc."
1765 (goto-char undo-beg-posn))) 1782 (goto-char undo-beg-posn)))
1766 (push-mark before-undo-pt t)) 1783 (push-mark before-undo-pt t))
1767 (if (and (eolp) (not (bolp))) (backward-char 1)) 1784 (if (and (eolp) (not (bolp))) (backward-char 1))
1768 (if (not modified) (set-buffer-modified-p t))) 1785 ;;(if (not modified) (set-buffer-modified-p t))
1786 )
1769 (setq this-command 'viper-undo)) 1787 (setq this-command 'viper-undo))
1770 1788
1771;; Continue undoing previous changes. 1789;; Continue undoing previous changes.
@@ -1813,7 +1831,7 @@ invokes the command before that, etc."
1813 (setq viper-undo-needs-adjustment t))))) 1831 (setq viper-undo-needs-adjustment t)))))
1814 1832
1815 1833
1816 1834;;; Viper's destructive Command ring utilities
1817 1835
1818(defun viper-display-current-destructive-command () 1836(defun viper-display-current-destructive-command ()
1819 (let ((text (nth 4 viper-d-com)) 1837 (let ((text (nth 4 viper-d-com))
@@ -1927,12 +1945,15 @@ Undo previous insertion and inserts new."
1927 (end-of-line) 1945 (end-of-line)
1928 ;; make sure all lines end with newline, unless in the minibuffer or 1946 ;; make sure all lines end with newline, unless in the minibuffer or
1929 ;; when requested otherwise (require-final-newline is nil) 1947 ;; when requested otherwise (require-final-newline is nil)
1930 (if (and (eobp) 1948 (save-restriction
1931 (not (bolp)) 1949 (widen)
1932 require-final-newline 1950 (if (and (eobp)
1933 (not (viper-is-in-minibuffer)) 1951 (not (bolp))
1934 (not buffer-read-only)) 1952 require-final-newline
1935 (insert "\n")))) 1953 (not (viper-is-in-minibuffer))
1954 (not buffer-read-only))
1955 (insert "\n")))
1956 ))
1936 1957
1937(defun viper-yank-defun () 1958(defun viper-yank-defun ()
1938 (mark-defun) 1959 (mark-defun)
@@ -3045,19 +3066,34 @@ On reaching beginning of line, stop and signal error."
3045 (setq this-command 'next-line) 3066 (setq this-command 'next-line)
3046 (if com (viper-execute-com 'viper-next-line val com)))) 3067 (if com (viper-execute-com 'viper-next-line val com))))
3047 3068
3069
3048(defun viper-next-line-at-bol (arg) 3070(defun viper-next-line-at-bol (arg)
3049 "Next line at beginning of line." 3071 "Next line at beginning of line.
3072If point is on a widget or a button, simulate clicking on that widget/button."
3050 (interactive "P") 3073 (interactive "P")
3051 (viper-leave-region-active) 3074 (let* ((field (get-char-property (point) 'field))
3052 (save-excursion 3075 (button (get-char-property (point) 'button))
3053 (end-of-line) 3076 (doc (get-char-property (point) 'widget-doc))
3054 (if (eobp) (error "Last line in buffer"))) 3077 (widget (or field button doc)))
3055 (let ((val (viper-p-val arg)) 3078 (if (and widget
3056 (com (viper-getCom arg))) 3079 (if (symbolp widget)
3057 (if com (viper-move-marker-locally 'viper-com-point (point))) 3080 (get widget 'widget-type)
3058 (forward-line val) 3081 (and (consp widget)
3059 (back-to-indentation) 3082 (get (widget-type widget) 'widget-type))))
3060 (if com (viper-execute-com 'viper-next-line-at-bol val com)))) 3083 (widget-button-press (point))
3084 (if (button-at (point))
3085 (push-button)
3086 ;; not a widget or a button
3087 (viper-leave-region-active)
3088 (save-excursion
3089 (end-of-line)
3090 (if (eobp) (error "Last line in buffer")))
3091 (let ((val (viper-p-val arg))
3092 (com (viper-getCom arg)))
3093 (if com (viper-move-marker-locally 'viper-com-point (point)))
3094 (forward-line val)
3095 (back-to-indentation)
3096 (if com (viper-execute-com 'viper-next-line-at-bol val com)))))))
3061 3097
3062 3098
3063(defun viper-previous-line (arg) 3099(defun viper-previous-line (arg)
diff --git a/lisp/emulation/viper-util.el b/lisp/emulation/viper-util.el
index c7fe792b5f2..252088a476d 100644
--- a/lisp/emulation/viper-util.el
+++ b/lisp/emulation/viper-util.el
@@ -139,8 +139,8 @@
139 139
140(defsubst viper-get-cursor-color () 140(defsubst viper-get-cursor-color ()
141 (viper-cond-compile-for-xemacs-or-emacs 141 (viper-cond-compile-for-xemacs-or-emacs
142 ;; xemacs 142 (color-instance-name
143 (color-instance-name (frame-property (selected-frame) 'cursor-color)) 143 (frame-property (selected-frame) 'cursor-color)) ; xemacs
144 (cdr (assoc 'cursor-color (frame-parameters))) ; emacs 144 (cdr (assoc 'cursor-color (frame-parameters))) ; emacs
145 )) 145 ))
146 146
diff --git a/lisp/emulation/viper.el b/lisp/emulation/viper.el
index fc55d291550..8f858526da3 100644
--- a/lisp/emulation/viper.el
+++ b/lisp/emulation/viper.el
@@ -534,6 +534,10 @@ If Viper is enabled, turn it off. Otherwise, turn it on."
534(defun viper-mode () 534(defun viper-mode ()
535 "Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Viper'." 535 "Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Viper'."
536 (interactive) 536 (interactive)
537 (if (null viper-vi-state-cursor-color)
538 (modify-frame-parameters
539 (selected-frame)
540 (list (cons 'viper-vi-state-cursor-color (viper-get-cursor-color)))))
537 (if (not noninteractive) 541 (if (not noninteractive)
538 (progn 542 (progn
539 ;; if the user requested viper-mode explicitly 543 ;; if the user requested viper-mode explicitly
@@ -545,8 +549,6 @@ If Viper is enabled, turn it off. Otherwise, turn it on."
545 (if viper-first-time ; Important check. Prevents mix-up of startup 549 (if viper-first-time ; Important check. Prevents mix-up of startup
546 (progn ; and expert-level msgs when viper-mode recurses 550 (progn ; and expert-level msgs when viper-mode recurses
547 (setq viper-first-time nil) 551 (setq viper-first-time nil)
548 (setq viper-vi-state-cursor-color
549 (viper-get-cursor-color))
550 (if (not viper-inhibit-startup-message) 552 (if (not viper-inhibit-startup-message)
551 (save-window-excursion 553 (save-window-excursion
552 (setq viper-inhibit-startup-message t) 554 (setq viper-inhibit-startup-message t)
diff --git a/lisp/files.el b/lisp/files.el
index 3313f003d89..8a5a331da71 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -1514,23 +1514,53 @@ the various files."
1514 ;; hexl-mode. 1514 ;; hexl-mode.
1515 (not (eq major-mode 'hexl-mode))) 1515 (not (eq major-mode 'hexl-mode)))
1516 (if (buffer-modified-p) 1516 (if (buffer-modified-p)
1517 (if (y-or-n-p (if rawfile 1517 (if (y-or-n-p
1518 "Save file and revisit literally? " 1518 (format
1519 "Save file and revisit non-literally? ")) 1519 (if rawfile
1520 "The file %s is already visited normally,
1521and you have edited the buffer. Now you have asked to visit it literally,
1522meaning no coding system handling, format conversion, or local variables.
1523Emacs can only visit a file in one way at a time.
1524
1525Do you want to save the file, and visit it literally instead? "
1526 "The file %s is already visited literally,
1527meaning no coding system handling, format conversion, or local variables.
1528You have edited the buffer. Now you have asked to visit the file normally,
1529but Emacs can only visit a file in one way at a time.
1530
1531Do you want to save the file, and visit it normally instead? ")
1532 (file-name-nondirectory filename)))
1520 (progn 1533 (progn
1521 (save-buffer) 1534 (save-buffer)
1522 (find-file-noselect-1 buf filename nowarn 1535 (find-file-noselect-1 buf filename nowarn
1523 rawfile truename number)) 1536 rawfile truename number))
1524 (if (y-or-n-p (if rawfile 1537 (if (y-or-n-p
1525 "Discard your edits and revisit file literally? " 1538 (format
1526 "Discard your edits and revisit file non-literally? ")) 1539 (if rawfile
1540 "\
1541Do you want to discard your changes, and visit the file literally now? "
1542 "\
1543Do you want to discard your changes, and visit the file normally now? ")))
1527 (find-file-noselect-1 buf filename nowarn 1544 (find-file-noselect-1 buf filename nowarn
1528 rawfile truename number) 1545 rawfile truename number)
1529 (error (if rawfile "File already visited non-literally" 1546 (error (if rawfile "File already visited non-literally"
1530 "File already visited literally")))) 1547 "File already visited literally"))))
1531 (if (y-or-n-p (if rawfile 1548 (if (y-or-n-p
1532 "Revisit file literally? " 1549 (format
1533 "Revisit file non-literally? ")) 1550 (if rawfile
1551 "The file %s is already visited normally.
1552You have asked to visit it literally,
1553meaning no coding system decoding, format conversion, or local variables.
1554But Emacs can only visit a file in one way at a time.
1555
1556Do you want to revisit the file literally now? "
1557 "The file %s is already visited literally,
1558meaning no coding system decoding, format conversion, or local variables.
1559You have asked to visit it normally,
1560but Emacs can only visit a file in one way at a time.
1561
1562Do you want to revisit the file normally now? ")
1563 (file-name-nondirectory filename)))
1534 (find-file-noselect-1 buf filename nowarn 1564 (find-file-noselect-1 buf filename nowarn
1535 rawfile truename number) 1565 rawfile truename number)
1536 (error (if rawfile "File already visited non-literally" 1566 (error (if rawfile "File already visited non-literally"
@@ -3631,7 +3661,8 @@ Before and after saving the buffer, this function runs
3631 ;; Since we have created an entirely new file, 3661 ;; Since we have created an entirely new file,
3632 ;; make sure it gets the right permission bits set. 3662 ;; make sure it gets the right permission bits set.
3633 (setq setmodes (or setmodes 3663 (setq setmodes (or setmodes
3634 (cons (or (file-modes buffer-file-name) umask) 3664 (cons (or (file-modes buffer-file-name)
3665 (logand ?\666 umask))
3635 buffer-file-name))) 3666 buffer-file-name)))
3636 ;; We succeeded in writing the temp file, 3667 ;; We succeeded in writing the temp file,
3637 ;; so rename it. 3668 ;; so rename it.
diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog
index 1899fd9d845..60a7e6b1e8b 100644
--- a/lisp/gnus/ChangeLog
+++ b/lisp/gnus/ChangeLog
@@ -1,3 +1,7 @@
12006-06-19 Katsumi Yamaoka <yamaoka@jpl.org>
2
3 * message.el (message-syntax-checks): Doc fix.
4
12006-06-16 Katsumi Yamaoka <yamaoka@jpl.org> 52006-06-16 Katsumi Yamaoka <yamaoka@jpl.org>
2 6
3 * message.el (message-syntax-checks): Doc fix. 7 * message.el (message-syntax-checks): Doc fix.
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index 91ac018f324..4ee87933967 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -194,7 +194,7 @@ Checks include `approved', `continuation-headers', `control-chars',
194`empty', `existing-newsgroups', `from', `illegible-text', 194`empty', `existing-newsgroups', `from', `illegible-text',
195`invisible-text', `long-header-lines', `long-lines', `message-id', 195`invisible-text', `long-header-lines', `long-lines', `message-id',
196`multiple-headers', `new-text', `newsgroups', `quoting-style', 196`multiple-headers', `new-text', `newsgroups', `quoting-style',
197`repeated-newsgroups', `reply-to', `sendsys', `shoot', 197`repeated-newsgroups', `reply-to', `sender', `sendsys', `shoot',
198`shorten-followup-to', `signature', `size', `subject', `subject-cmsg' 198`shorten-followup-to', `signature', `size', `subject', `subject-cmsg'
199and `valid-newsgroups'." 199and `valid-newsgroups'."
200 :group 'message-news 200 :group 'message-news
diff --git a/lisp/international/characters.el b/lisp/international/characters.el
index 9b2b244d6ea..26d6cd93439 100644
--- a/lisp/international/characters.el
+++ b/lisp/international/characters.el
@@ -1078,7 +1078,10 @@
1078 char-script-table) 1078 char-script-table)
1079 1079
1080(setq word-combining-categories 1080(setq word-combining-categories
1081 '((?l . ?l))) 1081 '((?l . ?l)
1082 (?C . ?C)
1083 (?C . ?H)
1084 (?C . ?K)))
1082 1085
1083(setq word-separating-categories ; (2-byte character sets) 1086(setq word-separating-categories ; (2-byte character sets)
1084 '((?A . ?K) ; Alpha numeric - Katakana 1087 '((?A . ?K) ; Alpha numeric - Katakana
diff --git a/lisp/mouse.el b/lisp/mouse.el
index c399515a3d2..145eb76446f 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -529,6 +529,24 @@ resized by dragging their header-line."
529 (mouse-drag-mode-line-1 start-event nil)))) 529 (mouse-drag-mode-line-1 start-event nil))))
530 530
531 531
532(defun mouse-drag-vertical-line-rightward-window (window)
533 "Return a window that is immediately to the right of WINDOW, or nil."
534 (let ((bottom (nth 3 (window-inside-edges window)))
535 (left (nth 0 (window-inside-edges window)))
536 best best-right
537 (try (previous-window window)))
538 (while (not (eq try window))
539 (let ((try-top (nth 1 (window-inside-edges try)))
540 (try-bottom (nth 3 (window-inside-edges try)))
541 (try-right (nth 2 (window-inside-edges try))))
542 (if (and (< try-top bottom)
543 (>= try-bottom bottom)
544 (< try-right left)
545 (or (null best-right) (> try-right best-right)))
546 (setq best-right try-right best try)))
547 (setq try (previous-window try)))
548 best))
549
532(defun mouse-drag-vertical-line (start-event) 550(defun mouse-drag-vertical-line (start-event)
533 "Change the width of a window by dragging on the vertical line." 551 "Change the width of a window by dragging on the vertical line."
534 (interactive "e") 552 (interactive "e")
@@ -594,7 +612,8 @@ resized by dragging their header-line."
594 ;; adjust the window on the left. 612 ;; adjust the window on the left.
595 (if (eq which-side 'right) 613 (if (eq which-side 'right)
596 (selected-window) 614 (selected-window)
597 (previous-window)))) 615 (mouse-drag-vertical-line-rightward-window
616 (selected-window)))))
598 (setq x (- (car (cdr mouse)) 617 (setq x (- (car (cdr mouse))
599 (if (eq which-side 'right) 0 2)) 618 (if (eq which-side 'right) 0 2))
600 edges (window-edges window) 619 edges (window-edges window)
diff --git a/lisp/textmodes/org.el b/lisp/textmodes/org.el
index dd4dfc1a857..c4e739fdf77 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.36b 8;; Version: 4.38
9;; 9;;
10;; This file is part of GNU Emacs. 10;; This file is part of GNU Emacs.
11;; 11;;
@@ -90,6 +90,14 @@
90;; 90;;
91;; Recent changes 91;; Recent changes
92;; -------------- 92;; --------------
93;; Version 4.38
94;; - noutline.el is now required (important for XEmacs users only).
95;; - Dynamic blocks.
96;; - Archiving of all level 1 trees without open TODO items.
97;; - Clock reports can be inserted into the file in a special section.
98;; - FAQ removed from the manual, now only on the web.
99;; - Bug fixes.
100;;
93;; Version 4.37 101;; Version 4.37
94;; - Clock-feature for measuring time spent on specific items. 102;; - Clock-feature for measuring time spent on specific items.
95;; - Improved emphasizing allows configuration and stacking. 103;; - Improved emphasizing allows configuration and stacking.
@@ -170,13 +178,18 @@
170(eval-when-compile 178(eval-when-compile
171 (require 'cl) 179 (require 'cl)
172 (require 'calendar)) 180 (require 'calendar))
173(require 'outline) 181;; For XEmacs, noutline is not yet provided by outline.el, so arrange for
182;; the file noutline.el being loaded.
183(if (featurep 'xemacs) (condition-case nil (require 'noutline)))
184;; We require noutline, which might be provided in outline.el
185(require 'outline) (require 'noutline)
186;; Other stuff we need.
174(require 'time-date) 187(require 'time-date)
175(require 'easymenu) 188(require 'easymenu)
176 189
177;;; Customization variables 190;;; Customization variables
178 191
179(defvar org-version "4.36b" 192(defvar org-version "4.38"
180 "The version number of the file org.el.") 193 "The version number of the file org.el.")
181(defun org-version () 194(defun org-version ()
182 (interactive) 195 (interactive)
@@ -2202,7 +2215,7 @@ stacked Non-nil means, allow stacked styles. This works only in HTML
2202 `org-emphasis-alist') will be allowed as pre/post, aiding 2215 `org-emphasis-alist') will be allowed as pre/post, aiding
2203 inside-out matching. 2216 inside-out matching.
2204Use customize to modify this, or restart emacs after changing it." 2217Use customize to modify this, or restart emacs after changing it."
2205 :group 'org-fixme 2218 :group 'org-font-lock
2206 :set 'org-set-emph-re 2219 :set 'org-set-emph-re
2207 :type '(list 2220 :type '(list
2208 (sexp :tag "Allowed chars in pre ") 2221 (sexp :tag "Allowed chars in pre ")
@@ -2216,19 +2229,23 @@ Use customize to modify this, or restart emacs after changing it."
2216 '(("*" bold "<b>" "</b>") 2229 '(("*" bold "<b>" "</b>")
2217 ("/" italic "<i>" "</i>") 2230 ("/" italic "<i>" "</i>")
2218 ("_" underline "<u>" "</u>") 2231 ("_" underline "<u>" "</u>")
2219 ("=" shadow "<code>" "</code>")) 2232 ("=" shadow "<code>" "</code>")
2233 ("+" (:strike-through t) "<del>" "</del>")
2234)
2220"Special syntax for emphasised text. 2235"Special syntax for emphasised text.
2221Text starting and ending with a special character will be emphasized, for 2236Text starting and ending with a special character will be emphasized, for
2222example *bold*, _underlined_ and /italic/. This variable sets the marker 2237example *bold*, _underlined_ and /italic/. This variable sets the marker
2223characters, the face to bbe used by font-lock for highlighting in Org-mode 2238characters, the face to bbe used by font-lock for highlighting in Org-mode
2224emacs buffers, and the HTML tags to be used for this. 2239emacs buffers, and the HTML tags to be used for this.
2225Use customize to modify this, or restart emacs after changing it." 2240Use customize to modify this, or restart emacs after changing it."
2226 :group 'org-fixme 2241 :group 'org-font-lock
2227 :set 'org-set-emph-re 2242 :set 'org-set-emph-re
2228 :type '(repeat 2243 :type '(repeat
2229 (list 2244 (list
2230 (string :tag "Marker character") 2245 (string :tag "Marker character")
2231 (face :tag "Font-lock-face") 2246 (choice
2247 (face :tag "Font-lock-face")
2248 (plist :tag "Face property list"))
2232 (string :tag "HTML start tag") 2249 (string :tag "HTML start tag")
2233 (string :tag "HTML end tag")))) 2250 (string :tag "HTML end tag"))))
2234 2251
@@ -2708,6 +2725,7 @@ Also put tags into group 4 if tags are present.")
2708(defvar gnus-group-name) ; from gnus 2725(defvar gnus-group-name) ; from gnus
2709(defvar gnus-article-current) ; from gnus 2726(defvar gnus-article-current) ; from gnus
2710(defvar w3m-current-url) ; from w3m 2727(defvar w3m-current-url) ; from w3m
2728(defvar w3m-current-title) ; from w3m
2711(defvar mh-progs) ; from MH-E 2729(defvar mh-progs) ; from MH-E
2712(defvar mh-current-folder) ; from MH-E 2730(defvar mh-current-folder) ; from MH-E
2713(defvar mh-show-folder-buffer) ; from MH-E 2731(defvar mh-show-folder-buffer) ; from MH-E
@@ -2823,8 +2841,10 @@ The following commands are available:
2823 (insert " -*- mode: org -*-\n\n")) 2841 (insert " -*- mode: org -*-\n\n"))
2824 2842
2825 (unless org-inhibit-startup 2843 (unless org-inhibit-startup
2826 (if org-startup-align-all-tables 2844 (when org-startup-align-all-tables
2827 (org-table-map-tables 'org-table-align)) 2845 (let ((bmp (buffer-modified-p)))
2846 (org-table-map-tables 'org-table-align)
2847 (set-buffer-modified-p bmp)))
2828 (if org-startup-with-deadline-check 2848 (if org-startup-with-deadline-check
2829 (call-interactively 'org-check-deadlines) 2849 (call-interactively 'org-check-deadlines)
2830 (cond 2850 (cond
@@ -3722,9 +3742,7 @@ in the region."
3722 (replace-match up-head nil t) 3742 (replace-match up-head nil t)
3723 ;; Fixup tag positioning 3743 ;; Fixup tag positioning
3724 (and org-auto-align-tags (org-set-tags nil t)) 3744 (and org-auto-align-tags (org-set-tags nil t))
3725 (if org-adapt-indentation 3745 (if org-adapt-indentation (org-fixup-indentation (- diff)))))
3726 (org-fixup-indentation (if (> diff 1) "^ " "^ ") ""
3727 (if (> diff 1) "^ ? ?\\S-" "^ ?\\S-")))))
3728 3746
3729(defun org-demote () 3747(defun org-demote ()
3730 "Demote the current heading lower down the tree. 3748 "Demote the current heading lower down the tree.
@@ -3737,8 +3755,7 @@ in the region."
3737 (replace-match down-head nil t) 3755 (replace-match down-head nil t)
3738 ;; Fixup tag positioning 3756 ;; Fixup tag positioning
3739 (and org-auto-align-tags (org-set-tags nil t)) 3757 (and org-auto-align-tags (org-set-tags nil t))
3740 (if org-adapt-indentation 3758 (if org-adapt-indentation (org-fixup-indentation diff))))
3741 (org-fixup-indentation "^ " (if (> diff 1) " " " ") "^\\S-"))))
3742 3759
3743(defun org-map-tree (fun) 3760(defun org-map-tree (fun)
3744 "Call FUN for every heading underneath the current one." 3761 "Call FUN for every heading underneath the current one."
@@ -3767,20 +3784,23 @@ in the region."
3767 (not (eobp))) 3784 (not (eobp)))
3768 (funcall fun))))) 3785 (funcall fun)))))
3769 3786
3770;; FIXME: this does not work well with Tabulators. This has to be re-written entirely. 3787(defun org-fixup-indentation (diff)
3771(defun org-fixup-indentation (from to prohibit) 3788 "Change the indentation in the current entry by DIFF
3772 "Change the indentation in the current entry by re-replacing FROM with TO. 3789However, if any line in the current entry has no indentation, or if it
3773However, if the regexp PROHIBIT matches at all, don't do anything. 3790would end up with no indentation after the change, nothing at all is done."
3774This is being used to change indentation along with the length of the
3775heading marker. But if there are any lines which are not indented, nothing
3776is changed at all."
3777 (save-excursion 3791 (save-excursion
3778 (let ((end (save-excursion (outline-next-heading) 3792 (let ((end (save-excursion (outline-next-heading)
3779 (point-marker)))) 3793 (point-marker)))
3794 (prohibit (if (> diff 0)
3795 "^\\S-"
3796 (concat "^ \\{0," (int-to-string (- diff)) "\\}\\S-")))
3797 col)
3780 (unless (save-excursion (re-search-forward prohibit end t)) 3798 (unless (save-excursion (re-search-forward prohibit end t))
3781 (while (re-search-forward from end t) 3799 (while (re-search-forward "^[ \t]+" end t)
3782 (replace-match to) 3800 (goto-char (match-end 0))
3783 (beginning-of-line 2))) 3801 (setq col (current-column))
3802 (if (< diff 0) (replace-match ""))
3803 (indent-to (+ diff col))))
3784 (move-marker end nil)))) 3804 (move-marker end nil))))
3785 3805
3786;;; Vertical tree motion, cutting and pasting of subtrees 3806;;; Vertical tree motion, cutting and pasting of subtrees
@@ -3984,6 +4004,14 @@ If optional TXT is given, check this string instead of the current kill."
3984 (throw 'exit nil))) 4004 (throw 'exit nil)))
3985 t)))) 4005 t))))
3986 4006
4007(defun org-narrow-to-subtree ()
4008 "Narrow buffer to the current subtree."
4009 (interactive)
4010 (save-excursion
4011 (narrow-to-region
4012 (progn (org-back-to-heading) (point))
4013 (progn (org-end-of-subtree t) (point)))))
4014
3987;;; Plain list items 4015;;; Plain list items
3988 4016
3989(defun org-at-item-p () 4017(defun org-at-item-p ()
@@ -4292,103 +4320,259 @@ with something like \"1.\" or \"2)\"."
4292 4320
4293;;; Archiving 4321;;; Archiving
4294 4322
4295(defun org-archive-subtree () 4323(defun org-archive-subtree (&optional find-done)
4296 "Move the current subtree to the archive. 4324 "Move the current subtree to the archive.
4297The archive can be a certain top-level heading in the current file, or in 4325The archive can be a certain top-level heading in the current file, or in
4298a different file. The tree will be moved to that location, the subtree 4326a different file. The tree will be moved to that location, the subtree
4299heading be marked DONE, and the current time will be added." 4327heading be marked DONE, and the current time will be added.
4300 (interactive) 4328
4301 ;; Save all relevant TODO keyword-relatex variables 4329When called with prefix argument FIND-DONE, find whole trees without any
4302 (let ((tr-org-todo-line-regexp org-todo-line-regexp) ; keep despite compiler 4330open TODO items and archive them (after getting confirmation from the user).
4303 (tr-org-todo-keywords org-todo-keywords) 4331If the cursor is not at a headline when this comand is called, try all level
4304 (tr-org-todo-interpretation org-todo-interpretation) 43321 trees. If the cursor is on a headline, only try the direct children of
4305 (tr-org-done-string org-done-string) 4333this heading. "
4306 (tr-org-todo-regexp org-todo-regexp) 4334 (interactive "P")
4307 (tr-org-todo-line-regexp org-todo-line-regexp) 4335 (if find-done
4308 (this-buffer (current-buffer)) 4336 (org-archive-all-done)
4309 file heading buffer level newfile-p) 4337 ;; Save all relevant TODO keyword-relatex variables
4310 (if (string-match "\\(.*\\)::\\(.*\\)" org-archive-location) 4338
4339 (let ((tr-org-todo-line-regexp org-todo-line-regexp) ; keep despite compiler
4340 (tr-org-todo-keywords org-todo-keywords)
4341 (tr-org-todo-interpretation org-todo-interpretation)
4342 (tr-org-done-string org-done-string)
4343 (tr-org-todo-regexp org-todo-regexp)
4344 (tr-org-todo-line-regexp org-todo-line-regexp)
4345 (this-buffer (current-buffer))
4346 file heading buffer level newfile-p)
4347 (if (string-match "\\(.*\\)::\\(.*\\)" org-archive-location)
4348 (progn
4349 (setq file (format (match-string 1 org-archive-location)
4350 (file-name-nondirectory buffer-file-name))
4351 heading (match-string 2 org-archive-location)))
4352 (error "Invalid `org-archive-location'"))
4353 (if (> (length file) 0)
4354 (setq newfile-p (not (file-exists-p file))
4355 buffer (find-file-noselect file))
4356 (setq buffer (current-buffer)))
4357 (unless buffer
4358 (error "Cannot access file \"%s\"" file))
4359 (if (and (> (length heading) 0)
4360 (string-match "^\\*+" heading))
4361 (setq level (match-end 0))
4362 (setq heading nil level 0))
4363 (save-excursion
4364 ;; We first only copy, in case something goes wrong
4365 ;; we need to protect this-command, to avoid kill-region sets it,
4366 ;; which would lead to duplication of subtrees
4367 (let (this-command) (org-copy-subtree))
4368 (set-buffer buffer)
4369 ;; Enforce org-mode for the archive buffer
4370 (if (not (eq major-mode 'org-mode))
4371 ;; Force the mode for future visits.
4372 (let ((org-insert-mode-line-in-empty-file t))
4373 (call-interactively 'org-mode)))
4374 (when newfile-p
4375 (goto-char (point-max))
4376 (insert (format "\nArchived entries from file %s\n\n"
4377 (buffer-file-name this-buffer))))
4378 ;; Force the TODO keywords of the original buffer
4379 (let ((org-todo-line-regexp tr-org-todo-line-regexp)
4380 (org-todo-keywords tr-org-todo-keywords)
4381 (org-todo-interpretation tr-org-todo-interpretation)
4382 (org-done-string tr-org-done-string)
4383 (org-todo-regexp tr-org-todo-regexp)
4384 (org-todo-line-regexp tr-org-todo-line-regexp))
4385 (goto-char (point-min))
4386 (if heading
4387 (progn
4388 (if (re-search-forward
4389 (concat "\\(^\\|\r\\)"
4390 (regexp-quote heading) "[ \t]*\\($\\|\r\\)")
4391 nil t)
4392 (goto-char (match-end 0))
4393 ;; Heading not found, just insert it at the end
4394 (goto-char (point-max))
4395 (or (bolp) (insert "\n"))
4396 (insert "\n" heading "\n")
4397 (end-of-line 0))
4398 ;; Make the subtree visible
4399 (show-subtree)
4400 (org-end-of-subtree t)
4401 (skip-chars-backward " \t\r\n]")
4402 (and (looking-at "[ \t\r\n]*")
4403 (replace-match "\n\n")))
4404 ;; No specific heading, just go to end of file.
4405 (goto-char (point-max)) (insert "\n"))
4406 ;; Paste
4407 (org-paste-subtree (1+ level))
4408 ;; Mark the entry as done, i.e. set to last work in org-todo-keywords
4409 (if org-archive-mark-done
4410 (org-todo (length org-todo-keywords)))
4411 ;; Move cursor to right after the TODO keyword
4412 (when org-archive-stamp-time
4413 (beginning-of-line 1)
4414 (looking-at org-todo-line-regexp)
4415 (goto-char (or (match-end 2) (match-beginning 3)))
4416 (insert "(" (format-time-string (cdr org-time-stamp-formats)
4417 (org-current-time))
4418 ")"))
4419 ;; Save the buffer, if it is not the same buffer.
4420 (if (not (eq this-buffer buffer)) (save-buffer))))
4421 ;; Here we are back in the original buffer. Everything seems to have
4422 ;; worked. So now cut the tree and finish up.
4423 (let (this-command) (org-cut-subtree))
4424 (if (and (not (eobp)) (looking-at "[ \t]*$")) (kill-line))
4425 (message "Subtree archived %s"
4426 (if (eq this-buffer buffer)
4427 (concat "under heading: " heading)
4428 (concat "in file: " (abbreviate-file-name file)))))))
4429
4430(defun org-archive-all-done ()
4431 "Archive sublevels of the current tree without open TODO items.
4432If the cursor is not on a headline, try all level 1 trees. If
4433it is on a headline, try all direct children."
4434 (let ((re (concat "^\\*+ +" org-not-done-regexp)) re1
4435 (begm (make-marker))
4436 (endm (make-marker))
4437 beg end (cntarch 0))
4438 (if (org-on-heading-p)
4311 (progn 4439 (progn
4312 (setq file (format (match-string 1 org-archive-location) 4440 (setq re1 (concat "^" (regexp-quote
4313 (file-name-nondirectory buffer-file-name)) 4441 (make-string
4314 heading (match-string 2 org-archive-location))) 4442 (1+ (- (match-end 0) (match-beginning 0)))
4315 (error "Invalid `org-archive-location'")) 4443 ?*))
4316 (if (> (length file) 0) 4444 " "))
4317 (setq newfile-p (not (file-exists-p file)) 4445 (move-marker begm (point))
4318 buffer (find-file-noselect file)) 4446 (move-marker endm (org-end-of-subtree)))
4319 (setq buffer (current-buffer))) 4447 (setq re1 "^* ")
4320 (unless buffer 4448 (move-marker begm (point-min))
4321 (error "Cannot access file \"%s\"" file)) 4449 (move-marker endm (point-max)))
4322 (if (and (> (length heading) 0)
4323 (string-match "^\\*+" heading))
4324 (setq level (match-end 0))
4325 (setq heading nil level 0))
4326 (save-excursion 4450 (save-excursion
4327 ;; We first only copy, in case something goes wrong 4451 (goto-char begm)
4328 ;; we need to protect this-command, to avoid kill-region sets it, 4452 (while (re-search-forward re1 endm t)
4329 ;; which would lead to duplication of subtrees 4453 beg (match-beginning 0)
4330 (let (this-command) (org-copy-subtree)) 4454 end (save-excursion (org-end-of-subtree t) (point)))
4331 (set-buffer buffer) 4455 (goto-char beg)
4332 ;; Enforce org-mode for the archive buffer 4456 (if (re-search-forward re end t)
4333 (if (not (eq major-mode 'org-mode)) 4457 (goto-char end)
4334 ;; Force the mode for future visits. 4458 (goto-char beg)
4335 (let ((org-insert-mode-line-in-empty-file t)) 4459 (if (y-or-n-p "Archive this subtree (no open TODO items)? ")
4336 (call-interactively 'org-mode))) 4460 (progn
4337 (when newfile-p 4461 (org-archive-subtree)
4338 (goto-char (point-max)) 4462 (setq cntarch (1+ cntarch)))
4339 (insert (format "\nArchived entries from file %s\n\n" 4463 (goto-char end))))
4340 (buffer-file-name this-buffer)))) 4464 (message "%d trees archived" cntarch)))
4341 ;; Force the TODO keywords of the original buffer 4465
4342 (let ((org-todo-line-regexp tr-org-todo-line-regexp) 4466;;; Dynamic blocks
4343 (org-todo-keywords tr-org-todo-keywords) 4467
4344 (org-todo-interpretation tr-org-todo-interpretation) 4468(defun org-find-dblock (name)
4345 (org-done-string tr-org-done-string) 4469 "Find the first dynamic block with name NAME in the buffer.
4346 (org-todo-regexp tr-org-todo-regexp) 4470If not found, stay at current position and return nil."
4347 (org-todo-line-regexp tr-org-todo-line-regexp)) 4471 (let (pos)
4348 (goto-char (point-min)) 4472 (save-excursion
4349 (if heading 4473 (goto-char (point-min))
4350 (progn 4474 (setq pos (and (re-search-forward (concat "^#\\+BEGIN:[ \t]+" name "\\>")
4351 (if (re-search-forward 4475 nil t)
4352 (concat "\\(^\\|\r\\)" 4476 (match-beginning 0))))
4353 (regexp-quote heading) "[ \t]*\\($\\|\r\\)") 4477 (if pos (goto-char pos))
4354 nil t) 4478 pos))
4355 (goto-char (match-end 0)) 4479
4356 ;; Heading not found, just insert it at the end 4480(defconst org-dblock-start-re
4357 (goto-char (point-max)) 4481 "^#\\+BEGIN:[ \t]+\\(\\S-+\\)[ \t]+\\(.*\\)"
4358 (or (bolp) (insert "\n")) 4482 "Matches the startline of a dynamic block, with parameters.")
4359 (insert "\n" heading "\n") 4483
4360 (end-of-line 0)) 4484(defconst org-dblock-end-re "^#\\+END\\([: \t\r\n]\\|$\\)"
4361 ;; Make the subtree visible 4485 "Matches the end of a dyhamic block.")
4362 (show-subtree) 4486
4363 (org-end-of-subtree t) 4487(defun org-create-dblock (plist)
4364 (skip-chars-backward " \t\r\n]") 4488 "Create a dynamic block section, with parameters taken from PLIST.
4365 (and (looking-at "[ \t\r\n]*") 4489PLIST must containe a :name entry which is used as name of the block."
4366 (replace-match "\n\n"))) 4490 (unless (bolp) (newline))
4367 ;; No specific heading, just go to end of file. 4491 (let ((name (plist-get plist :name)))
4368 (goto-char (point-max)) (insert "\n")) 4492 (insert "#+BEGIN: " name)
4369 ;; Paste 4493 (while plist
4370 (org-paste-subtree (1+ level)) 4494 (if (eq (car plist) :name)
4371 ;; Mark the entry as done, i.e. set to last work in org-todo-keywords 4495 (setq plist (cddr plist))
4372 (if org-archive-mark-done 4496 (insert " " (prin1-to-string (pop plist)))))
4373 (org-todo (length org-todo-keywords))) 4497 (insert "\n\n#+END:\n")
4374 ;; Move cursor to right after the TODO keyword 4498 (beginning-of-line -2)))
4375 (when org-archive-stamp-time 4499
4376 (beginning-of-line 1) 4500(defun org-prepare-dblock ()
4377 (looking-at org-todo-line-regexp) 4501 "Prepare dynamic block for refresh.
4378 (goto-char (or (match-end 2) (match-beginning 3))) 4502This empties the block, puts the cursor at the insert position and returns
4379 (insert "(" (format-time-string (cdr org-time-stamp-formats) 4503the property list including an extra property :name with the block name."
4380 (org-current-time)) 4504 (unless (looking-at org-dblock-start-re)
4381 ")")) 4505 (error "Not at a dynamic block"))
4382 ;; Save the buffer, if it is not the same buffer. 4506 (let* ((beg (match-beginning 0))
4383 (if (not (eq this-buffer buffer)) (save-buffer)))) 4507 (begdel (1+ (match-end 0)))
4384 ;; Here we are back in the original buffer. Everything seems to have 4508 (name (match-string 1))
4385 ;; worked. So now cut the tree and finish up. 4509 (params (append (list :name name)
4386 (let (this-command) (org-cut-subtree)) 4510 (read (concat "(" (match-string 2) ")")))))
4387 (if (and (not (eobp)) (looking-at "[ \t]*$")) (kill-line)) 4511 (unless (re-search-forward org-dblock-end-re nil t)
4388 (message "Subtree archived %s" 4512 (error "Dynamic block not terminated"))
4389 (if (eq this-buffer buffer) 4513 (delete-region begdel (match-beginning 0))
4390 (concat "under heading: " heading) 4514 (goto-char begdel)
4391 (concat "in file: " (abbreviate-file-name file)))))) 4515 (open-line 1)
4516 params))
4517
4518(defun org-map-dblocks (&optional command)
4519 "Apply COMMAND to all dynamic blocks in the current buffer.
4520If COMMAND is not given, use `org-update-dblock'."
4521 (let ((cmd (or command 'org-update-dblock))
4522 pos)
4523 (save-excursion
4524 (goto-char (point-min))
4525 (while (re-search-forward org-dblock-start-re nil t)
4526 (goto-char (setq pos (match-beginning 0)))
4527 (condition-case nil
4528 (funcall cmd)
4529 (error (message "Error during update of dynamic block")))
4530 (goto-char pos)
4531 (unless (re-search-forward org-dblock-end-re nil t)
4532 (error "Dynamic block not terminated"))))))
4533
4534(defun org-dblock-update (&optional arg)
4535 "User command for updating dynamic blocks.
4536Update the dynamic block at point. With prefix ARG, update all dynamic
4537blocks in the buffer."
4538 (interactive "P")
4539 (if arg
4540 (org-update-all-dblocks)
4541 (or (looking-at org-dblock-start-re)
4542 (org-beginning-of-dblock))
4543 (org-update-dblock)))
4544
4545(defun org-update-dblock ()
4546 "Update the dynamic block at point
4547This means to empty the block, parse for parameters and then call
4548the correct writing function."
4549 (let* ((pos (point))
4550 (params (org-prepare-dblock))
4551 (name (plist-get params :name))
4552 (cmd (intern (concat "org-dblock-write:" name))))
4553 (funcall cmd params)
4554 (goto-char pos)))
4555
4556(defun org-beginning-of-dblock ()
4557 "Find the beginning of the dynamic block at point.
4558Error if there is no scuh block at point."
4559 (let ((pos (point))
4560 beg end)
4561 (end-of-line 1)
4562 (if (and (re-search-backward org-dblock-start-re nil t)
4563 (setq beg (match-beginning 0))
4564 (re-search-forward org-dblock-end-re nil t)
4565 (> (match-end 0) pos))
4566 (goto-char beg)
4567 (goto-char pos)
4568 (error "Not in a dynamic block"))))
4569
4570(defun org-update-all-dblocks ()
4571 "Update all dynamic blocks in the buffer.
4572This function can be used in a hook."
4573 (when (eq major-mode 'org-mode)
4574 (org-map-dblocks 'org-update-dblock)))
4575
4392 4576
4393;;; Completion 4577;;; Completion
4394 4578
@@ -4783,16 +4967,18 @@ that the match should indeed be shown."
4783 (org-overlay-put ov 'face 'secondary-selection) 4967 (org-overlay-put ov 'face 'secondary-selection)
4784 (push ov org-occur-highlights))) 4968 (push ov org-occur-highlights)))
4785 4969
4970(defvar org-inhibit-highlight-removal nil)
4786(defun org-remove-occur-highlights (&optional beg end noremove) 4971(defun org-remove-occur-highlights (&optional beg end noremove)
4787 "Remove the occur highlights from the buffer. 4972 "Remove the occur highlights from the buffer.
4788BEG and END are ignored. If NOREMOVE is nil, remove this function 4973BEG and END are ignored. If NOREMOVE is nil, remove this function
4789from the `before-change-functions' in the current buffer." 4974from the `before-change-functions' in the current buffer."
4790 (interactive) 4975 (interactive)
4791 (mapc 'org-delete-overlay org-occur-highlights) 4976 (unless org-inhibit-highlight-removal
4792 (setq org-occur-highlights nil) 4977 (mapc 'org-delete-overlay org-occur-highlights)
4793 (unless noremove 4978 (setq org-occur-highlights nil)
4794 (remove-hook 'before-change-functions 4979 (unless noremove
4795 'org-remove-occur-highlights 'local))) 4980 (remove-hook 'before-change-functions
4981 'org-remove-occur-highlights 'local))))
4796 4982
4797;;; Priorities 4983;;; Priorities
4798 4984
@@ -5449,8 +5635,8 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set."
5449 "Sum the times for each subtree. 5635 "Sum the times for each subtree.
5450Puts the resulting times in minutes as a text property on each headline." 5636Puts the resulting times in minutes as a text property on each headline."
5451 (interactive) 5637 (interactive)
5452 (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t)) 5638 (let* ((bmp (buffer-modified-p))
5453 (let* ((re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" 5639 (re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*"
5454 org-clock-string 5640 org-clock-string
5455 ".*=>[ \t]*\\([0-9]+\\):\\([0-9]+\\)[ \t]*$")) 5641 ".*=>[ \t]*\\([0-9]+\\):\\([0-9]+\\)[ \t]*$"))
5456 (lmax 30) 5642 (lmax 30)
@@ -5458,6 +5644,7 @@ Puts the resulting times in minutes as a text property on each headline."
5458 (t1 0) 5644 (t1 0)
5459 (level 0) 5645 (level 0)
5460 (lastlevel 0) time) 5646 (lastlevel 0) time)
5647 (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t))
5461 (save-excursion 5648 (save-excursion
5462 (goto-char (point-max)) 5649 (goto-char (point-max))
5463 (while (re-search-backward re nil t) 5650 (while (re-search-backward re nil t)
@@ -5475,7 +5662,8 @@ Puts the resulting times in minutes as a text property on each headline."
5475 (aset ltimes l 0)) 5662 (aset ltimes l 0))
5476 (goto-char (match-beginning 0)) 5663 (goto-char (match-beginning 0))
5477 (put-text-property (point) (point-at-eol) :org-clock-minutes time)))) 5664 (put-text-property (point) (point-at-eol) :org-clock-minutes time))))
5478 (setq org-clock-file-total-minutes (aref ltimes 0))))) 5665 (setq org-clock-file-total-minutes (aref ltimes 0)))
5666 (set-buffer-modified-p bmp)))
5479 5667
5480(defun org-clock-display (&optional total-only) 5668(defun org-clock-display (&optional total-only)
5481 "Show subtree times in the entire buffer. 5669 "Show subtree times in the entire buffer.
@@ -5510,11 +5698,11 @@ will be easy to remove."
5510 (off 0) 5698 (off 0)
5511 ov tx) 5699 ov tx)
5512 (move-to-column c) 5700 (move-to-column c)
5513 (if (eolp) (setq off 1))
5514 (unless (eolp) (skip-chars-backward "^ \t")) 5701 (unless (eolp) (skip-chars-backward "^ \t"))
5515 (skip-chars-backward " \t") 5702 (skip-chars-backward " \t")
5516 (setq ov (org-make-overlay (- (point) off) (point-at-eol)) 5703 (setq ov (org-make-overlay (1- (point)) (point-at-eol))
5517 tx (concat (make-string (+ off (max 0 (- c (current-column)))) ?.) 5704 tx (concat (buffer-substring (1- (point)) (point))
5705 (make-string (+ off (max 0 (- c (current-column)))) ?.)
5518 (org-add-props (format "%s %2d:%02d%s" 5706 (org-add-props (format "%s %2d:%02d%s"
5519 (make-string l ?*) h m 5707 (make-string l ?*) h m
5520 (make-string (- 10 l) ?\ )) 5708 (make-string (- 10 l) ?\ ))
@@ -5528,11 +5716,12 @@ will be easy to remove."
5528BEG and END are ignored. If NOREMOVE is nil, remove this function 5716BEG and END are ignored. If NOREMOVE is nil, remove this function
5529from the `before-change-functions' in the current buffer." 5717from the `before-change-functions' in the current buffer."
5530 (interactive) 5718 (interactive)
5531 (mapc 'org-delete-overlay org-clock-overlays) 5719 (unless org-inhibit-highlight-removal
5532 (setq org-clock-overlays nil) 5720 (mapc 'org-delete-overlay org-clock-overlays)
5533 (unless noremove 5721 (setq org-clock-overlays nil)
5534 (remove-hook 'before-change-functions 5722 (unless noremove
5535 'org-remove-clock-overlays 'local))) 5723 (remove-hook 'before-change-functions
5724 'org-remove-clock-overlays 'local))))
5536 5725
5537(defun org-clock-out-if-current () 5726(defun org-clock-out-if-current ()
5538 "Clock out if the current entry contains the running clock. 5727 "Clock out if the current entry contains the running clock.
@@ -5557,6 +5746,113 @@ If yes, offer to stop it and to save the buffer with the changes."
5557 (when (y-or-n-p "Save changed buffer?") 5746 (when (y-or-n-p "Save changed buffer?")
5558 (save-buffer)))) 5747 (save-buffer))))
5559 5748
5749(defun org-clock-report ()
5750 "Create a table containing a report about clocked time.
5751If the buffer contains lines
5752#+BEGIN: clocktable :maxlevel 3 :emphasize nil
5753
5754#+END: clocktable
5755then the table will be inserted between these lines, replacing whatever
5756is was there before. If these lines are not in the buffer, the table
5757is inserted at point, surrounded by the special lines.
5758The BEGIN line can contain parameters. Allowed are:
5759:maxlevel The maximum level to be included in the table. Default is 3.
5760:emphasize t/nil, if levell 1 and level 2 should be bold/italic in the table."
5761 (interactive)
5762 (org-remove-clock-overlays)
5763 (unless (org-find-dblock "clocktable")
5764 (org-create-dblock (list :name "clocktable"
5765 :maxlevel 2 :emphasize nil)))
5766 (org-update-dblock))
5767
5768(defun org-dblock-write:clocktable (params)
5769 "Write the standard clocktable."
5770 (let ((hlchars '((1 . "*") (2 . ?/)))
5771 (emph nil)
5772 (pos (point)) ipos
5773 (ins (make-marker))
5774 time h m p level hlc hdl maxlevel)
5775 (setq maxlevel (or (plist-get params :maxlevel) 3)
5776 emph (plist-get params :emphasize))
5777 (move-marker ins (point))
5778 (setq ipos (point))
5779 (insert-before-markers "Clock summary at ["
5780 (substring
5781 (format-time-string (cdr org-time-stamp-formats))
5782 1 -1)
5783 "]\n|L|Headline|Time|\n")
5784 (org-clock-sum)
5785 (setq h (/ org-clock-file-total-minutes 60)
5786 m (- org-clock-file-total-minutes (* 60 h)))
5787 (insert-before-markers "|-\n|0|" "*Total file time*| "
5788 (format "*%d:%02d*" h m)
5789 "|\n")
5790 (goto-char (point-min))
5791 (while (setq p (next-single-property-change (point) :org-clock-minutes))
5792 (goto-char p)
5793 (when (setq time (get-text-property p :org-clock-minutes))
5794 (beginning-of-line 1)
5795 (when (and (looking-at "\\(\\*+\\)[ \t]+\\(.*?\\)\\([ \t]+:[0-9a-zA-Z_@:]+:\\)?[ \t]*$")
5796 (setq level (- (match-end 1) (match-beginning 1)))
5797 (<= level maxlevel))
5798 (setq hlc (if emph (or (cdr (assoc level hlchars)) "") "")
5799 hdl (match-string 2)
5800 h (/ time 60)
5801 m (- time (* 60 h)))
5802 (save-excursion
5803 (goto-char ins)
5804 (if (= level 1) (insert-before-markers "|-\n"))
5805 (insert-before-markers
5806 "| " (int-to-string level) "|" hlc hdl hlc " |"
5807 (make-string (1- level) ?|)
5808 hlc
5809 (format "%d:%02d" h m)
5810 hlc
5811 " |\n")))))
5812 (goto-char ins)
5813 (backward-delete-char 1)
5814 (goto-char ipos)
5815 (skip-chars-forward "^|")
5816 (org-table-align)))
5817
5818(defun org-collect-clock-time-entries ()
5819 "Return an internal list with clocking information.
5820This list has one entry for each CLOCK interval.
5821FIXME: describe the elements."
5822 (interactive)
5823 (let ((re (concat "^[ \t]*" org-clock-string
5824 " *\\[\\(.*?\\)\\]--\\[\\(.*?\\)\\]"))
5825 rtn beg end next cont level title total closedp leafp
5826 clockpos titlepos h m donep)
5827 (save-excursion
5828 (org-clock-sum)
5829 (goto-char (point-min))
5830 (while (re-search-forward re nil t)
5831 (setq clockpos (match-beginning 0)
5832 beg (match-string 1) end (match-string 2)
5833 cont (match-end 0))
5834 (setq beg (apply 'encode-time (org-parse-time-string beg))
5835 end (apply 'encode-time (org-parse-time-string end)))
5836 (org-back-to-heading t)
5837 (setq donep (org-entry-is-done-p))
5838 (setq titlepos (point)
5839 total (or (get-text-property (1+ (point)) :org-clock-minutes) 0)
5840 h (/ total 60) m (- total (* 60 h))
5841 total (cons h m))
5842 (looking-at "\\(\\*+\\) +\\(.*\\)")
5843 (setq level (- (match-end 1) (match-beginning 1))
5844 title (org-match-string-no-properties 2))
5845 (save-excursion (outline-next-heading) (setq next (point)))
5846 (setq closedp (re-search-forward org-closed-time-regexp next t))
5847 (goto-char next)
5848 (setq leafp (and (looking-at "^\\*+ ")
5849 (<= (- (match-end 0) (point)) level)))
5850 (push (list beg end clockpos closedp donep
5851 total title titlepos level leafp)
5852 rtn)
5853 (goto-char cont)))
5854 (nreverse rtn)))
5855
5560;;; Agenda, and Diary Integration 5856;;; Agenda, and Diary Integration
5561 5857
5562;;; Define the mode 5858;;; Define the mode
@@ -9186,8 +9482,8 @@ For file links, arg negates `org-context-in-file-links'."
9186 (setq cpltxt (url-view-url t) 9482 (setq cpltxt (url-view-url t)
9187 link (org-make-link cpltxt))) 9483 link (org-make-link cpltxt)))
9188 ((eq major-mode 'w3m-mode) 9484 ((eq major-mode 'w3m-mode)
9189 (setq cpltxt w3m-current-url 9485 (setq cpltxt (or w3m-current-title w3m-current-url)
9190 link (org-make-link cpltxt))) 9486 link (org-make-link w3m-current-url)))
9191 9487
9192 ((setq search (run-hook-with-args-until-success 9488 ((setq search (run-hook-with-args-until-success
9193 'org-create-file-search-functions)) 9489 'org-create-file-search-functions))
@@ -9195,6 +9491,11 @@ For file links, arg negates `org-context-in-file-links'."
9195 "::" search)) 9491 "::" search))
9196 (setq cpltxt (or description link))) 9492 (setq cpltxt (or description link)))
9197 9493
9494 ((eq major-mode 'image-mode)
9495 (setq cpltxt (concat "file:"
9496 (abbreviate-file-name buffer-file-name))
9497 link (org-make-link cpltxt)))
9498
9198 ((eq major-mode 'org-mode) 9499 ((eq major-mode 'org-mode)
9199 ;; Just link to current headline 9500 ;; Just link to current headline
9200 (setq cpltxt (concat "file:" 9501 (setq cpltxt (concat "file:"
@@ -9414,7 +9715,9 @@ subdirectory. Otherwise, the link will be the absolute path as
9414completed in the minibuffer (i.e. normally ~/path/to/file). 9715completed in the minibuffer (i.e. normally ~/path/to/file).
9415 9716
9416With two \\[universal-argument] prefixes, enforce an absolute path even if the file 9717With two \\[universal-argument] prefixes, enforce an absolute path even if the file
9417is in the current directory or below." 9718is in the current directory or below.
9719With three \\[universal-argument] prefixes, negate the meaning of
9720`org-keep-stored-link-after-insertion'."
9418 (interactive "P") 9721 (interactive "P")
9419 (let (link desc entry remove file (pos (point))) 9722 (let (link desc entry remove file (pos (point)))
9420 (cond 9723 (cond
@@ -9430,7 +9733,7 @@ is in the current directory or below."
9430 (setq link (read-string "Link: " 9733 (setq link (read-string "Link: "
9431 (org-link-unescape 9734 (org-link-unescape
9432 (org-match-string-no-properties 1))))) 9735 (org-match-string-no-properties 1)))))
9433 (complete-file 9736 ((equal complete-file '(4))
9434 ;; Completing read for file names. 9737 ;; Completing read for file names.
9435 (setq file (read-file-name "File: ")) 9738 (setq file (read-file-name "File: "))
9436 (let ((pwd (file-name-as-directory (expand-file-name "."))) 9739 (let ((pwd (file-name-as-directory (expand-file-name ".")))
@@ -9455,7 +9758,8 @@ is in the current directory or below."
9455 org-insert-link-history 9758 org-insert-link-history
9456 (or (car (car org-stored-links))))) 9759 (or (car (car org-stored-links)))))
9457 (setq entry (assoc link org-stored-links)) 9760 (setq entry (assoc link org-stored-links))
9458 (if (not org-keep-stored-link-after-insertion) 9761 (if (funcall (if (equal complete-file '(64)) 'not 'identity)
9762 (not org-keep-stored-link-after-insertion))
9459 (setq org-stored-links (delq (assoc link org-stored-links) 9763 (setq org-stored-links (delq (assoc link org-stored-links)
9460 org-stored-links))) 9764 org-stored-links)))
9461 (setq link (if entry (nth 1 entry) link) 9765 (setq link (if entry (nth 1 entry) link)
@@ -12199,7 +12503,8 @@ ones and overrule settings in the other lists."
12199\[X] publish... (project will be prompted for) 12503\[X] publish... (project will be prompted for)
12200\[A] publish all projects") 12504\[A] publish all projects")
12201 (cmds 12505 (cmds
12202 '((?v . org-export-visible) 12506 '((?t . org-insert-export-options-template)
12507 (?v . org-export-visible)
12203 (?a . org-export-as-ascii) 12508 (?a . org-export-as-ascii)
12204 (?h . org-export-as-html) 12509 (?h . org-export-as-html)
12205 (?b . org-export-as-html-and-open) 12510 (?b . org-export-as-html-and-open)
@@ -12566,7 +12871,7 @@ translations. There is currently no way for users to extend this.")
12566 (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]") 12871 (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]")
12567 t t)) 12872 t t))
12568 ;; Find multiline emphasis and put them into single line 12873 ;; Find multiline emphasis and put them into single line
12569 (when (assq :emph-multiline parameters) 12874 (when (memq :emph-multiline parameters)
12570 (goto-char (point-min)) 12875 (goto-char (point-min))
12571 (while (re-search-forward org-emph-re nil t) 12876 (while (re-search-forward org-emph-re nil t)
12572 (subst-char-in-region (match-beginning 0) (match-end 0) ?\n ?\ t) 12877 (subst-char-in-region (match-beginning 0) (match-end 0) ?\n ?\ t)
@@ -12858,13 +13163,18 @@ command."
12858 (interactive 13163 (interactive
12859 (list (progn 13164 (list (progn
12860 (message "Export visible: [a]SCII [h]tml [b]rowse HTML [x]OXO [ ]keep buffer") 13165 (message "Export visible: [a]SCII [h]tml [b]rowse HTML [x]OXO [ ]keep buffer")
12861 (char-to-string (read-char-exclusive))) 13166 (read-char-exclusive))
12862 current-prefix-arg)) 13167 current-prefix-arg))
12863 (if (not (member type '("a" "\C-a" "b" "\C-b" "h" "x" " "))) 13168 (if (not (member type '(?a ?\C-a ?b ?\C-b ?h ?x ?\ )))
12864 (error "Invalid export key")) 13169 (error "Invalid export key"))
12865 ;; FIXME: do this more explicit? 13170 (let* ((binding (cdr (assoc type
12866 (let* ((binding (key-binding (concat "\C-c\C-x" type))) 13171 '((?a . org-export-as-ascii)
12867 (keepp (equal type " ")) 13172 (?\C-a . org-export-as-ascii)
13173 (?b . org-export-as-html-and-open)
13174 (?\C-b . org-export-as-html-and-open)
13175 (?h . org-export-as-html)
13176 (?x . org-export-as-xoxo)))))
13177 (keepp (equal type ?\ ))
12868 (file buffer-file-name) 13178 (file buffer-file-name)
12869 (buffer (get-buffer-create "*Org Export Visible*")) 13179 (buffer (get-buffer-create "*Org Export Visible*"))
12870 s e) 13180 s e)
@@ -13049,6 +13359,8 @@ org-mode's default settings, but still inferior to file-local settings."
13049 (org-infile-export-plist))) 13359 (org-infile-export-plist)))
13050 13360
13051 (style (plist-get opt-plist :style)) 13361 (style (plist-get opt-plist :style))
13362 (link-validate (plist-get opt-plist :link-validation-function))
13363 valid
13052 (odd org-odd-levels-only) 13364 (odd org-odd-levels-only)
13053 (region-p (org-region-active-p)) 13365 (region-p (org-region-active-p))
13054 (region 13366 (region
@@ -13068,6 +13380,7 @@ org-mode's default settings, but still inferior to file-local settings."
13068 (file-name-sans-extension 13380 (file-name-sans-extension
13069 (file-name-nondirectory buffer-file-name)) 13381 (file-name-nondirectory buffer-file-name))
13070 ".html")) 13382 ".html"))
13383 (current-dir (file-name-directory buffer-file-name))
13071 (buffer (find-file-noselect filename)) 13384 (buffer (find-file-noselect filename))
13072 (levels-open (make-vector org-level-max nil)) 13385 (levels-open (make-vector org-level-max nil))
13073 (date (format-time-string "%Y/%m/%d" (current-time))) 13386 (date (format-time-string "%Y/%m/%d" (current-time)))
@@ -13314,6 +13627,10 @@ lang=\"%s\" xml:lang=\"%s\">
13314 (if (string-match "::\\(.*\\)" filename) 13627 (if (string-match "::\\(.*\\)" filename)
13315 (setq search (match-string 1 filename) 13628 (setq search (match-string 1 filename)
13316 filename (replace-match "" t nil filename))) 13629 filename (replace-match "" t nil filename)))
13630 (setq valid
13631 (if (functionp link-validate)
13632 (funcall link-validate filename current-dir)
13633 t))
13317 (setq file-is-image-p 13634 (setq file-is-image-p
13318 (string-match (org-image-file-name-regexp) filename)) 13635 (string-match (org-image-file-name-regexp) filename))
13319 (setq thefile (if abs-p (expand-file-name filename) filename)) 13636 (setq thefile (if abs-p (expand-file-name filename) filename))
@@ -13339,7 +13656,8 @@ lang=\"%s\" xml:lang=\"%s\">
13339 (and org-export-html-inline-images 13656 (and org-export-html-inline-images
13340 (not descp)))) 13657 (not descp))))
13341 (concat "<img src=\"" thefile "\"/>") 13658 (concat "<img src=\"" thefile "\"/>")
13342 (concat "<a href=\"" thefile "\">" desc "</a>"))))) 13659 (concat "<a href=\"" thefile "\">" desc "</a>")))
13660 (if (not valid) (setq rpl desc))))
13343 ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell" "info" "elisp")) 13661 ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell" "info" "elisp"))
13344 (setq rpl (concat "<i>&lt;" type ":" 13662 (setq rpl (concat "<i>&lt;" type ":"
13345 (save-match-data (org-link-unescape path)) 13663 (save-match-data (org-link-unescape path))
@@ -13650,27 +13968,31 @@ But it has the disadvantage, that Org-mode's HTML conversions cannot be used."
13650 13968
13651(defun org-html-handle-time-stamps (s) 13969(defun org-html-handle-time-stamps (s)
13652 "Format time stamps in string S, or remove them." 13970 "Format time stamps in string S, or remove them."
13653 (let (r b) 13971 (catch 'exit
13654 (while (string-match org-maybe-keyword-time-regexp s) 13972 (let (r b)
13655 (or b (setq b (substring s 0 (match-beginning 0)))) 13973 (while (string-match org-maybe-keyword-time-regexp s)
13656 (if (not org-export-with-timestamps) 13974 ;; FIXME: is it good to never export CLOCK, or do we need control?
13657 (setq r (concat r (substring s 0 (match-beginning 0))) 13975 (if (and (match-end 1) (equal (match-string 1 s) org-clock-string))
13658 s (substring s (match-end 0))) 13976 (throw 'exit ""))
13659 (setq r (concat 13977 (or b (setq b (substring s 0 (match-beginning 0))))
13660 r (substring s 0 (match-beginning 0)) 13978 (if (not org-export-with-timestamps)
13661 (if (match-end 1) 13979 (setq r (concat r (substring s 0 (match-beginning 0)))
13662 (format "@<span class=\"timestamp-kwd\">%s @</span>" 13980 s (substring s (match-end 0)))
13663 (match-string 1 s))) 13981 (setq r (concat
13664 (format " @<span class=\"timestamp\">%s@</span>" 13982 r (substring s 0 (match-beginning 0))
13665 (substring (match-string 3 s) 1 -1))) 13983 (if (match-end 1)
13666 s (substring s (match-end 0))))) 13984 (format "@<span class=\"timestamp-kwd\">%s @</span>"
13667 ;; Line break of line started and ended with time stamp stuff 13985 (match-string 1 s)))
13668 (if (not r) 13986 (format " @<span class=\"timestamp\">%s@</span>"
13669 s 13987 (substring (match-string 3 s) 1 -1)))
13670 (setq r (concat r s)) 13988 s (substring s (match-end 0)))))
13671 (unless (string-match "\\S-" (concat b s)) 13989 ;; Line break if line started and ended with time stamp stuff
13672 (setq r (concat r "@<br/>"))) 13990 (if (not r)
13673 r))) 13991 s
13992 (setq r (concat r s))
13993 (unless (string-match "\\S-" (concat b s))
13994 (setq r (concat r "@<br/>")))
13995 r))))
13674 13996
13675(defun org-html-protect (s) 13997(defun org-html-protect (s)
13676 ;; convert & to &amp;, < to &lt; and > to &gt; 13998 ;; convert & to &amp;, < to &lt; and > to &gt;
@@ -14212,6 +14534,7 @@ a time), or the day by one (if it does not contain a time)."
14212;; All the other keys 14534;; All the other keys
14213 14535
14214(define-key org-mode-map "\C-c\C-a" 'show-all) ; in case allout messed up. 14536(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)
14215(define-key org-mode-map "\C-c$" 'org-archive-subtree) 14538(define-key org-mode-map "\C-c$" 'org-archive-subtree)
14216(define-key org-mode-map "\C-c\C-j" 'org-goto) 14539(define-key org-mode-map "\C-c\C-j" 'org-goto)
14217(define-key org-mode-map "\C-c\C-t" 'org-todo) 14540(define-key org-mode-map "\C-c\C-t" 'org-todo)
@@ -14255,24 +14578,7 @@ a time), or the day by one (if it does not contain a time)."
14255(define-key org-mode-map "\C-c~" 'org-table-create-with-table.el) 14578(define-key org-mode-map "\C-c~" 'org-table-create-with-table.el)
14256(define-key org-mode-map "\C-c\C-q" 'org-table-wrap-region) 14579(define-key org-mode-map "\C-c\C-q" 'org-table-wrap-region)
14257(define-key org-mode-map "\C-c\C-e" 'org-export) 14580(define-key org-mode-map "\C-c\C-e" 'org-export)
14258;(define-key org-mode-map "\C-c\C-xa" 'org-export-as-ascii)
14259;(define-key org-mode-map "\C-c\C-x\C-a" 'org-export-as-ascii)
14260;(define-key org-mode-map "\C-c\C-xv" 'org-export-visible)
14261;(define-key org-mode-map "\C-c\C-x\C-v" 'org-export-visible)
14262;; OPML support is only an option for the future
14263;(define-key org-mode-map "\C-c\C-xo" 'org-export-as-opml)
14264;(define-key org-mode-map "\C-c\C-x\C-o" 'org-export-as-opml)
14265;(define-key org-mode-map "\C-c\C-xi" 'org-export-icalendar-this-file)
14266;(define-key org-mode-map "\C-c\C-x\C-i" 'org-export-icalendar-all-agenda-files)
14267;(define-key org-mode-map "\C-c\C-xc" 'org-export-icalendar-combine-agenda-files)
14268;(define-key org-mode-map "\C-c\C-x\C-c" 'org-export-icalendar-combine-agenda-files)
14269;(define-key org-mode-map "\C-c\C-xt" 'org-insert-export-options-template)
14270(define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section) 14581(define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section)
14271;(define-key org-mode-map "\C-c\C-xh" 'org-export-as-html)
14272;(define-key org-mode-map "\C-c\C-xx" 'org-export-as-xoxo)
14273;(define-key org-mode-map "\C-c\C-x\C-x" 'org-export-as-xoxo)
14274;(define-key org-mode-map "\C-c\C-xb" 'org-export-as-html-and-open)
14275;(define-key org-mode-map "\C-c\C-x\C-b" 'org-export-as-html-and-open)
14276 14582
14277(define-key org-mode-map "\C-c\C-x\C-k" 'org-cut-special) 14583(define-key org-mode-map "\C-c\C-x\C-k" 'org-cut-special)
14278(define-key org-mode-map "\C-c\C-x\C-w" 'org-cut-special) 14584(define-key org-mode-map "\C-c\C-x\C-w" 'org-cut-special)
@@ -14283,15 +14589,9 @@ a time), or the day by one (if it does not contain a time)."
14283(define-key org-mode-map "\C-c\C-x\C-o" 'org-clock-out) 14589(define-key org-mode-map "\C-c\C-x\C-o" 'org-clock-out)
14284(define-key org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel) 14590(define-key org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel)
14285(define-key org-mode-map "\C-c\C-x\C-d" 'org-clock-display) 14591(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)
14286 14593
14287;(define-key org-mode-map "\C-c\C-ef" 'org-publish-current-file) 14594(define-key org-mode-map "\C-c\C-x\C-u" 'org-dblock-update)
14288;(define-key org-mode-map "\C-c\C-ep" 'org-publish-current-project)
14289;(define-key org-mode-map "\C-c\C-ec" 'org-publish)
14290;(define-key org-mode-map "\C-c\C-ea" 'org-publish-all)
14291;(define-key org-mode-map "\C-c\C-e\C-f" 'org-publish-current-file)
14292;(define-key org-mode-map "\C-c\C-e\C-p" 'org-publish-current-project)
14293;(define-key org-mode-map "\C-c\C-e\C-c" 'org-publish)
14294;(define-key org-mode-map "\C-c\C-e\C-a" 'org-publish-all)
14295 14595
14296(when (featurep 'xemacs) 14596(when (featurep 'xemacs)
14297 (define-key org-mode-map 'button3 'popup-mode-menu)) 14597 (define-key org-mode-map 'button3 'popup-mode-menu))
@@ -14785,6 +15085,7 @@ See the individual commands for more information."
14785 ["Clock out" org-clock-out t] 15085 ["Clock out" org-clock-out t]
14786 ["Clock cancel" org-clock-cancel t] 15086 ["Clock cancel" org-clock-cancel t]
14787 ["Display times" org-clock-display t] 15087 ["Display times" org-clock-display t]
15088 ["Create clock table" org-clock-report t]
14788 "--" 15089 "--"
14789 ["Record DONE time" 15090 ["Record DONE time"
14790 (progn (setq org-log-done (not org-log-done)) 15091 (progn (setq org-log-done (not org-log-done))
@@ -15284,7 +15585,8 @@ When ENTRY is non-nil, show the entire entry."
15284 (forward-char -1) 15585 (forward-char -1)
15285 (if (memq (preceding-char) '(?\n ?\^M)) 15586 (if (memq (preceding-char) '(?\n ?\^M))
15286 ;; leave blank line before heading 15587 ;; leave blank line before heading
15287 (forward-char -1)))))) 15588 (forward-char -1)))))
15589 (point))
15288 15590
15289(defun org-show-subtree () 15591(defun org-show-subtree ()
15290 "Show everything after this heading at deeper levels." 15592 "Show everything after this heading at deeper levels."
@@ -15334,8 +15636,12 @@ Show the heading too, if it is currently invisible."
15334 (org-invisible-p))) 15636 (org-invisible-p)))
15335 (org-show-hierarchy-above))) 15637 (org-show-hierarchy-above)))
15336 15638
15337;;; Finish up
15338 15639
15640;;; Experimental code
15641
15642
15643;;; Finish up
15644
15339(provide 'org) 15645(provide 'org)
15340 15646
15341(run-hooks 'org-load-hook) 15647(run-hooks 'org-load-hook)
diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index 8ca7c3026e8..9e78f4b6015 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -597,7 +597,7 @@ An alternative value is \" . \", if you use a font with a narrow period."
597(defun tex-font-lock-match-suscript (limit) 597(defun tex-font-lock-match-suscript (limit)
598 "Match subscript and superscript patterns up to LIMIT." 598 "Match subscript and superscript patterns up to LIMIT."
599 (when (re-search-forward "[_^] *\\([^\n\\{}]\\|\ 599 (when (re-search-forward "[_^] *\\([^\n\\{}]\\|\
600\\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|{[^\\{]*}\\|\\({\\)\\)" limit t) 600\\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|\\({\\)\\)" limit t)
601 (when (match-end 3) 601 (when (match-end 3)
602 (let ((beg (match-beginning 3)) 602 (let ((beg (match-beginning 3))
603 (end (save-restriction 603 (end (save-restriction