From e924d02104d531aa915ecbd13f489cf568167334 Mon Sep 17 00:00:00 2001 From: Romain Francoise Date: Sun, 18 Jun 2006 08:17:56 +0000 Subject: [PATCH 01/20] 2006-06-18 Ralf Angeli * textmodes/tex-mode.el (tex-font-lock-match-suscript): Remove superfluous part of regexp for brace matching which is handled by `scan-lists' call. --- lisp/ChangeLog | 6 ++++++ lisp/textmodes/tex-mode.el | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 087959d4391..a6a72978852 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,9 @@ +2006-06-18 Ralf Angeli + + * textmodes/tex-mode.el (tex-font-lock-match-suscript): Remove + superfluous part of regexp for brace matching which is handled by + `scan-lists' call. + 2006-06-16 Richard Stallman * obsolete/options.el (list-options): Put "obsolete" msg in buffer. 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." (defun tex-font-lock-match-suscript (limit) "Match subscript and superscript patterns up to LIMIT." (when (re-search-forward "[_^] *\\([^\n\\{}]\\|\ -\\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|{[^\\{]*}\\|\\({\\)\\)" limit t) +\\\\\\([a-zA-Z@]+\\|[^ \t\n]\\)\\|\\({\\)\\)" limit t) (when (match-end 3) (let ((beg (match-beginning 3)) (end (save-restriction From 9e363b8991ea4c52e18b59d0679689cd6a1c0d1b Mon Sep 17 00:00:00 2001 From: Ramprasad B Date: Sun, 18 Jun 2006 09:14:51 +0000 Subject: [PATCH 02/20] changed my email-id --- man/faq.texi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/man/faq.texi b/man/faq.texi index 3fa69aa4395..fbb75f4e64c 100644 --- a/man/faq.texi +++ b/man/faq.texi @@ -3659,7 +3659,7 @@ lack certain features, such as the Emacs Lisp extension language. For information on Emacs for Windows 95 and NT, read the FAQ produced by @email{voelker@@cs.washington.edu, Geoff Voelker} and currently maintained -by @email{ramprasad_i82@@yahoo.com, Ramprasad B}, available at +by @email{ramprasad@@gnu.org, Ramprasad B}, available at @uref{http://www.gnu.org/software/emacs/windows/ntemacs.html} From ec6aebe8337fdd6dc218609a3ff86ccc0232fb4a Mon Sep 17 00:00:00 2001 From: Michael Kifer Date: Sun, 18 Jun 2006 17:08:24 +0000 Subject: [PATCH 03/20] 2006-06-18 Michael Kifer * viper-cmd.el (viper-special-read-and-insert-char): use read-key-sequence. (viper-after-change-undo-hook): enhancements. (viper-after-change-undo-hook): new hook. (viper-undo): use viper-after-change-undo-hook. (viper-add-newline-at-eob-if-necessary): widen before making changes. (viper-next-line-at-bol): If point is on a widget or a button, simulate clicking on that widget/button. * viper.el (viper-mode): allow for a separate cursor color in Emacs state. * ediff-diff (ediff-test-patch-utility): catch errors. (ediff-actual-diff-options, ediff-actual-diff3-options): new variables. (ediff-set-actual-diff-options): new function. (ediff-reset-diff-options, ediff-toggle-ignore-case): use ediff-set-actual-diff-options. (ediff-extract-diffs): catch errors. (ediff-whitespace): add nonbreakable space. (ediff-same-file-contents): catch errors. * ediff-mult.el (ediff-collect-custom-diffs): save coding-system-for-read. * ediff-vers.el (ediff-keep-tmp-versions): new var. (ediff-vc-internal, ediff-vc-merge-internal): use ediff-delete-version-file. (ediff-delete-version-file): new function. * ediff-wind.el (ediff-control-frame-parameters): set frame fringes. * ediff.el (ediff-directories, ediff-directory-revisions, ediff-merge-directories, ediff-merge-directories-with-ancestor, ediff-directories-internal, ediff-merge-directory-revisions, ediff-merge-directory-revisions-with-ancestor, ediff-directories3): use read-directory-name. --- lisp/ChangeLog | 39 ++++++++++++++++ lisp/ediff-diff.el | 74 +++++++++++++++++------------ lisp/ediff-mult.el | 36 ++++++++------- lisp/ediff-vers.el | 26 ++++++++--- lisp/ediff-wind.el | 2 + lisp/ediff.el | 80 ++++++++++++++++---------------- lisp/emulation/viper-cmd.el | 90 +++++++++++++++++++++++++----------- lisp/emulation/viper-util.el | 4 +- lisp/emulation/viper.el | 6 ++- 9 files changed, 233 insertions(+), 124 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index a6a72978852..9fd0500b825 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,42 @@ +2006-06-18 Michael Kifer + + * viper-cmd.el (viper-special-read-and-insert-char): use + read-key-sequence. + (viper-after-change-undo-hook): enhancements. + (viper-after-change-undo-hook): new hook. + (viper-undo): use viper-after-change-undo-hook. + (viper-add-newline-at-eob-if-necessary): widen before making changes. + (viper-next-line-at-bol): If point is on a widget or a button, simulate + clicking on that widget/button. + + * viper.el (viper-mode): allow for a separate cursor color in Emacs + state. + + * ediff-diff (ediff-test-patch-utility): catch errors. + (ediff-actual-diff-options, ediff-actual-diff3-options): new variables. + (ediff-set-actual-diff-options): new function. + (ediff-reset-diff-options, ediff-toggle-ignore-case): + use ediff-set-actual-diff-options. + (ediff-extract-diffs): catch errors. + (ediff-whitespace): add nonbreakable space. + (ediff-same-file-contents): catch errors. + + * ediff-mult.el (ediff-collect-custom-diffs): save + coding-system-for-read. + + * ediff-vers.el (ediff-keep-tmp-versions): new var. + (ediff-vc-internal, ediff-vc-merge-internal): use + ediff-delete-version-file. + (ediff-delete-version-file): new function. + + * ediff-wind.el (ediff-control-frame-parameters): set frame fringes. + + * ediff.el (ediff-directories, ediff-directory-revisions, + ediff-merge-directories, ediff-merge-directories-with-ancestor, + ediff-directories-internal, ediff-merge-directory-revisions, + ediff-merge-directory-revisions-with-ancestor, + ediff-directories3): use read-directory-name. + 2006-06-18 Ralf Angeli * textmodes/tex-mode.el (tex-font-lock-match-suscript): Remove 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." ;; The following functions needed for setting diff/diff3 options ;; test if diff supports the --binary option (defsubst ediff-test-utility (diff-util option &optional files) - (condition-case () + (condition-case nil (eq 0 (apply 'call-process (append (list diff-util nil nil nil option) files))) - (file-error nil))) + (error (format "Cannot execute program %S." diff-util))) + ) (defun ediff-diff-mandatory-option (diff-util) (let ((file (if (boundp 'null-device) null-device "/dev/null"))) @@ -77,13 +78,17 @@ Must produce output compatible with Unix's diff3 program." ((and (string= diff-util ediff-diff-program) (ediff-test-utility ediff-diff-program "--binary" (list file file))) - "--binary") + "--binary ") ((and (string= diff-util ediff-diff3-program) (ediff-test-utility ediff-diff3-program "--binary" (list file file file))) - "--binary") + "--binary ") (t "")))) + +;; must be before ediff-reset-diff-options to avoid compiler errors +(fset 'ediff-set-actual-diff-options '(lambda () nil)) + ;; make sure that mandatory options are added even if the user changes ;; ediff-diff-options or ediff-diff3-options in the customization widget (defun ediff-reset-diff-options (symb val) @@ -91,12 +96,9 @@ Must produce output compatible with Unix's diff3 program." (if (eq symb 'ediff-diff-options) ediff-diff-program ediff-diff3-program)) - (mandatory-option (ediff-diff-mandatory-option diff-program)) - (spacer (if (string-equal mandatory-option "") "" " "))) - (set symb - (if (string-match mandatory-option val) - val - (concat mandatory-option spacer val))) + (mandatory-option (ediff-diff-mandatory-option diff-program))) + (set symb (concat mandatory-option val)) + (ediff-set-actual-diff-options) )) @@ -155,7 +157,7 @@ GNU diff3 doesn't have such an option." :group 'ediff-diff) ;; the actual options used in comparison -(ediff-defvar-local ediff-actual-diff-options "" "") +(ediff-defvar-local ediff-actual-diff-options ediff-diff-options "") (defcustom ediff-custom-diff-program ediff-diff-program "*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." :group 'ediff-diff) ;; the actual options used in comparison -(ediff-defvar-local ediff-actual-diff3-options "" "") +(ediff-defvar-local ediff-actual-diff3-options ediff-diff3-options "") (defcustom ediff-diff3-ok-lines-regexp "^\\([1-3]:\\|====\\| \\|.*Warning *:\\|.*No newline\\|.*missing newline\\|^\C-m$\\)" @@ -1272,7 +1274,9 @@ delimiter regions")) ;; Similarly for Windows-* ;; In DOS, must synchronize because DOS doesn't have ;; asynchronous processes. - (apply 'call-process program nil buffer nil args) + (condition-case nil + (apply 'call-process program nil buffer nil args) + (error (format "Cannot execute program %S." program))) ;; On other systems, do it asynchronously. (setq proc (get-buffer-process buffer)) (if proc (kill-process proc)) @@ -1328,7 +1332,8 @@ delimiter regions")) Used for splitting difference regions into individual words.") (make-variable-buffer-local 'ediff-forward-word-function) -(defvar ediff-whitespace " \n\t\f" +;; \240 is unicode symbol for nonbreakable whitespace +(defvar ediff-whitespace " \n\t\f\r\240" "*Characters constituting white space. These characters are ignored when differing regions are split into words.") (make-variable-buffer-local 'ediff-whitespace) @@ -1442,11 +1447,13 @@ arguments to `skip-chars-forward'." "Return t if files F1 and F2 have identical contents." (if (and (not (file-directory-p f1)) (not (file-directory-p f2))) - (let ((res - (apply 'call-process ediff-cmp-program nil nil nil - (append ediff-cmp-options (list f1 f2))))) - (and (numberp res) (eq res 0)))) - ) + (condition-case nil + (let ((res + (apply 'call-process ediff-cmp-program nil nil nil + (append ediff-cmp-options (list f1 f2))))) + (and (numberp res) (eq res 0))) + (error (format "Cannot execute program %S." ediff-cmp-program))) + )) (defun ediff-same-contents (d1 d2 &optional filter-re) @@ -1521,21 +1528,30 @@ affects only files whose names match the expression." (setq file-list-list (cdr file-list-list))) (reverse result))) + +(defun ediff-set-actual-diff-options () + (if ediff-ignore-case + (setq ediff-actual-diff-options + (concat ediff-diff-options " " ediff-ignore-case-option) + ediff-actual-diff3-options + (concat ediff-diff3-options " " ediff-ignore-case-option3)) + (setq ediff-actual-diff-options ediff-diff-options + ediff-actual-diff3-options ediff-diff3-options) + ) + (setq-default ediff-actual-diff-options ediff-actual-diff-options + ediff-actual-diff3-options ediff-actual-diff3-options) + ) + + ;; Ignore case handling - some ideas from drew.adams@@oracle.com (defun ediff-toggle-ignore-case () (interactive) (ediff-barf-if-not-control-buffer) (setq ediff-ignore-case (not ediff-ignore-case)) - (cond (ediff-ignore-case - (setq ediff-actual-diff-options - (concat ediff-diff-options " " ediff-ignore-case-option) - ediff-actual-diff3-options - (concat ediff-diff3-options " " ediff-ignore-case-option3)) - (message "Ignoring regions that differ only in case")) - (t - (setq ediff-actual-diff-options ediff-diff-options - ediff-actual-diff3-options ediff-diff3-options) - (message "Ignoring case differences turned OFF"))) + (ediff-set-actual-diff-options) + (if ediff-ignore-case + (message "Ignoring regions that differ only in case") + (message "Ignoring case differences turned OFF")) (cond (ediff-merge-job (message "Ignoring letter case is too dangerous in merge jobs")) ((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 multifile patches. For `ediff-directory-revisions', we insist that all marked sessions must be active." (interactive) - (or (ediff-buffer-live-p ediff-meta-diff-buffer) - (setq ediff-meta-diff-buffer - (get-buffer-create - (ediff-unique-buffer-name "*Ediff Multifile Diffs" "*")))) - (ediff-with-current-buffer ediff-meta-diff-buffer - (setq buffer-read-only nil) - (erase-buffer)) - (if (> (ediff-operate-on-marked-sessions 'ediff-append-custom-diff) 0) - ;; did something - (progn - (display-buffer ediff-meta-diff-buffer 'not-this-window) - (ediff-with-current-buffer ediff-meta-diff-buffer - (set-buffer-modified-p nil) - (setq buffer-read-only t))) - (beep) - (message "No marked sessions found"))) + (let ((coding-system-for-read ediff-coding-system-for-read)) + (or (ediff-buffer-live-p ediff-meta-diff-buffer) + (setq ediff-meta-diff-buffer + (get-buffer-create + (ediff-unique-buffer-name "*Ediff Multifile Diffs" "*")))) + (ediff-with-current-buffer ediff-meta-diff-buffer + (setq buffer-read-only nil) + (erase-buffer)) + (if (> (ediff-operate-on-marked-sessions 'ediff-append-custom-diff) 0) + ;; did something + (progn + (display-buffer ediff-meta-diff-buffer 'not-this-window) + (ediff-with-current-buffer ediff-meta-diff-buffer + (set-buffer-modified-p nil) + (setq buffer-read-only t)) + (if (fboundp 'diff-mode) + (with-current-buffer ediff-meta-diff-buffer + (diff-mode)))) + (beep) + (message "No marked sessions found")))) (defun ediff-meta-show-patch () "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 @@ ))) ;; end pacifier +(defcustom ediff-keep-tmp-versions nil + "*If t, do not delete temporary previous versions for the files on which +comparison or merge operations are being performed." + :type 'boolean + :group 'ediff-vers + ) + ;; VC.el support (defun ediff-vc-latest-version (file) @@ -87,8 +94,8 @@ file2 (buffer-file-name))) (setq startup-hooks (cons `(lambda () - (delete-file ,file1) - (or ,(string= rev2 "") (delete-file ,file2))) + (ediff-delete-version-file ,file1) + (or ,(string= rev2 "") (ediff-delete-version-file ,file2))) startup-hooks))) (ediff-buffers rev1buf rev2buf @@ -199,12 +206,12 @@ (setq startup-hooks (cons `(lambda () - (delete-file ,(buffer-file-name buf1)) + (ediff-delete-version-file ,(buffer-file-name buf1)) (or ,(string= rev2 "") - (delete-file ,(buffer-file-name buf2))) + (ediff-delete-version-file ,(buffer-file-name buf2))) (or ,(string= ancestor-rev "") ,(not ancestor-rev) - (delete-file ,(buffer-file-name ancestor-buf))) + (ediff-delete-version-file ,(buffer-file-name ancestor-buf))) ) startup-hooks))) (if ancestor-rev @@ -305,8 +312,13 @@ (find-file-noselect (cvs-fileinfo->full-name fileinfo))) nil ; startup-hooks 'ediff-revisions))) - (if (stringp tmp-file) (delete-file tmp-file)) - (if (stringp ancestor-file) (delete-file ancestor-file)))) + (if (stringp tmp-file) (ediff-delete-version-file tmp-file)) + (if (stringp ancestor-file) (ediff-delete-version-file ancestor-file)))) + + +;; delete version file on exit unless ediff-keep-tmp-versions is true +(defun ediff-delete-version-file (file) + (or ediff-keep-tmp-versions (delete-file file))) (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." '(scrollbar-height . 0) ; XEmacs only '(menu-bar-lines . 0) ; Emacs only '(tool-bar-lines . 0) ; Emacs 21+ only + '(left-fringe . 0) + '(right-fringe . 0) ;; don't lower but auto-raise '(auto-lower . nil) '(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." (let ((dir-A (ediff-get-default-directory-name)) (default-regexp (eval ediff-default-filtering-regexp)) f) - (list (setq f (ediff-read-file-name "Directory A to compare:" dir-A nil)) - (ediff-read-file-name "Directory B to compare:" - (if ediff-use-last-dir - ediff-last-dir-B - (ediff-strip-last-dir f)) - nil) + (list (setq f (read-directory-name + "Directory A to compare:" dir-A nil 'must-match)) + (read-directory-name "Directory B to compare:" + (if ediff-use-last-dir + ediff-last-dir-B + (ediff-strip-last-dir f)) + nil 'must-match) (read-string (if (stringp default-regexp) (format "Filter through regular expression (default %s): " @@ -532,8 +533,8 @@ names. Only the files that are under revision control are taken into account." (let ((dir-A (ediff-get-default-directory-name)) (default-regexp (eval ediff-default-filtering-regexp)) ) - (list (ediff-read-file-name - "Directory to compare with revision:" dir-A nil) + (list (read-directory-name + "Directory to compare with revision:" dir-A nil 'must-match) (read-string (if (stringp default-regexp) (format "Filter through regular expression (default %s): " @@ -561,17 +562,17 @@ regular expression; only file names that match the regexp are considered." (let ((dir-A (ediff-get-default-directory-name)) (default-regexp (eval ediff-default-filtering-regexp)) f) - (list (setq f (ediff-read-file-name "Directory A to compare:" dir-A nil)) - (setq f (ediff-read-file-name "Directory B to compare:" - (if ediff-use-last-dir - ediff-last-dir-B - (ediff-strip-last-dir f)) - nil)) - (ediff-read-file-name "Directory C to compare:" - (if ediff-use-last-dir - ediff-last-dir-C - (ediff-strip-last-dir f)) - nil) + (list (setq f (read-directory-name "Directory A to compare:" dir-A nil)) + (setq f (read-directory-name "Directory B to compare:" + (if ediff-use-last-dir + ediff-last-dir-B + (ediff-strip-last-dir f)) + nil 'must-match)) + (read-directory-name "Directory C to compare:" + (if ediff-use-last-dir + ediff-last-dir-C + (ediff-strip-last-dir f)) + nil 'must-match) (read-string (if (stringp default-regexp) (format "Filter through regular expression (default %s): " @@ -597,12 +598,13 @@ expression; only file names that match the regexp are considered." (let ((dir-A (ediff-get-default-directory-name)) (default-regexp (eval ediff-default-filtering-regexp)) f) - (list (setq f (ediff-read-file-name "Directory A to merge:" dir-A nil)) - (ediff-read-file-name "Directory B to merge:" - (if ediff-use-last-dir - ediff-last-dir-B - (ediff-strip-last-dir f)) - nil) + (list (setq f (read-directory-name "Directory A to merge:" + dir-A nil 'must-match)) + (read-directory-name "Directory B to merge:" + (if ediff-use-last-dir + ediff-last-dir-B + (ediff-strip-last-dir f)) + nil 'must-match) (read-string (if (stringp default-regexp) (format "Filter through regular expression (default %s): " @@ -633,17 +635,17 @@ only file names that match the regexp are considered." (let ((dir-A (ediff-get-default-directory-name)) (default-regexp (eval ediff-default-filtering-regexp)) f) - (list (setq f (ediff-read-file-name "Directory A to merge:" dir-A nil)) - (setq f (ediff-read-file-name "Directory B to merge:" + (list (setq f (read-directory-name "Directory A to merge:" dir-A nil)) + (setq f (read-directory-name "Directory B to merge:" (if ediff-use-last-dir ediff-last-dir-B (ediff-strip-last-dir f)) - nil)) - (ediff-read-file-name "Ancestor directory:" + nil 'must-match)) + (read-directory-name "Ancestor directory:" (if ediff-use-last-dir ediff-last-dir-C (ediff-strip-last-dir f)) - nil) + nil 'must-match) (read-string (if (stringp default-regexp) (format "Filter through regular expression (default %s): " @@ -669,8 +671,8 @@ names. Only the files that are under revision control are taken into account." (let ((dir-A (ediff-get-default-directory-name)) (default-regexp (eval ediff-default-filtering-regexp)) ) - (list (ediff-read-file-name - "Directory to merge with revisions:" dir-A nil) + (list (read-directory-name + "Directory to merge with revisions:" dir-A nil 'must-match) (read-string (if (stringp default-regexp) (format "Filter through regular expression (default %s): " @@ -699,8 +701,9 @@ names. Only the files that are under revision control are taken into account." (let ((dir-A (ediff-get-default-directory-name)) (default-regexp (eval ediff-default-filtering-regexp)) ) - (list (ediff-read-file-name - "Directory to merge with revisions and ancestors:" dir-A nil) + (list (read-directory-name + "Directory to merge with revisions and ancestors:" + dir-A nil 'must-match) (read-string (if (stringp default-regexp) (format "Filter through regular expression (default %s): " @@ -733,11 +736,6 @@ names. Only the files that are under revision control are taken into account." (defun ediff-directories-internal (dir1 dir2 dir3 regexp action jobname &optional startup-hooks merge-autostore-dir) - ;; ediff-read-file-name is set to attach a previously entered file name if - ;; the currently entered file is a directory. This code takes care of that. - (setq dir1 (if (file-directory-p dir1) dir1 (file-name-directory dir1)) - dir2 (if (file-directory-p dir2) dir2 (file-name-directory dir2))) - (if (stringp dir3) (setq dir3 (if (file-directory-p dir3) dir3 (file-name-directory dir3)))) @@ -763,7 +761,7 @@ names. Only the files that are under revision control are taken into account." (ediff-merge-metajob jobname) (not merge-autostore-dir)) (setq merge-autostore-dir - (read-file-name "Save merged files in directory: " + (read-directory-name "Save merged files in directory: " (if ediff-use-last-dir ediff-last-merge-autostore-dir (ediff-strip-last-dir dir1)) @@ -823,7 +821,7 @@ names. Only the files that are under revision control are taken into account." (ediff-merge-metajob jobname) (not merge-autostore-dir)) (setq merge-autostore-dir - (read-file-name "Save merged files in directory: " + (read-directory-name "Save merged files in directory: " (if ediff-use-last-dir ediff-last-merge-autostore-dir (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 (setq ch (aref (read-key-sequence nil) 0))) (insert ch)) (t - (setq ch (read-char-exclusive)) + ;;(setq ch (read-char-exclusive)) + (setq ch (aref (read-key-sequence nil) 0)) ;; replace ^M with the newline (if (eq ch ?\C-m) (setq ch ?\n)) ;; Make sure ^V and ^Q work as quotation chars (if (memq ch '(?\C-v ?\C-q)) - (setq ch (read-char-exclusive))) + ;;(setq ch (read-char-exclusive)) + (setq ch (aref (read-key-sequence nil) 0)) + ) (insert ch)) ) (setq last-command-event @@ -1730,20 +1733,34 @@ invokes the command before that, etc." ;; undoing +;; hook used inside undo +(defvar viper-undo-functions nil) + +;; Runs viper-before-change-functions inside before-change-functions +(defun viper-undo-sentinel (beg end length) + (run-hook-with-args 'viper-undo-functions beg end length)) + +(add-hook 'after-change-functions 'viper-undo-sentinel) + +;; Hook used in viper-undo +(defun viper-after-change-undo-hook (beg end len) + (setq undo-beg-posn beg + undo-end-posn (or end beg)) + ;; some other hooks may be changing various text properties in + ;; the buffer in response to 'undo'; so remove this hook to avoid + ;; its repeated invocation + (remove-hook 'viper-undo-functions 'viper-after-change-undo-hook 'local)) + (defun viper-undo () "Undo previous change." (interactive) (message "undo!") (let ((modified (buffer-modified-p)) (before-undo-pt (point-marker)) - (after-change-functions after-change-functions) undo-beg-posn undo-end-posn) - ;; no need to remove this hook, since this var has scope inside a let. - (add-hook 'after-change-functions - '(lambda (beg end len) - (setq undo-beg-posn beg - undo-end-posn (or end beg)))) + ;; the viper-after-change-undo-hook removes itself after the 1st invocation + (add-hook 'viper-undo-functions 'viper-after-change-undo-hook nil 'local) (undo-start) (undo-more 2) @@ -1765,7 +1782,8 @@ invokes the command before that, etc." (goto-char undo-beg-posn))) (push-mark before-undo-pt t)) (if (and (eolp) (not (bolp))) (backward-char 1)) - (if (not modified) (set-buffer-modified-p t))) + ;;(if (not modified) (set-buffer-modified-p t)) + ) (setq this-command 'viper-undo)) ;; Continue undoing previous changes. @@ -1813,7 +1831,7 @@ invokes the command before that, etc." (setq viper-undo-needs-adjustment t))))) - +;;; Viper's destructive Command ring utilities (defun viper-display-current-destructive-command () (let ((text (nth 4 viper-d-com)) @@ -1927,12 +1945,15 @@ Undo previous insertion and inserts new." (end-of-line) ;; make sure all lines end with newline, unless in the minibuffer or ;; when requested otherwise (require-final-newline is nil) - (if (and (eobp) - (not (bolp)) - require-final-newline - (not (viper-is-in-minibuffer)) - (not buffer-read-only)) - (insert "\n")))) + (save-restriction + (widen) + (if (and (eobp) + (not (bolp)) + require-final-newline + (not (viper-is-in-minibuffer)) + (not buffer-read-only)) + (insert "\n"))) + )) (defun viper-yank-defun () (mark-defun) @@ -3045,19 +3066,34 @@ On reaching beginning of line, stop and signal error." (setq this-command 'next-line) (if com (viper-execute-com 'viper-next-line val com)))) + (defun viper-next-line-at-bol (arg) - "Next line at beginning of line." + "Next line at beginning of line. +If point is on a widget or a button, simulate clicking on that widget/button." (interactive "P") - (viper-leave-region-active) - (save-excursion - (end-of-line) - (if (eobp) (error "Last line in buffer"))) - (let ((val (viper-p-val arg)) - (com (viper-getCom arg))) - (if com (viper-move-marker-locally 'viper-com-point (point))) - (forward-line val) - (back-to-indentation) - (if com (viper-execute-com 'viper-next-line-at-bol val com)))) + (let* ((field (get-char-property (point) 'field)) + (button (get-char-property (point) 'button)) + (doc (get-char-property (point) 'widget-doc)) + (widget (or field button doc))) + (if (and widget + (if (symbolp widget) + (get widget 'widget-type) + (and (consp widget) + (get (widget-type widget) 'widget-type)))) + (widget-button-press (point)) + (if (button-at (point)) + (push-button) + ;; not a widget or a button + (viper-leave-region-active) + (save-excursion + (end-of-line) + (if (eobp) (error "Last line in buffer"))) + (let ((val (viper-p-val arg)) + (com (viper-getCom arg))) + (if com (viper-move-marker-locally 'viper-com-point (point))) + (forward-line val) + (back-to-indentation) + (if com (viper-execute-com 'viper-next-line-at-bol val com))))))) (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 @@ (defsubst viper-get-cursor-color () (viper-cond-compile-for-xemacs-or-emacs - ;; xemacs - (color-instance-name (frame-property (selected-frame) 'cursor-color)) + (color-instance-name + (frame-property (selected-frame) 'cursor-color)) ; xemacs (cdr (assoc 'cursor-color (frame-parameters))) ; emacs )) 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." (defun viper-mode () "Turn on Viper emulation of Vi in Emacs. See Info node `(viper)Viper'." (interactive) + (if (null viper-vi-state-cursor-color) + (modify-frame-parameters + (selected-frame) + (list (cons 'viper-vi-state-cursor-color (viper-get-cursor-color))))) (if (not noninteractive) (progn ;; if the user requested viper-mode explicitly @@ -545,8 +549,6 @@ If Viper is enabled, turn it off. Otherwise, turn it on." (if viper-first-time ; Important check. Prevents mix-up of startup (progn ; and expert-level msgs when viper-mode recurses (setq viper-first-time nil) - (setq viper-vi-state-cursor-color - (viper-get-cursor-color)) (if (not viper-inhibit-startup-message) (save-window-excursion (setq viper-inhibit-startup-message t) From e651696081c8baa0d608ad8df4eeeaa8f03aa06c Mon Sep 17 00:00:00 2001 From: Michael Kifer Date: Sun, 18 Jun 2006 17:12:16 +0000 Subject: [PATCH 04/20] 2006-06-18 Michael Kifer some typo fixes --- man/ediff.texi | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/man/ediff.texi b/man/ediff.texi index c9778ce90f9..7a4c929a0eb 100644 --- a/man/ediff.texi +++ b/man/ediff.texi @@ -1614,6 +1614,9 @@ The variable @code{ediff-ignore-case} controls whether Ediff starts out by ignoring letter case or not. It can be set in @file{.emacs} using @code{setq-default}. +When case sensitivity is toggled, all difference +regions are recomputed. + @node Highlighting Difference Regions, Narrowing, Selective Browsing, Customization @section Highlighting Difference Regions @@ -2316,6 +2319,14 @@ prior to starting Ediff, so Ediff just preserves status quo here. Using @code{ediff-cleanup-hook}, one can make Ediff delete the variants unconditionally (e.g., by making @code{ediff-janitor} into one of these hooks). + +@item ediff-keep-tmp-versions +@vindex @code{ediff-keep-tmp-versions} +Default is @code{nil}. If @code{t}, the versions of the files being +compared or merged using operations such as @code{ediff-revision} or +@code{ediff-merge-revisions} are not deleted on exit. The normal action is +to clean up and delete these version files. + @item ediff-grab-mouse @vindex @code{ediff-grab-mouse} Default is @code{t}. Normally, Ediff grabs mouse and puts it in its @@ -2457,6 +2468,7 @@ Karl Heuer (kwzh@@gnu.org), (jaffe@@chipmunk.cita.utoronto.ca), David Karr (dkarr@@nmo.gtegsc.com), Norbert Kiesel (norbert@@i3.informatik.rwth-aachen.de), +Steffen Kilb (skilb@@gmx.net), Leigh L Klotz (klotz@@adoc.xerox.com), Fritz Knabe (Fritz.Knabe@@ecrc.de), Heinz Knutzen (hk@@informatik.uni-kiel.d400.de), From 0fee8d6e467f0f96675915d930ed5a5d029d87a7 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 19 Jun 2006 06:54:22 +0000 Subject: [PATCH 05/20] Require noutline, also on XEmacs. (org-end-of-subtree): Return point. (org-dblock-start-re, org-dblock-end-re): New constants. (org-create-dblock, org-prepare-dblock, org-map-dblocks) (org-dblock-update, org-update-dblock, org-beginning-of-dblock) (org-update-all-dblocks, org-find-dblock): New functions. (org-collect-clock-time-entries): New function. (org-html-handle-time-stamps): Never export CLOCK timeranges. (org-fixup-indentation): Modified to deadl correctly with lines starting with TAB. Only one argument DIFF now. (org-demote, org-promote): Call `org-fixup-indentation' with just one argument, DIFF. (org-mode): Don't mark buffer as modified when aligning tables. (org-clock-sum): Don't makr buffer modified when adding time sum properties. (org-export-as-html): Added support for a link validation function. (org-archive-all-done): New function. (org-archive-subtree): New prefix argument. When set, archive all done subtrees in this buffer. (org-remove-clock-overlays) (org-remove-occur-highlights): Use `org-inhibit-highlight-removal'. (org-inhibit-highlight-removal): New variable, for dyn amic scoping. (org-put-clock-overlay): Don't swallow last headline character when displaying overlay. (org-store-link): Link to `image-mode' with just the file name. --- lisp/textmodes/org.el | 694 ++++++++++++++++++++++++++++++------------ man/ChangeLog | 8 + 2 files changed, 508 insertions(+), 194 deletions(-) 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 @@ ;; Author: Carsten Dominik ;; Keywords: outlines, hypermedia, calendar, wp ;; Homepage: http://www.astro.uva.nl/~dominik/Tools/org/ -;; Version: 4.36b +;; Version: 4.38 ;; ;; This file is part of GNU Emacs. ;; @@ -90,6 +90,14 @@ ;; ;; Recent changes ;; -------------- +;; Version 4.38 +;; - noutline.el is now required (important for XEmacs users only). +;; - Dynamic blocks. +;; - Archiving of all level 1 trees without open TODO items. +;; - Clock reports can be inserted into the file in a special section. +;; - FAQ removed from the manual, now only on the web. +;; - Bug fixes. +;; ;; Version 4.37 ;; - Clock-feature for measuring time spent on specific items. ;; - Improved emphasizing allows configuration and stacking. @@ -170,13 +178,18 @@ (eval-when-compile (require 'cl) (require 'calendar)) -(require 'outline) +;; For XEmacs, noutline is not yet provided by outline.el, so arrange for +;; the file noutline.el being loaded. +(if (featurep 'xemacs) (condition-case nil (require 'noutline))) +;; We require noutline, which might be provided in outline.el +(require 'outline) (require 'noutline) +;; Other stuff we need. (require 'time-date) (require 'easymenu) ;;; Customization variables -(defvar org-version "4.36b" +(defvar org-version "4.38" "The version number of the file org.el.") (defun org-version () (interactive) @@ -2202,7 +2215,7 @@ stacked Non-nil means, allow stacked styles. This works only in HTML `org-emphasis-alist') will be allowed as pre/post, aiding inside-out matching. Use customize to modify this, or restart emacs after changing it." - :group 'org-fixme + :group 'org-font-lock :set 'org-set-emph-re :type '(list (sexp :tag "Allowed chars in pre ") @@ -2216,19 +2229,23 @@ Use customize to modify this, or restart emacs after changing it." '(("*" bold "" "") ("/" italic "" "") ("_" underline "" "") - ("=" shadow "" "")) + ("=" shadow "" "") + ("+" (:strike-through t) "" "") +) "Special syntax for emphasised text. Text starting and ending with a special character will be emphasized, for example *bold*, _underlined_ and /italic/. This variable sets the marker characters, the face to bbe used by font-lock for highlighting in Org-mode emacs buffers, and the HTML tags to be used for this. Use customize to modify this, or restart emacs after changing it." - :group 'org-fixme + :group 'org-font-lock :set 'org-set-emph-re :type '(repeat (list (string :tag "Marker character") - (face :tag "Font-lock-face") + (choice + (face :tag "Font-lock-face") + (plist :tag "Face property list")) (string :tag "HTML start tag") (string :tag "HTML end tag")))) @@ -2708,6 +2725,7 @@ Also put tags into group 4 if tags are present.") (defvar gnus-group-name) ; from gnus (defvar gnus-article-current) ; from gnus (defvar w3m-current-url) ; from w3m +(defvar w3m-current-title) ; from w3m (defvar mh-progs) ; from MH-E (defvar mh-current-folder) ; from MH-E (defvar mh-show-folder-buffer) ; from MH-E @@ -2823,8 +2841,10 @@ The following commands are available: (insert " -*- mode: org -*-\n\n")) (unless org-inhibit-startup - (if org-startup-align-all-tables - (org-table-map-tables 'org-table-align)) + (when org-startup-align-all-tables + (let ((bmp (buffer-modified-p))) + (org-table-map-tables 'org-table-align) + (set-buffer-modified-p bmp))) (if org-startup-with-deadline-check (call-interactively 'org-check-deadlines) (cond @@ -3722,9 +3742,7 @@ in the region." (replace-match up-head nil t) ;; Fixup tag positioning (and org-auto-align-tags (org-set-tags nil t)) - (if org-adapt-indentation - (org-fixup-indentation (if (> diff 1) "^ " "^ ") "" - (if (> diff 1) "^ ? ?\\S-" "^ ?\\S-"))))) + (if org-adapt-indentation (org-fixup-indentation (- diff))))) (defun org-demote () "Demote the current heading lower down the tree. @@ -3737,8 +3755,7 @@ in the region." (replace-match down-head nil t) ;; Fixup tag positioning (and org-auto-align-tags (org-set-tags nil t)) - (if org-adapt-indentation - (org-fixup-indentation "^ " (if (> diff 1) " " " ") "^\\S-")))) + (if org-adapt-indentation (org-fixup-indentation diff)))) (defun org-map-tree (fun) "Call FUN for every heading underneath the current one." @@ -3767,20 +3784,23 @@ in the region." (not (eobp))) (funcall fun))))) -;; FIXME: this does not work well with Tabulators. This has to be re-written entirely. -(defun org-fixup-indentation (from to prohibit) - "Change the indentation in the current entry by re-replacing FROM with TO. -However, if the regexp PROHIBIT matches at all, don't do anything. -This is being used to change indentation along with the length of the -heading marker. But if there are any lines which are not indented, nothing -is changed at all." +(defun org-fixup-indentation (diff) + "Change the indentation in the current entry by DIFF +However, if any line in the current entry has no indentation, or if it +would end up with no indentation after the change, nothing at all is done." (save-excursion (let ((end (save-excursion (outline-next-heading) - (point-marker)))) + (point-marker))) + (prohibit (if (> diff 0) + "^\\S-" + (concat "^ \\{0," (int-to-string (- diff)) "\\}\\S-"))) + col) (unless (save-excursion (re-search-forward prohibit end t)) - (while (re-search-forward from end t) - (replace-match to) - (beginning-of-line 2))) + (while (re-search-forward "^[ \t]+" end t) + (goto-char (match-end 0)) + (setq col (current-column)) + (if (< diff 0) (replace-match "")) + (indent-to (+ diff col)))) (move-marker end nil)))) ;;; 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." (throw 'exit nil))) t)))) +(defun org-narrow-to-subtree () + "Narrow buffer to the current subtree." + (interactive) + (save-excursion + (narrow-to-region + (progn (org-back-to-heading) (point)) + (progn (org-end-of-subtree t) (point))))) + ;;; Plain list items (defun org-at-item-p () @@ -4292,103 +4320,259 @@ with something like \"1.\" or \"2)\"." ;;; Archiving -(defun org-archive-subtree () +(defun org-archive-subtree (&optional find-done) "Move the current subtree to the archive. The archive can be a certain top-level heading in the current file, or in a different file. The tree will be moved to that location, the subtree -heading be marked DONE, and the current time will be added." - (interactive) - ;; Save all relevant TODO keyword-relatex variables - (let ((tr-org-todo-line-regexp org-todo-line-regexp) ; keep despite compiler - (tr-org-todo-keywords org-todo-keywords) - (tr-org-todo-interpretation org-todo-interpretation) - (tr-org-done-string org-done-string) - (tr-org-todo-regexp org-todo-regexp) - (tr-org-todo-line-regexp org-todo-line-regexp) - (this-buffer (current-buffer)) - file heading buffer level newfile-p) - (if (string-match "\\(.*\\)::\\(.*\\)" org-archive-location) +heading be marked DONE, and the current time will be added. + +When called with prefix argument FIND-DONE, find whole trees without any +open TODO items and archive them (after getting confirmation from the user). +If the cursor is not at a headline when this comand is called, try all level +1 trees. If the cursor is on a headline, only try the direct children of +this heading. " + (interactive "P") + (if find-done + (org-archive-all-done) + ;; Save all relevant TODO keyword-relatex variables + + (let ((tr-org-todo-line-regexp org-todo-line-regexp) ; keep despite compiler + (tr-org-todo-keywords org-todo-keywords) + (tr-org-todo-interpretation org-todo-interpretation) + (tr-org-done-string org-done-string) + (tr-org-todo-regexp org-todo-regexp) + (tr-org-todo-line-regexp org-todo-line-regexp) + (this-buffer (current-buffer)) + file heading buffer level newfile-p) + (if (string-match "\\(.*\\)::\\(.*\\)" org-archive-location) + (progn + (setq file (format (match-string 1 org-archive-location) + (file-name-nondirectory buffer-file-name)) + heading (match-string 2 org-archive-location))) + (error "Invalid `org-archive-location'")) + (if (> (length file) 0) + (setq newfile-p (not (file-exists-p file)) + buffer (find-file-noselect file)) + (setq buffer (current-buffer))) + (unless buffer + (error "Cannot access file \"%s\"" file)) + (if (and (> (length heading) 0) + (string-match "^\\*+" heading)) + (setq level (match-end 0)) + (setq heading nil level 0)) + (save-excursion + ;; We first only copy, in case something goes wrong + ;; we need to protect this-command, to avoid kill-region sets it, + ;; which would lead to duplication of subtrees + (let (this-command) (org-copy-subtree)) + (set-buffer buffer) + ;; Enforce org-mode for the archive buffer + (if (not (eq major-mode 'org-mode)) + ;; Force the mode for future visits. + (let ((org-insert-mode-line-in-empty-file t)) + (call-interactively 'org-mode))) + (when newfile-p + (goto-char (point-max)) + (insert (format "\nArchived entries from file %s\n\n" + (buffer-file-name this-buffer)))) + ;; Force the TODO keywords of the original buffer + (let ((org-todo-line-regexp tr-org-todo-line-regexp) + (org-todo-keywords tr-org-todo-keywords) + (org-todo-interpretation tr-org-todo-interpretation) + (org-done-string tr-org-done-string) + (org-todo-regexp tr-org-todo-regexp) + (org-todo-line-regexp tr-org-todo-line-regexp)) + (goto-char (point-min)) + (if heading + (progn + (if (re-search-forward + (concat "\\(^\\|\r\\)" + (regexp-quote heading) "[ \t]*\\($\\|\r\\)") + nil t) + (goto-char (match-end 0)) + ;; Heading not found, just insert it at the end + (goto-char (point-max)) + (or (bolp) (insert "\n")) + (insert "\n" heading "\n") + (end-of-line 0)) + ;; Make the subtree visible + (show-subtree) + (org-end-of-subtree t) + (skip-chars-backward " \t\r\n]") + (and (looking-at "[ \t\r\n]*") + (replace-match "\n\n"))) + ;; No specific heading, just go to end of file. + (goto-char (point-max)) (insert "\n")) + ;; Paste + (org-paste-subtree (1+ level)) + ;; Mark the entry as done, i.e. set to last work in org-todo-keywords + (if org-archive-mark-done + (org-todo (length org-todo-keywords))) + ;; Move cursor to right after the TODO keyword + (when org-archive-stamp-time + (beginning-of-line 1) + (looking-at org-todo-line-regexp) + (goto-char (or (match-end 2) (match-beginning 3))) + (insert "(" (format-time-string (cdr org-time-stamp-formats) + (org-current-time)) + ")")) + ;; Save the buffer, if it is not the same buffer. + (if (not (eq this-buffer buffer)) (save-buffer)))) + ;; Here we are back in the original buffer. Everything seems to have + ;; worked. So now cut the tree and finish up. + (let (this-command) (org-cut-subtree)) + (if (and (not (eobp)) (looking-at "[ \t]*$")) (kill-line)) + (message "Subtree archived %s" + (if (eq this-buffer buffer) + (concat "under heading: " heading) + (concat "in file: " (abbreviate-file-name file))))))) + +(defun org-archive-all-done () + "Archive sublevels of the current tree without open TODO items. +If the cursor is not on a headline, try all level 1 trees. If +it is on a headline, try all direct children." + (let ((re (concat "^\\*+ +" org-not-done-regexp)) re1 + (begm (make-marker)) + (endm (make-marker)) + beg end (cntarch 0)) + (if (org-on-heading-p) (progn - (setq file (format (match-string 1 org-archive-location) - (file-name-nondirectory buffer-file-name)) - heading (match-string 2 org-archive-location))) - (error "Invalid `org-archive-location'")) - (if (> (length file) 0) - (setq newfile-p (not (file-exists-p file)) - buffer (find-file-noselect file)) - (setq buffer (current-buffer))) - (unless buffer - (error "Cannot access file \"%s\"" file)) - (if (and (> (length heading) 0) - (string-match "^\\*+" heading)) - (setq level (match-end 0)) - (setq heading nil level 0)) + (setq re1 (concat "^" (regexp-quote + (make-string + (1+ (- (match-end 0) (match-beginning 0))) + ?*)) + " ")) + (move-marker begm (point)) + (move-marker endm (org-end-of-subtree))) + (setq re1 "^* ") + (move-marker begm (point-min)) + (move-marker endm (point-max))) (save-excursion - ;; We first only copy, in case something goes wrong - ;; we need to protect this-command, to avoid kill-region sets it, - ;; which would lead to duplication of subtrees - (let (this-command) (org-copy-subtree)) - (set-buffer buffer) - ;; Enforce org-mode for the archive buffer - (if (not (eq major-mode 'org-mode)) - ;; Force the mode for future visits. - (let ((org-insert-mode-line-in-empty-file t)) - (call-interactively 'org-mode))) - (when newfile-p - (goto-char (point-max)) - (insert (format "\nArchived entries from file %s\n\n" - (buffer-file-name this-buffer)))) - ;; Force the TODO keywords of the original buffer - (let ((org-todo-line-regexp tr-org-todo-line-regexp) - (org-todo-keywords tr-org-todo-keywords) - (org-todo-interpretation tr-org-todo-interpretation) - (org-done-string tr-org-done-string) - (org-todo-regexp tr-org-todo-regexp) - (org-todo-line-regexp tr-org-todo-line-regexp)) - (goto-char (point-min)) - (if heading - (progn - (if (re-search-forward - (concat "\\(^\\|\r\\)" - (regexp-quote heading) "[ \t]*\\($\\|\r\\)") - nil t) - (goto-char (match-end 0)) - ;; Heading not found, just insert it at the end - (goto-char (point-max)) - (or (bolp) (insert "\n")) - (insert "\n" heading "\n") - (end-of-line 0)) - ;; Make the subtree visible - (show-subtree) - (org-end-of-subtree t) - (skip-chars-backward " \t\r\n]") - (and (looking-at "[ \t\r\n]*") - (replace-match "\n\n"))) - ;; No specific heading, just go to end of file. - (goto-char (point-max)) (insert "\n")) - ;; Paste - (org-paste-subtree (1+ level)) - ;; Mark the entry as done, i.e. set to last work in org-todo-keywords - (if org-archive-mark-done - (org-todo (length org-todo-keywords))) - ;; Move cursor to right after the TODO keyword - (when org-archive-stamp-time - (beginning-of-line 1) - (looking-at org-todo-line-regexp) - (goto-char (or (match-end 2) (match-beginning 3))) - (insert "(" (format-time-string (cdr org-time-stamp-formats) - (org-current-time)) - ")")) - ;; Save the buffer, if it is not the same buffer. - (if (not (eq this-buffer buffer)) (save-buffer)))) - ;; Here we are back in the original buffer. Everything seems to have - ;; worked. So now cut the tree and finish up. - (let (this-command) (org-cut-subtree)) - (if (and (not (eobp)) (looking-at "[ \t]*$")) (kill-line)) - (message "Subtree archived %s" - (if (eq this-buffer buffer) - (concat "under heading: " heading) - (concat "in file: " (abbreviate-file-name file)))))) + (goto-char begm) + (while (re-search-forward re1 endm t) + beg (match-beginning 0) + end (save-excursion (org-end-of-subtree t) (point))) + (goto-char beg) + (if (re-search-forward re end t) + (goto-char end) + (goto-char beg) + (if (y-or-n-p "Archive this subtree (no open TODO items)? ") + (progn + (org-archive-subtree) + (setq cntarch (1+ cntarch))) + (goto-char end)))) + (message "%d trees archived" cntarch))) + +;;; Dynamic blocks + +(defun org-find-dblock (name) + "Find the first dynamic block with name NAME in the buffer. +If not found, stay at current position and return nil." + (let (pos) + (save-excursion + (goto-char (point-min)) + (setq pos (and (re-search-forward (concat "^#\\+BEGIN:[ \t]+" name "\\>") + nil t) + (match-beginning 0)))) + (if pos (goto-char pos)) + pos)) + +(defconst org-dblock-start-re + "^#\\+BEGIN:[ \t]+\\(\\S-+\\)[ \t]+\\(.*\\)" + "Matches the startline of a dynamic block, with parameters.") + +(defconst org-dblock-end-re "^#\\+END\\([: \t\r\n]\\|$\\)" + "Matches the end of a dyhamic block.") + +(defun org-create-dblock (plist) + "Create a dynamic block section, with parameters taken from PLIST. +PLIST must containe a :name entry which is used as name of the block." + (unless (bolp) (newline)) + (let ((name (plist-get plist :name))) + (insert "#+BEGIN: " name) + (while plist + (if (eq (car plist) :name) + (setq plist (cddr plist)) + (insert " " (prin1-to-string (pop plist))))) + (insert "\n\n#+END:\n") + (beginning-of-line -2))) + +(defun org-prepare-dblock () + "Prepare dynamic block for refresh. +This empties the block, puts the cursor at the insert position and returns +the property list including an extra property :name with the block name." + (unless (looking-at org-dblock-start-re) + (error "Not at a dynamic block")) + (let* ((beg (match-beginning 0)) + (begdel (1+ (match-end 0))) + (name (match-string 1)) + (params (append (list :name name) + (read (concat "(" (match-string 2) ")"))))) + (unless (re-search-forward org-dblock-end-re nil t) + (error "Dynamic block not terminated")) + (delete-region begdel (match-beginning 0)) + (goto-char begdel) + (open-line 1) + params)) + +(defun org-map-dblocks (&optional command) + "Apply COMMAND to all dynamic blocks in the current buffer. +If COMMAND is not given, use `org-update-dblock'." + (let ((cmd (or command 'org-update-dblock)) + pos) + (save-excursion + (goto-char (point-min)) + (while (re-search-forward org-dblock-start-re nil t) + (goto-char (setq pos (match-beginning 0))) + (condition-case nil + (funcall cmd) + (error (message "Error during update of dynamic block"))) + (goto-char pos) + (unless (re-search-forward org-dblock-end-re nil t) + (error "Dynamic block not terminated")))))) + +(defun org-dblock-update (&optional arg) + "User command for updating dynamic blocks. +Update the dynamic block at point. With prefix ARG, update all dynamic +blocks in the buffer." + (interactive "P") + (if arg + (org-update-all-dblocks) + (or (looking-at org-dblock-start-re) + (org-beginning-of-dblock)) + (org-update-dblock))) + +(defun org-update-dblock () + "Update the dynamic block at point +This means to empty the block, parse for parameters and then call +the correct writing function." + (let* ((pos (point)) + (params (org-prepare-dblock)) + (name (plist-get params :name)) + (cmd (intern (concat "org-dblock-write:" name)))) + (funcall cmd params) + (goto-char pos))) + +(defun org-beginning-of-dblock () + "Find the beginning of the dynamic block at point. +Error if there is no scuh block at point." + (let ((pos (point)) + beg end) + (end-of-line 1) + (if (and (re-search-backward org-dblock-start-re nil t) + (setq beg (match-beginning 0)) + (re-search-forward org-dblock-end-re nil t) + (> (match-end 0) pos)) + (goto-char beg) + (goto-char pos) + (error "Not in a dynamic block")))) + +(defun org-update-all-dblocks () + "Update all dynamic blocks in the buffer. +This function can be used in a hook." + (when (eq major-mode 'org-mode) + (org-map-dblocks 'org-update-dblock))) + ;;; Completion @@ -4783,16 +4967,18 @@ that the match should indeed be shown." (org-overlay-put ov 'face 'secondary-selection) (push ov org-occur-highlights))) +(defvar org-inhibit-highlight-removal nil) (defun org-remove-occur-highlights (&optional beg end noremove) "Remove the occur highlights from the buffer. BEG and END are ignored. If NOREMOVE is nil, remove this function from the `before-change-functions' in the current buffer." (interactive) - (mapc 'org-delete-overlay org-occur-highlights) - (setq org-occur-highlights nil) - (unless noremove - (remove-hook 'before-change-functions - 'org-remove-occur-highlights 'local))) + (unless org-inhibit-highlight-removal + (mapc 'org-delete-overlay org-occur-highlights) + (setq org-occur-highlights nil) + (unless noremove + (remove-hook 'before-change-functions + 'org-remove-occur-highlights 'local)))) ;;; Priorities @@ -5449,8 +5635,8 @@ If there is no running clock, throw an error, unless FAIL-QUIETLY is set." "Sum the times for each subtree. Puts the resulting times in minutes as a text property on each headline." (interactive) - (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t)) - (let* ((re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" + (let* ((bmp (buffer-modified-p)) + (re (concat "^\\(\\*+\\)[ \t]\\|^[ \t]*" org-clock-string ".*=>[ \t]*\\([0-9]+\\):\\([0-9]+\\)[ \t]*$")) (lmax 30) @@ -5458,6 +5644,7 @@ Puts the resulting times in minutes as a text property on each headline." (t1 0) (level 0) (lastlevel 0) time) + (remove-text-properties (point-min) (point-max) '(:org-clock-minutes t)) (save-excursion (goto-char (point-max)) (while (re-search-backward re nil t) @@ -5475,7 +5662,8 @@ Puts the resulting times in minutes as a text property on each headline." (aset ltimes l 0)) (goto-char (match-beginning 0)) (put-text-property (point) (point-at-eol) :org-clock-minutes time)))) - (setq org-clock-file-total-minutes (aref ltimes 0))))) + (setq org-clock-file-total-minutes (aref ltimes 0))) + (set-buffer-modified-p bmp))) (defun org-clock-display (&optional total-only) "Show subtree times in the entire buffer. @@ -5510,11 +5698,11 @@ will be easy to remove." (off 0) ov tx) (move-to-column c) - (if (eolp) (setq off 1)) (unless (eolp) (skip-chars-backward "^ \t")) (skip-chars-backward " \t") - (setq ov (org-make-overlay (- (point) off) (point-at-eol)) - tx (concat (make-string (+ off (max 0 (- c (current-column)))) ?.) + (setq ov (org-make-overlay (1- (point)) (point-at-eol)) + tx (concat (buffer-substring (1- (point)) (point)) + (make-string (+ off (max 0 (- c (current-column)))) ?.) (org-add-props (format "%s %2d:%02d%s" (make-string l ?*) h m (make-string (- 10 l) ?\ )) @@ -5528,11 +5716,12 @@ will be easy to remove." BEG and END are ignored. If NOREMOVE is nil, remove this function from the `before-change-functions' in the current buffer." (interactive) - (mapc 'org-delete-overlay org-clock-overlays) - (setq org-clock-overlays nil) - (unless noremove - (remove-hook 'before-change-functions - 'org-remove-clock-overlays 'local))) + (unless org-inhibit-highlight-removal + (mapc 'org-delete-overlay org-clock-overlays) + (setq org-clock-overlays nil) + (unless noremove + (remove-hook 'before-change-functions + 'org-remove-clock-overlays 'local)))) (defun org-clock-out-if-current () "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." (when (y-or-n-p "Save changed buffer?") (save-buffer)))) +(defun org-clock-report () + "Create a table containing a report about clocked time. +If the buffer contains lines +#+BEGIN: clocktable :maxlevel 3 :emphasize nil + +#+END: clocktable +then the table will be inserted between these lines, replacing whatever +is was there before. If these lines are not in the buffer, the table +is inserted at point, surrounded by the special lines. +The BEGIN line can contain parameters. Allowed are: +:maxlevel The maximum level to be included in the table. Default is 3. +:emphasize t/nil, if levell 1 and level 2 should be bold/italic in the table." + (interactive) + (org-remove-clock-overlays) + (unless (org-find-dblock "clocktable") + (org-create-dblock (list :name "clocktable" + :maxlevel 2 :emphasize nil))) + (org-update-dblock)) + +(defun org-dblock-write:clocktable (params) + "Write the standard clocktable." + (let ((hlchars '((1 . "*") (2 . ?/))) + (emph nil) + (pos (point)) ipos + (ins (make-marker)) + time h m p level hlc hdl maxlevel) + (setq maxlevel (or (plist-get params :maxlevel) 3) + emph (plist-get params :emphasize)) + (move-marker ins (point)) + (setq ipos (point)) + (insert-before-markers "Clock summary at [" + (substring + (format-time-string (cdr org-time-stamp-formats)) + 1 -1) + "]\n|L|Headline|Time|\n") + (org-clock-sum) + (setq h (/ org-clock-file-total-minutes 60) + m (- org-clock-file-total-minutes (* 60 h))) + (insert-before-markers "|-\n|0|" "*Total file time*| " + (format "*%d:%02d*" h m) + "|\n") + (goto-char (point-min)) + (while (setq p (next-single-property-change (point) :org-clock-minutes)) + (goto-char p) + (when (setq time (get-text-property p :org-clock-minutes)) + (beginning-of-line 1) + (when (and (looking-at "\\(\\*+\\)[ \t]+\\(.*?\\)\\([ \t]+:[0-9a-zA-Z_@:]+:\\)?[ \t]*$") + (setq level (- (match-end 1) (match-beginning 1))) + (<= level maxlevel)) + (setq hlc (if emph (or (cdr (assoc level hlchars)) "") "") + hdl (match-string 2) + h (/ time 60) + m (- time (* 60 h))) + (save-excursion + (goto-char ins) + (if (= level 1) (insert-before-markers "|-\n")) + (insert-before-markers + "| " (int-to-string level) "|" hlc hdl hlc " |" + (make-string (1- level) ?|) + hlc + (format "%d:%02d" h m) + hlc + " |\n"))))) + (goto-char ins) + (backward-delete-char 1) + (goto-char ipos) + (skip-chars-forward "^|") + (org-table-align))) + +(defun org-collect-clock-time-entries () + "Return an internal list with clocking information. +This list has one entry for each CLOCK interval. +FIXME: describe the elements." + (interactive) + (let ((re (concat "^[ \t]*" org-clock-string + " *\\[\\(.*?\\)\\]--\\[\\(.*?\\)\\]")) + rtn beg end next cont level title total closedp leafp + clockpos titlepos h m donep) + (save-excursion + (org-clock-sum) + (goto-char (point-min)) + (while (re-search-forward re nil t) + (setq clockpos (match-beginning 0) + beg (match-string 1) end (match-string 2) + cont (match-end 0)) + (setq beg (apply 'encode-time (org-parse-time-string beg)) + end (apply 'encode-time (org-parse-time-string end))) + (org-back-to-heading t) + (setq donep (org-entry-is-done-p)) + (setq titlepos (point) + total (or (get-text-property (1+ (point)) :org-clock-minutes) 0) + h (/ total 60) m (- total (* 60 h)) + total (cons h m)) + (looking-at "\\(\\*+\\) +\\(.*\\)") + (setq level (- (match-end 1) (match-beginning 1)) + title (org-match-string-no-properties 2)) + (save-excursion (outline-next-heading) (setq next (point))) + (setq closedp (re-search-forward org-closed-time-regexp next t)) + (goto-char next) + (setq leafp (and (looking-at "^\\*+ ") + (<= (- (match-end 0) (point)) level))) + (push (list beg end clockpos closedp donep + total title titlepos level leafp) + rtn) + (goto-char cont))) + (nreverse rtn))) + ;;; Agenda, and Diary Integration ;;; Define the mode @@ -9186,8 +9482,8 @@ For file links, arg negates `org-context-in-file-links'." (setq cpltxt (url-view-url t) link (org-make-link cpltxt))) ((eq major-mode 'w3m-mode) - (setq cpltxt w3m-current-url - link (org-make-link cpltxt))) + (setq cpltxt (or w3m-current-title w3m-current-url) + link (org-make-link w3m-current-url))) ((setq search (run-hook-with-args-until-success 'org-create-file-search-functions)) @@ -9195,6 +9491,11 @@ For file links, arg negates `org-context-in-file-links'." "::" search)) (setq cpltxt (or description link))) + ((eq major-mode 'image-mode) + (setq cpltxt (concat "file:" + (abbreviate-file-name buffer-file-name)) + link (org-make-link cpltxt))) + ((eq major-mode 'org-mode) ;; Just link to current headline (setq cpltxt (concat "file:" @@ -9414,7 +9715,9 @@ subdirectory. Otherwise, the link will be the absolute path as completed in the minibuffer (i.e. normally ~/path/to/file). With two \\[universal-argument] prefixes, enforce an absolute path even if the file -is in the current directory or below." +is in the current directory or below. +With three \\[universal-argument] prefixes, negate the meaning of +`org-keep-stored-link-after-insertion'." (interactive "P") (let (link desc entry remove file (pos (point))) (cond @@ -9430,7 +9733,7 @@ is in the current directory or below." (setq link (read-string "Link: " (org-link-unescape (org-match-string-no-properties 1))))) - (complete-file + ((equal complete-file '(4)) ;; Completing read for file names. (setq file (read-file-name "File: ")) (let ((pwd (file-name-as-directory (expand-file-name "."))) @@ -9455,7 +9758,8 @@ is in the current directory or below." org-insert-link-history (or (car (car org-stored-links))))) (setq entry (assoc link org-stored-links)) - (if (not org-keep-stored-link-after-insertion) + (if (funcall (if (equal complete-file '(64)) 'not 'identity) + (not org-keep-stored-link-after-insertion)) (setq org-stored-links (delq (assoc link org-stored-links) org-stored-links))) (setq link (if entry (nth 1 entry) link) @@ -12199,7 +12503,8 @@ ones and overrule settings in the other lists." \[X] publish... (project will be prompted for) \[A] publish all projects") (cmds - '((?v . org-export-visible) + '((?t . org-insert-export-options-template) + (?v . org-export-visible) (?a . org-export-as-ascii) (?h . org-export-as-html) (?b . org-export-as-html-and-open) @@ -12566,7 +12871,7 @@ translations. There is currently no way for users to extend this.") (match-string 1) "[[" (match-string 2) ":" (match-string 3) "]]") t t)) ;; Find multiline emphasis and put them into single line - (when (assq :emph-multiline parameters) + (when (memq :emph-multiline parameters) (goto-char (point-min)) (while (re-search-forward org-emph-re nil t) (subst-char-in-region (match-beginning 0) (match-end 0) ?\n ?\ t) @@ -12858,13 +13163,18 @@ command." (interactive (list (progn (message "Export visible: [a]SCII [h]tml [b]rowse HTML [x]OXO [ ]keep buffer") - (char-to-string (read-char-exclusive))) + (read-char-exclusive)) current-prefix-arg)) - (if (not (member type '("a" "\C-a" "b" "\C-b" "h" "x" " "))) + (if (not (member type '(?a ?\C-a ?b ?\C-b ?h ?x ?\ ))) (error "Invalid export key")) - ;; FIXME: do this more explicit? - (let* ((binding (key-binding (concat "\C-c\C-x" type))) - (keepp (equal type " ")) + (let* ((binding (cdr (assoc type + '((?a . org-export-as-ascii) + (?\C-a . org-export-as-ascii) + (?b . org-export-as-html-and-open) + (?\C-b . org-export-as-html-and-open) + (?h . org-export-as-html) + (?x . org-export-as-xoxo))))) + (keepp (equal type ?\ )) (file buffer-file-name) (buffer (get-buffer-create "*Org Export Visible*")) s e) @@ -13049,6 +13359,8 @@ org-mode's default settings, but still inferior to file-local settings." (org-infile-export-plist))) (style (plist-get opt-plist :style)) + (link-validate (plist-get opt-plist :link-validation-function)) + valid (odd org-odd-levels-only) (region-p (org-region-active-p)) (region @@ -13068,6 +13380,7 @@ org-mode's default settings, but still inferior to file-local settings." (file-name-sans-extension (file-name-nondirectory buffer-file-name)) ".html")) + (current-dir (file-name-directory buffer-file-name)) (buffer (find-file-noselect filename)) (levels-open (make-vector org-level-max nil)) (date (format-time-string "%Y/%m/%d" (current-time))) @@ -13314,6 +13627,10 @@ lang=\"%s\" xml:lang=\"%s\"> (if (string-match "::\\(.*\\)" filename) (setq search (match-string 1 filename) filename (replace-match "" t nil filename))) + (setq valid + (if (functionp link-validate) + (funcall link-validate filename current-dir) + t)) (setq file-is-image-p (string-match (org-image-file-name-regexp) filename)) (setq thefile (if abs-p (expand-file-name filename) filename)) @@ -13339,7 +13656,8 @@ lang=\"%s\" xml:lang=\"%s\"> (and org-export-html-inline-images (not descp)))) (concat "") - (concat "" desc ""))))) + (concat "" desc ""))) + (if (not valid) (setq rpl desc)))) ((member type '("bbdb" "vm" "wl" "mhe" "rmail" "gnus" "shell" "info" "elisp")) (setq rpl (concat "<" type ":" (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." (defun org-html-handle-time-stamps (s) "Format time stamps in string S, or remove them." - (let (r b) - (while (string-match org-maybe-keyword-time-regexp s) - (or b (setq b (substring s 0 (match-beginning 0)))) - (if (not org-export-with-timestamps) - (setq r (concat r (substring s 0 (match-beginning 0))) - s (substring s (match-end 0))) - (setq r (concat - r (substring s 0 (match-beginning 0)) - (if (match-end 1) - (format "@%s @" - (match-string 1 s))) - (format " @%s@" - (substring (match-string 3 s) 1 -1))) - s (substring s (match-end 0))))) - ;; Line break of line started and ended with time stamp stuff - (if (not r) - s - (setq r (concat r s)) - (unless (string-match "\\S-" (concat b s)) - (setq r (concat r "@
"))) - r))) + (catch 'exit + (let (r b) + (while (string-match org-maybe-keyword-time-regexp s) + ;; FIXME: is it good to never export CLOCK, or do we need control? + (if (and (match-end 1) (equal (match-string 1 s) org-clock-string)) + (throw 'exit "")) + (or b (setq b (substring s 0 (match-beginning 0)))) + (if (not org-export-with-timestamps) + (setq r (concat r (substring s 0 (match-beginning 0))) + s (substring s (match-end 0))) + (setq r (concat + r (substring s 0 (match-beginning 0)) + (if (match-end 1) + (format "@%s @" + (match-string 1 s))) + (format " @%s@" + (substring (match-string 3 s) 1 -1))) + s (substring s (match-end 0))))) + ;; Line break if line started and ended with time stamp stuff + (if (not r) + s + (setq r (concat r s)) + (unless (string-match "\\S-" (concat b s)) + (setq r (concat r "@
"))) + r)))) (defun org-html-protect (s) ;; convert & to &, < to < and > to > @@ -14212,6 +14534,7 @@ a time), or the day by one (if it does not contain a time)." ;; All the other keys (define-key org-mode-map "\C-c\C-a" 'show-all) ; in case allout messed up. +(define-key org-mode-map "\C-xns" 'org-narrow-to-subtree) (define-key org-mode-map "\C-c$" 'org-archive-subtree) (define-key org-mode-map "\C-c\C-j" 'org-goto) (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)." (define-key org-mode-map "\C-c~" 'org-table-create-with-table.el) (define-key org-mode-map "\C-c\C-q" 'org-table-wrap-region) (define-key org-mode-map "\C-c\C-e" 'org-export) -;(define-key org-mode-map "\C-c\C-xa" 'org-export-as-ascii) -;(define-key org-mode-map "\C-c\C-x\C-a" 'org-export-as-ascii) -;(define-key org-mode-map "\C-c\C-xv" 'org-export-visible) -;(define-key org-mode-map "\C-c\C-x\C-v" 'org-export-visible) -;; OPML support is only an option for the future -;(define-key org-mode-map "\C-c\C-xo" 'org-export-as-opml) -;(define-key org-mode-map "\C-c\C-x\C-o" 'org-export-as-opml) -;(define-key org-mode-map "\C-c\C-xi" 'org-export-icalendar-this-file) -;(define-key org-mode-map "\C-c\C-x\C-i" 'org-export-icalendar-all-agenda-files) -;(define-key org-mode-map "\C-c\C-xc" 'org-export-icalendar-combine-agenda-files) -;(define-key org-mode-map "\C-c\C-x\C-c" 'org-export-icalendar-combine-agenda-files) -;(define-key org-mode-map "\C-c\C-xt" 'org-insert-export-options-template) (define-key org-mode-map "\C-c:" 'org-toggle-fixed-width-section) -;(define-key org-mode-map "\C-c\C-xh" 'org-export-as-html) -;(define-key org-mode-map "\C-c\C-xx" 'org-export-as-xoxo) -;(define-key org-mode-map "\C-c\C-x\C-x" 'org-export-as-xoxo) -;(define-key org-mode-map "\C-c\C-xb" 'org-export-as-html-and-open) -;(define-key org-mode-map "\C-c\C-x\C-b" 'org-export-as-html-and-open) (define-key org-mode-map "\C-c\C-x\C-k" 'org-cut-special) (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)." (define-key org-mode-map "\C-c\C-x\C-o" 'org-clock-out) (define-key org-mode-map "\C-c\C-x\C-x" 'org-clock-cancel) (define-key org-mode-map "\C-c\C-x\C-d" 'org-clock-display) +(define-key org-mode-map "\C-c\C-x\C-r" 'org-clock-report) -;(define-key org-mode-map "\C-c\C-ef" 'org-publish-current-file) -;(define-key org-mode-map "\C-c\C-ep" 'org-publish-current-project) -;(define-key org-mode-map "\C-c\C-ec" 'org-publish) -;(define-key org-mode-map "\C-c\C-ea" 'org-publish-all) -;(define-key org-mode-map "\C-c\C-e\C-f" 'org-publish-current-file) -;(define-key org-mode-map "\C-c\C-e\C-p" 'org-publish-current-project) -;(define-key org-mode-map "\C-c\C-e\C-c" 'org-publish) -;(define-key org-mode-map "\C-c\C-e\C-a" 'org-publish-all) +(define-key org-mode-map "\C-c\C-x\C-u" 'org-dblock-update) (when (featurep 'xemacs) (define-key org-mode-map 'button3 'popup-mode-menu)) @@ -14785,6 +15085,7 @@ See the individual commands for more information." ["Clock out" org-clock-out t] ["Clock cancel" org-clock-cancel t] ["Display times" org-clock-display t] + ["Create clock table" org-clock-report t] "--" ["Record DONE time" (progn (setq org-log-done (not org-log-done)) @@ -15284,7 +15585,8 @@ When ENTRY is non-nil, show the entire entry." (forward-char -1) (if (memq (preceding-char) '(?\n ?\^M)) ;; leave blank line before heading - (forward-char -1)))))) + (forward-char -1))))) + (point)) (defun org-show-subtree () "Show everything after this heading at deeper levels." @@ -15334,8 +15636,12 @@ Show the heading too, if it is currently invisible." (org-invisible-p))) (org-show-hierarchy-above))) -;;; Finish up +;;; Experimental code + + +;;; Finish up + (provide 'org) (run-hooks 'org-load-hook) diff --git a/man/ChangeLog b/man/ChangeLog index 627f528de85..463646b6758 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,11 @@ +2006-06-19 Carsten Dominik + + * org.texi (Publishing links): Document the `:link-validation-function' + property. + (Extensions and Hacking): New chapter, includes some sections of the + "Miscellaneous" chapter. + + 2006-06-16 YAMAMOTO Mitsuharu * macos.texi (Mac Input): Add description of mac-function-modifier. From 5aafad2e4e26ab3bdde420760ab4e9d9b759fcdc Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 19 Jun 2006 06:54:43 +0000 Subject: [PATCH 06/20] (Publishing links): Document the `:link-validation-function' property. (Extensions and Hacking): New chapter, includes some sections of the "Miscellaneous" chapter. --- man/org.texi | 494 ++++++++++++++++++++++----------------------------- 1 file changed, 217 insertions(+), 277 deletions(-) diff --git a/man/org.texi b/man/org.texi index c88205887ba..4f614a6fe95 100644 --- a/man/org.texi +++ b/man/org.texi @@ -3,7 +3,7 @@ @setfilename ../info/org @settitle Org Mode Manual -@set VERSION 4.37 +@set VERSION 4.38 @set DATE June 2006 @dircategory Emacs @@ -86,6 +86,8 @@ Software Foundation raise funds for GNU development.'' * Exporting:: Sharing and publishing of notes * Publishing:: Create a web site of linked Org-mode files * Miscellaneous:: All the rest which did not fit elsewhere +* Extensions and Hacking:: +* History and Acknowledgments:: * Index:: The fast road to specific information * Key Index:: Key bindings and where they are described @@ -162,7 +164,7 @@ Timestamps Progress Logging -* Closing items:: When was this entry makred DONE? +* Closing items:: When was this entry marked DONE? * Clocking work time:: When exactly did you work on this item? Tags @@ -231,17 +233,19 @@ Miscellaneous * The very busy C-c C-c key:: When in doubt, press C-c C-c * Clean view:: Getting rid of leading stars in the outline * TTY keys:: Using Org-mode on a tty -* FAQ:: Frequently asked questions * Interaction:: Other Emacs packages * Bugs:: Things which do not work perfectly -* Acknowledgments:: These people provided feedback and more Interaction with other packages -* Extensions:: Third-party extensions for Org-mode * Cooperation:: Packages Org-mode cooperates with * Conflicts:: Packages that lead to conflicts +Extensions and Hacking + +* Extensions:: +* Dynamic blocks:: + @end detailmenu @end menu @@ -296,9 +300,10 @@ example: The Org-mode table editor can be integrated into any major mode by activating the minor Orgtbl-mode. +@cindex FAQ There is a website for Org-mode which provides links to the newest -version of Org-mode, as well as additional information, screen shots -and example files. This page is located at +version of Org-mode, as well as additional information, frequently asked +questions (FAQ), links to tutorials etc. This page is located at @uref{http://www.astro.uva.nl/~dominik/Tools/org/}. @page @@ -341,6 +346,10 @@ them together with @file{org-install.el} on your load path. Then add to (require 'org-install) @end lisp +If you use Org-mode with XEmacs, you also need to install the file +@file{noutline.el} from the @file{xemacs} subdirectory of the Org-mode +distribution. + @cindex org-mode, turning on With this setup, all files with extension @samp{.org} will be put into Org-mode. As an alternative, make the first line of a file look like @@ -621,9 +630,16 @@ to move the tree to an archive place, either in the same file under a special top-level heading, or even to a different file. @table @kbd @kindex C-c $ -@item @kbd{C-c $} +@item C-c $ Archive the subtree starting at the cursor position to the location given by @code{org-archive-location}. +@kindex C-u C-c $ +@item C-u C-c $ +When @kbd{C-c $} is called with @kbd{C-u} prefix argument, check for +(sub)trees without any open TODO items and offer to archive them. When +the cursor is on a headline when this command is called, inly check the +direct children of this headline. When the cursor is @emph{not} on a +headline, check all level 1 trees. @end table @cindex archive locations @@ -1674,7 +1690,11 @@ and activation}. Insert a link. This prompts for a link to be inserted into the buffer. You can just type a link, using text for an internal link, or one of the link type prefixes mentioned in the examples above. Through completion, -all links stored during the current session can be accessed. The link +all links stored during the current session can be +accessed@footnote{After insertion of a stored link, the link will be +removed from the list of stored links. To keep it in the list later +use, use a triple @kbd{C-u} prefix to @kbd{C-c C-l}, or configure the +option @code{org-keep-stored-link-after-insertion}.}. The link will be inserted into the buffer, along with a descriptive text. Note that you don't have to use this command to insert a link. Links in Org-mode are plain text, and you can type or paste them straight into @@ -2227,10 +2247,9 @@ brackets instead of angular brackets. @item Time range with CLOCK keyword @cindex CLOCK keyword When using the clock to time the work that is being done on specific -items, time ranges preceeded by the CLOCK keyword are inserted +items, time ranges preceded by the CLOCK keyword are inserted automatically into the file. The time stamps are enclosed in square brackets instead of angular brackets. @xref{Clocking work time}. -@c FIXME: Reference needed @end table @node Creating timestamps, Progress logging, Time stamps, Timestamps @@ -2376,7 +2395,7 @@ items in a project by starting and stopping a clock when you start and stop working on an aspect of a project. @menu -* Closing items:: When was this entry makred DONE? +* Closing items:: When was this entry marked DONE? * Clocking work time:: When exactly did you work on this item? @end menu @@ -2405,8 +2424,8 @@ each day, giving you an overview of what has been done on a day. Org-mode allows you to clock the time you spent on specific tasks in a project. When you start working on an item, you can start the clock. -When you stop working on that tast, or when you makr the task done, the -clock is stoppend and the corresponding time interval is recorded. It +When you stop working on that task, or when you mark the task done, the +clock is stopped and the corresponding time interval is recorded. It also computes the total time spent on each subtree of a project. @table @kbd @@ -2435,6 +2454,22 @@ puts overlays at the end of each headline, showing the total time recorded under that heading, including the time of any subheadings. You can use visibility cycling to study the tree, but the overlays disappear automatically when the buffer is changed. +@kindex C-c C-x C-r +@item C-c C-x C-r +Insert a dynamic block containing a clock report as an org-mode table +into the current file. +@example +#+BEGIN: clocktable :maxlevel 2 :emphasize nil + +#+END: clocktable +@end example +@noindent +If such a block already exists, its content is replaced by the new +table. The @samp{BEGIN} line can specify options: +@example +:maxlevels @r{Maximum level depth to which times are listed in the table.} +:emphasize @r{When @code{t}, emphasize level one and level two items} +@end example @end table The @kbd{l} key may be used in the timeline (@pxref{Timeline}) and in @@ -3765,6 +3800,24 @@ careful with relative pathnames, and provided you have also configured org-publish to upload the related files, these links will work too. @ref{Complex example} for an example of this usage. +Sometime an Org-mode file to be published may contain links that are +only valid in your production environment, but not in the publishing +location. In this case, use the property + +@multitable @columnfractions 0.4 0.6 +@item @code{:link-validation-function} +@tab Function to validate links +@end multitable + +@noindent +to define a function for checking link validity. This function must +accept two arguments, the file name and a directory relative to which +the file name is interpreted in the production environment. If this +function returns @code{nil}, then the HTML generator will only insert a +description into the HTML file, but no link. One option for this +function is @code{org-publish-validate-link} which checks if the given +file is part of any project in @code{org-publish-project-alist}. + @node Project page index, , Publishing links, Configuration @subsection Project page index @@ -3891,7 +3944,7 @@ Org uses timestamps to track when a file has changed. The above functions normally only publish changed files. You can override this and force publishing of all files by giving a prefix argument. -@node Miscellaneous, Index, Publishing, Top +@node Miscellaneous, Extensions and Hacking, Publishing, Top @chapter Miscellaneous @menu @@ -3901,10 +3954,8 @@ force publishing of all files by giving a prefix argument. * The very busy C-c C-c key:: When in doubt, press C-c C-c * Clean view:: Getting rid of leading stars in the outline * TTY keys:: Using Org-mode on a tty -* FAQ:: Frequently asked questions * Interaction:: Other Emacs packages * Bugs:: Things which do not work perfectly -* Acknowledgments:: These people provided feedback and more @end menu @node Completion, Customization, Miscellaneous, Miscellaneous @@ -4043,14 +4094,13 @@ The key @kbd{C-c C-c} has many purposes in org-mode, which are all mentioned scattered throughout this manual. One specific function of this key is to add @emph{tags} to a headline (@pxref{Tags}). In many other circumstances it means something like @emph{Hey Org-mode, look -here and update according to what you see here}. Here is a summary of what -this means in different contexts. +here and update according to what you see here}. Here is a summary of +what this means in different contexts. @itemize @minus -@c @item -@c If the cursor is in a headline, prompt for tags and insert them -@c into the current line, aligned to `org-tags-column'. When called -@c with prefix arg, realign all tags in the current buffer. +@item +If there are highlichts in the buffer from the creation of a sparse +tree, or from clock display, remove these highlights. @item If the cursor is in one of the special @code{#+KEYWORD} lines, this triggers scanning the buffer for these lines and updating the @@ -4180,7 +4230,7 @@ double-star-per-level convention with @kbd{M-x org-convert-to-odd-levels RET} in that file. The reverse operation is @kbd{M-x org-convert-to-oddeven-levels}. -@node TTY keys, FAQ, Clean view, Miscellaneous +@node TTY keys, Interaction, Clean view, Miscellaneous @section Using org-mode on a tty @cindex tty keybindings @@ -4217,251 +4267,19 @@ rather use @kbd{C-c .} to re-insert the timestamp. @item @kbd{S-@key{down}} @tab @kbd{C-c C-x @key{down}} @tab @end multitable -@node FAQ, Interaction, TTY keys, Miscellaneous -@section Frequently asked questions -@cindex FAQ - -@enumerate -@cindex @code{keymapp nil} error -@item @b{When I try to use Org-mode, I always get -@code{(wrong-type-argument keymapp nil)}}.@* -@cindex allout.el, conflict with -This is a conflict with an outdated version of the @file{allout.el}. -See @ref{Conflicts}. - -@item @b{Org-mode seems to be a useful default mode for the various -@file{README} files I have scattered through my directories. How do I -turn it on for all @file{README} files?} - -@lisp -(add-to-list 'auto-mode-alist '("README$" . org-mode)) -@end lisp - -@item @b{I would like to use editing features of org-mode in other -modes, is this possible?}@* -@c -Not really. For tables there is @code{orgtbl-mode} which implements the -table editor as a minor mode. For other features you need to switch to -Org-mode temporarily, or prepare text in a different buffer. - -@item @b{Can I get the visibility-cycling features in outline-mode and -outline-minor-mode?}@* -@c -Yes, these functions are written in a way that they are independent of -the outline setup. The following setup provides standard Org-mode -functionality in outline-mode on @key{TAB} and @kbd{S-@key{TAB}}. For -outline-minor-mode, we use @kbd{C-@key{TAB}} instead of @key{TAB}, -because @key{TAB} usually has mode-specific tasks. -@lisp -(add-hook 'outline-minor-mode-hook - (lambda () - (define-key outline-minor-mode-map [(control tab)] 'org-cycle) - (define-key outline-minor-mode-map [(shift tab)] 'org-global-cycle))) -(add-hook 'outline-mode-hook - (lambda () - (define-key outline-mode-map [(tab)] 'org-cycle) - (define-key outline-mode-map [(shift tab)] 'org-global-cycle))) -@end lisp - -Or check out @file{outline-magic.el}, which does this and also provides -promotion and demotion functionality. @file{outline-magic.el} is -available at @url{http://www.astro.uva.nl/~dominik/Tools/OutlineMagic}. - -@item @b{Some of my links stopped working after I upgraded to a version -4.20 or later. Why is this, and how can I fix it?}@* -@c -These must be links in plain text, containing white space, such as -@samp{bbdb:Richard Stallman}. You need to protect these links by -putting double brackets around them, like @samp{[[bbdb:Richard -Stallman]]}. - -@item @b{I see that Org-mode now creates links using the double bracket -convention that hides the link part and the brackets, only showing the -description part. How can I convert my old links to this new format?}@* -@c -Execute once in each Org-mode file: @kbd{M-x org-upgrade-old-links}. -This replaces angular brackets with the new link format. - -@item @b{I don't care if you find the new bracket links great, I am -attached to the old style using angular brackets and no hiding of the -link text. Please give them back to me, don't tell me it is not -possible!}@* -@c -Would I let you down like that? If you must, you can do this - -@lisp -(setq org-link-style 'plain - org-link-format "<%s>") -@end lisp - -@item @b{When I am executing shell/elisp links I always get a -confirmation prompt and need to type @kbd{yes @key{RET}}, that's 4 key -presses! Can I get rid of this?}@* -@c -@cindex shell links, confirmation -@cindex dangerous commands -The confirmation is there to protect you from unwantingly execute -potentially dangerous commands. For example, imagine a link -@samp{[[shell:rm -rf ~/*][Google Search]]}. In an Org-mode buffer, this -command would look like @samp{Google Search}, but really it would remove -your home directory. If you wish, you can make it easier to respond to -the query by setting @code{org-confirm-shell-link-function} and/or -@code{org-confirm-elisp-link-function} to @code{y-or-n-p}. Then a -single @kbd{y} keypress will be enough to confirm those links. It is -also possible to turn off this check entirely, but I do not recommend to -do this. Be warned. - -@item @b{All these stars are driving me mad, I just find the Emacs -outlines unreadable. Can't you just put white space and a single star as a -starter for headlines?}@* -@c -See @ref{Clean view}. - -@item @b{I would like to have two windows on the same Org-mode -file, but with different outline visibility. Is that possible?}@* -@c -@cindex @code{make-indirect-buffer} -@cindex indirect buffers -In GNU Emacs, you may use @emph{indirect buffers} which do exactly this. -See the documentation on the command @code{make-indirect-buffer}. In -XEmacs, this is currently not possible because of the different outline -implementation. - -@item @b{When I export my TODO list, every TODO item becomes a -separate section. How do I enforce these items to be exported as an -itemized list?}@* -@c -If you plan to use ASCII or HTML export, make sure things you want to -be exported as item lists are level 4 at least, even if that does mean -there is a level jump. For example: - -@example -* Todays top priorities -**** TODO write a letter to xyz -**** TODO Finish the paper -**** Pick up kids at the school -@end example - -Alternatively, if you need a specific value for the heading/item -transition in a particular file, use the @samp{+OPTIONS} line to -configure the @samp{H} switch. - -@example -+OPTIONS: H:2; ... -@end example - -@item @b{I would like to export only a subtree of my file to HTML. -How?}@* -@c -@cindex exporting a subtree -If you want to export a subtree, mark the subtree as region and then -export. Marking can be done with @kbd{C-c @@ C-x C-x}, for example. - -@item @b{Org-mode takes over the S-cursor keys. I also want to use -CUA-mode, is there a way to fix this conflict?}@* -Yes, see @ref{Conflicts}. - -@item @b{One of my table columns has started to fill up with -@samp{#ERROR}. What is going on?}@* -@c -Org-mode tried to compute the column from other fields using a -formula stored in the @samp{#+TBLFM:} line just below the table, and -the evaluation of the formula fails. Fix the fields used in the -formula, or fix the formula, or remove it! - -@item @b{When I am in the last column of a table and just above a -horizontal line in the table, pressing TAB creates a new table line -@i{before} the horizontal line. How can I quickly move to the line -@i{below} the horizontal line instead?}@* -@c -Press @key{down} (to get on the separator line) and then @key{TAB}. -Or configure the variable @code{org-table-tab-jumps-over-hlines}. - -@item @b{How can I change the indentation of an entire table without -fixing every line by hand?}@* -@c -@cindex indentation, of tables -The indentation of a table is set by the first line. So just fix the -indentation of the first line and realign with @key{TAB}. - -@item @b{Is it possible to include entries from org-mode files into my -emacs diary?}@* -@c -Since the org-mode agenda is much more powerful and can contain the -diary (@pxref{Calendar/Diary integration}), you should think twice -before deciding to do this. Integrating Org-mode information into the -diary is, however, possible. You need to turn on @emph{fancy diary -display} by setting in @file{.emacs}: - -@lisp -(add-hook 'diary-display-hook 'fancy-diary-display) -@end lisp - -Then include the following line into your @file{~/diary} file, in -order to get the entries from all files listed in the variable -@code{org-agenda-files}: - -@example -&%%(org-diary) -@end example -@noindent -You may also select specific files with - -@example -&%%(org-diary) ~/path/to/some/org-file.org -&%%(org-diary) ~/path/to/another/org-file.org -@end example - -If you now launch the calendar and press @kbd{d} to display a diary, the -headlines of entries containing a timestamp, date range, schedule, or -deadline referring to the selected date will be listed. Just like -Org-mode's agenda view, the diary for @emph{today} contains additional -entries for overdue deadlines and scheduled items. See also the -documentation of the @command{org-diary} function. Under XEmacs, it is -not possible to jump back from the diary to the org, this works only in -the agenda buffer. - -@end enumerate - - -@node Interaction, Bugs, FAQ, Miscellaneous +@node Interaction, Bugs, TTY keys, Miscellaneous @section Interaction with other packages @cindex packages, interaction with other Org-mode lives in the world of GNU Emacs and interacts in various ways with other code out there. @menu -* Extensions:: Third-party extensions for Org-mode * Cooperation:: Packages Org-mode cooperates with * Conflicts:: Packages that lead to conflicts @end menu -@node Extensions, Cooperation, Interaction, Interaction -@subsection Third-party extensions for Org-mode -The following extensions for Org-mode have been written by other people: - -@table @asis -@cindex @file{org-mouse.el} -@item @file{org-mouse.el} by Piotr Zielinski -This package implements extended mouse functionality for Org-mode. It -allows you to cycle visibility and to edit the document structure with -the mouse. Best of all, it provides a context-sensitive menu on -@key{mouse-3} that changes depending on the context of a mouse-click. -@file{org-mouse.el} is freely available at @url{http://www.cl.cam.ac.uk/~pz215/files/org-mouse.el}. -@cindex @file{org-publish.el} -@item @file{org-publish.el} by David O'Toole -This package provides facilities for publishing related sets of Org-mode -files together with linked files like images as a webpages. It is -highly configurable and can be used for other publishing purposes as -well. As of Org-mode version 4.30, @file{org-publish.el} is part of -the Org-mode distribution. It is not yet part of Emacs, however, due to -a pending copyright assignment. In the mean time, @file{org-publish.el} -can be downloaded from David's site: -@url{http://dto.freeshell.org/e/org-publish.el}. -@end table - -@node Cooperation, Conflicts, Extensions, Interaction +@node Cooperation, Conflicts, Interaction, Interaction @subsection Packages that Org-mode cooperates with @table @asis @@ -4538,7 +4356,7 @@ in the paragraph above about CUA mode also applies here. @end table -@node Bugs, Acknowledgments, Interaction, Miscellaneous +@node Bugs, , Interaction, Miscellaneous @section Bugs @cindex bugs @@ -4564,10 +4382,6 @@ When the application called by @kbd{C-c C-o} to open a file link fails (for example because the application does not exist or refuses to open the file), it does so silently. No error message is displayed. @item -Plain list items should be able to hold a TODO item. Unfortunately this -has so many technical problems that I will only consider this change for -the next major release (5.0). -@item The remote-editing commands in the agenda buffer cannot be undone with @code{undo} called from within the agenda buffer. But you can go to the corresponding buffer (using @key{TAB} or @key{RET} and execute @@ -4577,22 +4391,140 @@ Recalculating a table line applies the formulas from left to right. If a formula uses @emph{calculated} fields further down the row, multiple recalculation may be needed to get all fields consistent. @item -Several words in a row may @b{*be made bold*}, but this does not work if -the string is distributed over two lines. +A single letter cannot be made bold, for example @samp{*a*}. @item The exporters work well, but could be made more efficient. @end itemize -@node Acknowledgments, , Bugs, Miscellaneous -@section Acknowledgments + +@node Extensions and Hacking, History and Acknowledgments, Miscellaneous, Top +@appendix Extensions, Hooks and Hacking + +This appendix lists extensions for Org-mode written by other authors. +It also covers some aspects where users can easily extend the +functionality of Org-mode. + +@menu +* Extensions:: +* Dynamic blocks:: +@end menu + +@node Extensions, Dynamic blocks, Extensions and Hacking, Extensions and Hacking +@section Third-party extensions for Org-mode + +The following extensions for Org-mode have been written by other people: + +@table @asis +@cindex @file{org-mouse.el} +@item @file{org-mouse.el} by Piotr Zielinski +This package implements extended mouse functionality for Org-mode. It +allows you to cycle visibility and to edit the document structure with +the mouse. Best of all, it provides a context-sensitive menu on +@key{mouse-3} that changes depending on the context of a mouse-click. +@file{org-mouse.el} is freely available at @url{http://www.cl.cam.ac.uk/~pz215/files/org-mouse.el}. +@cindex @file{org-publish.el} +@item @file{org-publish.el} by David O'Toole +This package provides facilities for publishing related sets of Org-mode +files together with linked files like images as a webpages. It is +highly configurable and can be used for other publishing purposes as +well. As of Org-mode version 4.30, @file{org-publish.el} is part of the +Org-mode distribution. It is not yet part of Emacs, however, a delay +caused by the preparations for the 22.1 release. In the mean time, +@file{org-publish.el} can be downloaded from David's site: +@url{http://dto.freeshell.org/e/org-publish.el}. +@cindex @file{org-blog.el} +@item @file{org-blog.el} by David O'Toole +A blogging plug-in for @file{org-publish.el}. +@cindex @file{org-blogging.el} +@item @file{org-blogging.el} by Bastien Guerry +Publish Org-mode files as +blogs. @url{http://www.cognition.ens.fr/~guerry/org-blogging.html}. +@end table + +@node Dynamic blocks, , Extensions, Extensions and Hacking +@section Dynamic blocks + +Org-mode documents can contain @emph{dynamic blocks}. These are +specially marked regions that are updates by some user-written +function. A good example for such a block is the clock table inserted +by the command @kbd{C-c C-x C-r} (@pxref{Clocking work time}). + +Dynamic block are enclosed by a BEGIN-END structure that assigns a name +to the block and can also specify parameters for the function producing +the content of the block. + +@example +#+BEGIN: myblock :parameter1 value1 :parameter2 value2 ..... + +#+END: +@end example + +Dynamic blocks are updated with the following commands + +@table @kbd +@kindex C-c C-x C-u +@item C-c C-x C-u +Update dynamic block at point. +@kindex C-u C-c C-x C-u +@item C-u C-c C-x C-u +Update all dynamic blocks in the current file. +@end table + +Updating a dynamic block means to remove all the text between BEGIN and +END, parse the BEGIN line for parameters and then call the specific +writer function for this block to insert the new content. For a block +with name @code{myblock}, the writer function is +@code{org-dblock-write:myblock} with as only parameter a property list +with the parameters given in the begin line. Here is a trivial example +of a block that keeps track of when the block update function was last +run: + +@example +#+BEGIN: block-update-time :format "on %m/%d/%Y at %H:%M" + +#+END: +@end example + +@noindent +The corresponding block writer function could look like this: + +@lisp +(defun org-dblock-write:date-and-time (params) + (let ((fmt (or (plist-get params :format) "%d. %m. %Y"))) + (insert "Last block update at: " + (format-time-string fmt (current-time))))) +@end lisp + +If you want to make sure that all dynamic blocks are always up-to-date, +you could add the function @code{org-update-all-dblocks} to a hook, for +example @code{before-save-hook}. @code{org-update-all-dblocks} is +written in a way that is does nothing in buffers that are not in Org-mode. + + +@node History and Acknowledgments, Index, Extensions and Hacking, Top +@appendix History and Acknowledgments @cindex acknowledgments +@cindex history @cindex thanks -Org-mode was created by @value{AUTHOR}, who still maintains it at the -Org-mode homepage @uref{http://www.astro.uva.nl/~dominik/Tools/org/}. -The following people (in alphabetic order) have helped the development -along with ideas, suggestions and patches. Many thanks to all of you, -Org-mode would not be what it is without your input. +Org-mode was conceived in 2003 out of frustration over the user +interface of the emacs outline-mode. The first driver was simply to +make working with an outline tree possible without having to remember +more than 10 commands just for hiding and unhiding parts of the outline +tree, and to allow to restructure a tree easily. Visibility cycling and +structure editing were originally implemented in the package +@file{outline-magic.el}, but quickly moved to the more general +@file{org.el}. TODO entries and table support were added relatively +quickly, and pointed to the two main drivers of Org-mode: Creating a +new plain text mode with intuitive editing features, and to +incorporate project planning functionality directly into a notes file. + +Since the first release, hundreds of emails either directly to me or +later on @code{emacs-orgmode@@gnu.org} have been a constant source of +bug reports, feedback and new ideas. While I cannot mention everyone, I +try to keep here a list of the people who had significant +influence in shaping one or more aspects of Org-mode. Many thanks to +all of you. If I have forgotten someone, please accept my apologies. @itemize @bullet @item @@ -4607,8 +4539,9 @@ for Remember. @i{Pavel Chalmoviansky} influenced the agenda treatment of items with specified time. @item -@i{Gregory Chenov} patched support for lisp forms into table -calculations and improved XEmacs compatibility. +@i{Gregory Chernov} patched support for lisp forms into table +calculations and improved XEmacs compatibility, in particular by porting +@file{nouline.el} to XEmacs. @item @i{Sacha Chua} suggested to copy some linking code from Planner. @item @@ -4619,6 +4552,8 @@ patched CSS formatting into the HTML exporter, and inspired the agenda. @item @i{Nic Ferrier} contributed mailcap and XOXO support. @item +@i{Bastien Guerry} provoded extensive feedback. +@item @i{Kai Grossjohann} pointed out key-binding conflicts caused by Org-mode. @item @@ -4655,6 +4590,10 @@ other things. @item Linking to VM/BBDB/GNUS was inspired by @i{Tom Shannon}'s @file{organizer-mode.el}. +@c FIXME: +@c @item +@c @i{Daniel Sinder} came up with the idea if internal archiving my locking +@c subtrees. @item @i{David O'Toole} wrote @file{org-publish.el} and drafted the manual chapter about publishing. @@ -4684,9 +4623,10 @@ work on a tty. @i{Piotr Zielinski} wrote @file{org-mouse.el} and showed how to follow links with mouse-1. @end itemize - -@node Index, Key Index, Miscellaneous, Top -@chapter Index + + +@node Index, Key Index, History and Acknowledgments, Top +@unnumbered Index @printindex cp From 3d62681df6efe3920d26bf33df6523bbd5d67c92 Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 19 Jun 2006 06:55:27 +0000 Subject: [PATCH 07/20] *** empty log message *** --- etc/ChangeLog | 6 ++++++ lisp/ChangeLog | 32 ++++++++++++++++++++++++++++++++ man/ChangeLog | 1 - 3 files changed, 38 insertions(+), 1 deletion(-) diff --git a/etc/ChangeLog b/etc/ChangeLog index 3dc253983fb..b07d428efd9 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,9 @@ +2006-06-19 Carsten Dominik + + * orgcard.tex (section{Clocking Time}): Add new clocking + commands. + (section{Structure Editing}): Add global archiving command. + 2006-06-14 Thien-Thi Nguyen * yow.lines: Delete existing data; add a new entry. diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 9fd0500b825..3d00b4b06d6 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,35 @@ +2006-06-19 Carsten Dominik + + * textmodes/org.el: Require noutline, also on XEmacs. + (org-end-of-subtree): Return point. + (org-dblock-start-re, org-dblock-end-re): New constants. + (org-create-dblock, org-prepare-dblock, org-map-dblocks) + (org-dblock-update, org-update-dblock, org-beginning-of-dblock) + (org-update-all-dblocks, org-find-dblock): New functions. + (org-collect-clock-time-entries): New function. + (org-html-handle-time-stamps): Never export CLOCK timeranges. + (org-fixup-indentation): Modified to deadl correctly with lines + starting with TAB. Only one argument DIFF now. + (org-demote, org-promote): Call `org-fixup-indentation' with just + one argument, DIFF. + (org-mode): Don't mark buffer as modified when aligning tables. + (org-clock-sum): Don't makr buffer modified when adding time sum + properties. + (org-export-as-html): Added support for a link validation + function. + (org-archive-all-done): New function. + (org-archive-subtree): New prefix argument. When set, archive all + done subtrees in this buffer. + (org-remove-clock-overlays) + (org-remove-occur-highlights): Use + `org-inhibit-highlight-removal'. + (org-inhibit-highlight-removal): New variable, for dynamic + scoping. + (org-put-clock-overlay): Don't swallow last headline character + when displaying overlay. + (org-store-link): Link to `image-mode' with just the file name. + + 2006-06-18 Michael Kifer * viper-cmd.el (viper-special-read-and-insert-char): use diff --git a/man/ChangeLog b/man/ChangeLog index 463646b6758..4c46eeeeaf9 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -4,7 +4,6 @@ property. (Extensions and Hacking): New chapter, includes some sections of the "Miscellaneous" chapter. - 2006-06-16 YAMAMOTO Mitsuharu From 13db07e0a16cc73597c0783535c1e6a0f6cee4ca Mon Sep 17 00:00:00 2001 From: Carsten Dominik Date: Mon, 19 Jun 2006 06:55:37 +0000 Subject: [PATCH 08/20] (section{Clocking Time}): Add new clocking commands. (section{Structure Editing}): Add global archiving command. --- etc/orgcard.tex | 159 +++++++++++++++++++++++++----------------------- 1 file changed, 82 insertions(+), 77 deletions(-) diff --git a/etc/orgcard.tex b/etc/orgcard.tex index 646a03b0277..95e810e5ed5 100644 --- a/etc/orgcard.tex +++ b/etc/orgcard.tex @@ -1,5 +1,5 @@ % Reference Card for Org Mode -\def\orgversionnumber{4.37} +\def\orgversionnumber{4.38} \def\year{2006} % %**start of header @@ -288,10 +288,8 @@ \section{Visibility Cycling} \section{Motion} -\key{next heading}{C-c C-n} -\key{previous heading}{C-c C-p} -\key{next heading, same level}{C-c C-f} -\key{previous heading, same level}{C-c C-b} +\key{next/previous heading}{C-c C-n/p} +\key{next/previous heading, same level}{C-c C-f/b} \key{backward to higher level heading}{C-c C-u} \key{jump to another place in document}{C-c C-j} \key{previous/next plain list item}{S-UP/DOWN$^3$} @@ -306,13 +304,14 @@ \section{Structure Editing} \key{promote current subtree up one level}{M-S-LEFT} \key{demote current subtree down one level}{M-S-RIGHT} -\key{move subtree/list item up}{M-S-UP} -\key{move subtree/list item down}{M-S-DOWN} +\key{move subtree/list item up/down}{M-S-UP/DOWN} \key{kill subtree}{C-c C-x C-w} \key{copy subtree}{C-c C-x M-w} \key{yank subtree}{C-c C-x C-y} +\key{narrow buffer to current subtree}{C-x n s} \key{archive subtree}{C-c \$} +\key{archive all fully done children}{C-u C-c \$} To set archive location for current file, add a line like$^2$: \vskip -1mm \beginexample% @@ -329,18 +328,13 @@ \section{Filtering and Sparse Trees} %\key{agenda for the week}{C-c a$^1$} %\key{agenda for date at cursor}{C-c C-o} -\section{Tags} +\section{Dynamic Blocks} -\key{set tags for current heading}{C-c C-c} -\key{realign tags in all headings}{C-u C-c C-c} -\key{create sparse tree with matching tags}{C-c \\} -\key{globally (agenda) match tags at cursor}{C-c C-o} +\key{update dynamic block at point}{C-c C-x C-u} +\metax{update all dynamic blocks}{C-u C-c C-x C-u} \section{Tables} -%Org-mode has its own built-in intuitive table editor with unique -%capabilities. - {\bf Creating a table} %\metax{insert a new Org-mode table}{M-x org-table-create} @@ -466,6 +460,39 @@ \section{Links} %\key{\kbd{vm://myself@some.where.org/folder\#id}}{\rm VM remote} +\section{Remember-mode Integration} + +See the manual for how to make remember.el use Org-mode links and +files. The note-finishing command \kbd{C-c C-c} will first prompt for +an org file. In the file, find a location with: + +\key{rotate subtree visibility}{TAB} +\key{next heading}{DOWN} +\key{previous heading}{UP} + +Insert the note with one of the following: + +\key{as sublevel of heading at cursor}{RET} +\key{right here (cursor not on heading)}{RET} +\key{before current heading}{LEFT} +\key{after current heading}{RIGHT} +\key{shortcut to end of buffer (cursor at buf-start)}{RET} +\key{Abort}{q} + +\section{Completion} + +In-buffer completion completes TODO keywords at headline start, TeX +macros after ``{\tt \\}'', option keywords after ``{\tt \#-}'', TAGS +after ``{\tt :}'', and dictionary words elsewhere. + +\key{Complete word at point}{M-TAB} + + +\newcolumn +\title{Org-Mode Reference Card (2/2)} + +\centerline{(for version \orgversionnumber)} + \section{TODO Items} \key{rotate the state of the current item}{C-c C-t} @@ -480,6 +507,13 @@ \section{TODO Items} \key{\kbd{\#+SEQ_TODO: TODO TRY BLUFF DONE}}{\rm todo workflow} \key{\kbd{\#+TYP_TODO: Phil home work DONE}}{\rm todo types} +\section{Tags} + +\key{set tags for current heading}{C-c C-c} +\key{realign tags in all headings}{C-u C-c C-c} +\key{create sparse tree with matching tags}{C-c \\} +\key{globally (agenda) match tags at cursor}{C-c C-o} + \section{Timestamps} \key{prompt for date and insert timestamp}{C-c .} @@ -502,18 +536,15 @@ \section{Timestamps} %\key{... forward/backward one month}{M-S-LEFT/RIGT} -\newcolumn -\title{Org-Mode Reference Card (2/2)} - -\centerline{(for version \orgversionnumber)} - \section{Clocking Time} \key{start clock on current item}{C-c C-x C-i} \key{stop clock on current item}{C-c C-x C-o} \key{cancel current clock}{C-c C-x C-x} + \key{display total subtree times}{C-c C-x C-d} \key{remove displayed times}{C-c C-c} +\key{insert/update table with clock report}{C-c C-x C-r} \section{Agenda Views} @@ -577,7 +608,6 @@ \section{Agenda Views} \key{Stop the clock (clock-out)}{O} \key{Cancel current clock}{X} -\newcolumn {\bf Calendar commands} @@ -593,6 +623,13 @@ \section{Agenda Views} \key{quit agenda, remove agenda buffer}{q} \key{exit agenda, remove all agenda buffers}{x} +\section{Calendar and Diary Integration} + +To include entries from the Emacs diary in your Org-mode agenda: +\beginexample% +(setq org-agenda-include-diary t) +\endexample + \section{Exporting and Publishing} Exporting creates files with extensions {\it .txt\/} and {\it .html\/} @@ -629,18 +666,19 @@ \section{Exporting and Publishing} \key{language code for html}{\#+LANGUAGE:} \key{free text description of file}{\#+TEXT:} \key{... which can carry over multiple lines}{\#+TEXT:} -\key{settings for the export process - see below}{\#+OPTIONS:} +%\key{settings for the export process - see below}{\#+OPTIONS:} +\key{settings for the export process}{\#+OPTIONS:} -\key{set number of headline levels for export}{H:2} -\key{turn on/off section numbers}{num:t} -\key{turn on/off table of contents}{toc:t} -\key{turn on/off linebreak preservation}{\\n:nil} -\key{turn on/off quoted html tags}{@:t} -\key{turn on/off fixed width sections}{::t} -\key{turn on/off tables}{|:t} -\key{turn on/off \TeX\ syntax for sub/super-scripts}{\^{}:t} -\key{turn on/off emphasised text}{*:nil} -\key{turn on/off \TeX\ macros}{TeX:t} +%\key{set number of headline levels for export}{H:2} +%\key{turn on/off section numbers}{num:t} +%\key{turn on/off table of contents}{toc:t} +%\key{turn on/off linebreak preservation}{\\n:nil} +%\key{turn on/off quoted html tags}{@:t} +%\key{turn on/off fixed width sections}{::t} +%\key{turn on/off tables}{|:t} +%\key{turn on/off \TeX\ syntax for sub/super-scripts}{\^{}:t} +%\key{turn on/off emphasised text}{*:nil} +%\key{turn on/off \TeX\ macros}{TeX:t} {\bf Comments: Text not being exported} @@ -651,53 +689,20 @@ \section{Exporting and Publishing} \key{toggle COMMENT keyword on entry}{C-c ;} -\section{Completion} -In-buffer completion completes TODO keywords at headline start, TeX -macros after ``{\tt \\}'', option keywords after ``{\tt \#-}'', TAGS -after ``{\tt :}'', and dictionary words elsewhere. +%\section{CUA and pc-select compatibility}% -\key{Complete word at point}{M-TAB} - -\section{Calendar and Diary Integration} - -To include entries from the Emacs diary in your Org-mode agenda: -\beginexample% -(setq org-agenda-include-diary t) -\endexample - -\section{Remember-mode Integration} - -See the manual for how to make remember.el use Org-mode links and -files. The note-finishing command \kbd{C-c C-c} will first prompt for -an org file. In the file, find a location with: - -\key{rotate subtree visibility}{TAB} -\key{next heading}{DOWN} -\key{previous heading}{UP} - -Insert the note with one of the following: - -\key{as sublevel of heading at cursor}{RET} -\key{right here (cursor not on heading)}{RET} -\key{before current heading}{LEFT} -\key{after current heading}{RIGHT} -\key{shortcut to end of buffer (cursor at buf-start)}{RET} -\key{Abort}{q} - -\section{CUA and pc-select compatibility} - -Configure the variable {\tt org-CUA-compatibility} to make Org-mode -avoid the \kbd{S-} bindings used by these modes. When set, -Org-mode will change the following keybindings (also in the agenda -buffer, but not during date selection). See note mark four$^3$ -throughout the reference card. -%\vskip-mm -\beginexample -S-UP $\to$ M-p S-DOWN $\to$ M-n -S-LEFT $\to$ M-- S-RIGHT $\to$ M-+ -S-RET $\to$ C-S-RET -\endexample +%Configure the variable {\tt org-CUA-compatibility} to make Org-mode +%avoid the \kbd{S-} bindings used by these modes. When set, +%Org-mode will change the following keybindings (also in the agenda +%buffer, but not during date selection). See note mark four$^3$ +%throughout the reference card. +%%\vskip-mm +%\beginexample +%S-UP $\to$ M-p S-DOWN $\to$ M-n +%S-LEFT $\to$ M-- S-RIGHT $\to$ M-+ +%S-RET $\to$ C-S-RET +%\endexample \section{Notes} $^1$ This is only a suggestion for a binding of this command. Choose From 2aa8102725544afa6ddd17e8d288f300db08b956 Mon Sep 17 00:00:00 2001 From: Karl Berry Date: Mon, 19 Jun 2006 20:53:29 +0000 Subject: [PATCH 09/20] mention C-q --- man/ChangeLog | 4 ++++ man/info.texi | 9 +++++++++ 2 files changed, 13 insertions(+) diff --git a/man/ChangeLog b/man/ChangeLog index 4c46eeeeaf9..9de0e4a61be 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,7 @@ +2006-06-19 Karl Berry + + * info.texi (Advanced): mention C-q, especially with ?. + 2006-06-19 Carsten Dominik * org.texi (Publishing links): Document the `:link-validation-function' diff --git a/man/info.texi b/man/info.texi index f33038e0c30..308edf4b0d5 100644 --- a/man/info.texi +++ b/man/info.texi @@ -918,6 +918,15 @@ are using a stand-alone Info reader, there are additional commands specific to it, which are documented in several chapters of @ref{Top,, GNU Info, info-stnd, GNU Info}.) +@kindex C-q @r{(Info mode)} + One advanced command useful with most of the others described here +is @kbd{C-q}, which ``quotes'' the next character so that it is +entered literally (@pxref{Inserting Text,,,emacs,The GNU Emacs +Manual}). For example, pressing @kbd{?} ordinarily brings up a list +of completion possibilities. If you want to (for example) search for +an actual @samp{?} character, the simplest way is to insert it using +@kbd{C-q ?}. This works the same in Emacs and stand-alone Info. + @menu * Search Text:: How to search Info documents. * Search Index:: How to search the indices for specific subjects. From 161c71277e2a6d894989fd72e6381c76f46d9760 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 19 Jun 2006 21:46:54 +0000 Subject: [PATCH 10/20] (customize-option, customize-option-other-window): Error if SYMBOL is nil. --- lisp/cus-edit.el | 4 ++++ 1 file changed, 4 insertions(+) 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." (defun customize-option (symbol) "Customize SYMBOL, which must be a user option variable." (interactive (custom-variable-prompt)) + (unless symbol + (error "No variable specified")) (let ((basevar (indirect-variable symbol))) (custom-buffer-create (list (list basevar 'custom-variable)) (format "*Customize Option: %s*" @@ -1070,6 +1072,8 @@ then prompt for the MODE to customize." "Customize SYMBOL, which must be a user option variable. Show the buffer in another window, but don't select it." (interactive (custom-variable-prompt)) + (unless symbol + (error "No variable specified")) (let ((basevar (indirect-variable symbol))) (custom-buffer-create-other-window (list (list basevar 'custom-variable)) From 73c8f64c94e2fbac653615eaade01028c2d7bce7 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 19 Jun 2006 21:47:23 +0000 Subject: [PATCH 11/20] (mouse-drag-vertical-line-rightward-window): New function. (mouse-drag-vertical-line): Call it. --- lisp/mouse.el | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) 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." (mouse-drag-mode-line-1 start-event nil)))) +(defun mouse-drag-vertical-line-rightward-window (window) + "Return a window that is immediately to the right of WINDOW, or nil." + (let ((bottom (nth 3 (window-inside-edges window))) + (left (nth 0 (window-inside-edges window))) + best best-right + (try (previous-window window))) + (while (not (eq try window)) + (let ((try-top (nth 1 (window-inside-edges try))) + (try-bottom (nth 3 (window-inside-edges try))) + (try-right (nth 2 (window-inside-edges try)))) + (if (and (< try-top bottom) + (>= try-bottom bottom) + (< try-right left) + (or (null best-right) (> try-right best-right))) + (setq best-right try-right best try))) + (setq try (previous-window try))) + best)) + (defun mouse-drag-vertical-line (start-event) "Change the width of a window by dragging on the vertical line." (interactive "e") @@ -594,7 +612,8 @@ resized by dragging their header-line." ;; adjust the window on the left. (if (eq which-side 'right) (selected-window) - (previous-window)))) + (mouse-drag-vertical-line-rightward-window + (selected-window))))) (setq x (- (car (cdr mouse)) (if (eq which-side 'right) 0 2)) edges (window-edges window) From 562ca53878404370d0edd1991c9595a82b73a994 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 19 Jun 2006 21:48:41 +0000 Subject: [PATCH 12/20] (find-file-noselect): Improve the question wording. (basic-save-buffer-2): Mask UMASK against 666. --- lisp/files.el | 51 +++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 41 insertions(+), 10 deletions(-) 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." ;; hexl-mode. (not (eq major-mode 'hexl-mode))) (if (buffer-modified-p) - (if (y-or-n-p (if rawfile - "Save file and revisit literally? " - "Save file and revisit non-literally? ")) + (if (y-or-n-p + (format + (if rawfile + "The file %s is already visited normally, +and you have edited the buffer. Now you have asked to visit it literally, +meaning no coding system handling, format conversion, or local variables. +Emacs can only visit a file in one way at a time. + +Do you want to save the file, and visit it literally instead? " + "The file %s is already visited literally, +meaning no coding system handling, format conversion, or local variables. +You have edited the buffer. Now you have asked to visit the file normally, +but Emacs can only visit a file in one way at a time. + +Do you want to save the file, and visit it normally instead? ") + (file-name-nondirectory filename))) (progn (save-buffer) (find-file-noselect-1 buf filename nowarn rawfile truename number)) - (if (y-or-n-p (if rawfile - "Discard your edits and revisit file literally? " - "Discard your edits and revisit file non-literally? ")) + (if (y-or-n-p + (format + (if rawfile + "\ +Do you want to discard your changes, and visit the file literally now? " + "\ +Do you want to discard your changes, and visit the file normally now? "))) (find-file-noselect-1 buf filename nowarn rawfile truename number) (error (if rawfile "File already visited non-literally" "File already visited literally")))) - (if (y-or-n-p (if rawfile - "Revisit file literally? " - "Revisit file non-literally? ")) + (if (y-or-n-p + (format + (if rawfile + "The file %s is already visited normally. +You have asked to visit it literally, +meaning no coding system decoding, format conversion, or local variables. +But Emacs can only visit a file in one way at a time. + +Do you want to revisit the file literally now? " + "The file %s is already visited literally, +meaning no coding system decoding, format conversion, or local variables. +You have asked to visit it normally, +but Emacs can only visit a file in one way at a time. + +Do you want to revisit the file normally now? ") + (file-name-nondirectory filename))) (find-file-noselect-1 buf filename nowarn rawfile truename number) (error (if rawfile "File already visited non-literally" @@ -3631,7 +3661,8 @@ Before and after saving the buffer, this function runs ;; Since we have created an entirely new file, ;; make sure it gets the right permission bits set. (setq setmodes (or setmodes - (cons (or (file-modes buffer-file-name) umask) + (cons (or (file-modes buffer-file-name) + (logand ?\666 umask)) buffer-file-name))) ;; We succeeded in writing the temp file, ;; so rename it. From cbfe5f37efcf01726b3afa04f8853f9a7c644f8b Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 19 Jun 2006 21:49:57 +0000 Subject: [PATCH 13/20] (mode-line-format): Save some mode line space. --- lisp/bindings.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/bindings.el b/lisp/bindings.el index a2449798588..722de30280d 100644 --- a/lisp/bindings.el +++ b/lisp/bindings.el @@ -299,8 +299,7 @@ Keymap to display on minor modes.") 'mode-line-buffer-identification (propertize " " 'help-echo help-echo) 'mode-line-position - '(vc-mode vc-mode) - (propertize " " 'help-echo help-echo) + `(vc-mode ("" vc-mode ,(propertize " " 'help-echo help-echo))) 'mode-line-modes `(which-func-mode ("" which-func-format ,dashes)) `(global-mode-string (,dashes global-mode-string)) From dd73030d0109f890f8722b0b99dee406fcc96ba0 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 19 Jun 2006 21:53:40 +0000 Subject: [PATCH 14/20] (Bindat Spec): Clarify previous change. --- lispref/processes.texi | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lispref/processes.texi b/lispref/processes.texi index 0f0b617e36c..abaa607d1d4 100644 --- a/lispref/processes.texi +++ b/lispref/processes.texi @@ -2230,13 +2230,12 @@ of @var{form}. A non-@code{nil} result indicates a match. @var{tag} matches unconditionally if it is @code{t}. @end itemize -@item repeat @var{count} @var{field-spec}@dots{} -Process the set of @var{field-spec}s recursively, in order, and loop -starting from the first one, for @var{count} times overall (looping -@code{@var{count} @minus{} 1} times). -@var{count} may be an integer, or a list of one element naming a -previous field. For correct operation, each @var{field-spec} must -include a name. +@item repeat @var{count} @var{field-specs}@dots{} +Process the @var{field-specs} recursively, in order, then repeat +starting from the first one, processing all the specs @var{count} +times overall. @var{count} may be an integer, or a list of one +element that names a previous field. For correct operation, each spec +in @var{field-specs} must include a name. @end table @node Bindat Functions From aa7b08b445a4daba668ca13d95f428217b4691fd Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 19 Jun 2006 21:54:58 +0000 Subject: [PATCH 15/20] (init_syntax_once): Give most control chars' syntax Spunct. --- src/syntax.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/syntax.c b/src/syntax.c index 1c8d0debbf3..9af4773a01b 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -3122,6 +3122,20 @@ init_syntax_once () Vstandard_syntax_table = Fmake_char_table (Qsyntax_table, temp); + /* Control characters should not be whitespace. */ + temp = XVECTOR (Vsyntax_code_object)->contents[(int) Spunct]; + for (i = 0; i <= ' ' - 1; i++) + SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); + SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 0177, temp); + + /* Except that a few really are whitespace. */ + temp = XVECTOR (Vsyntax_code_object)->contents[(int) Swhitespace]; + SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, ' ', temp); + SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\t', temp); + SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, '\n', temp); + SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 015, temp); + SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, 014, temp); + temp = XVECTOR (Vsyntax_code_object)->contents[(int) Sword]; for (i = 'a'; i <= 'z'; i++) SET_RAW_SYNTAX_ENTRY (Vstandard_syntax_table, i, temp); From 5fe0b054a2d7769ddae70553253e6746b3bbdaaa Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 19 Jun 2006 21:59:30 +0000 Subject: [PATCH 16/20] (size_window): New arg FIRST_ONLY. All callers changed. (adjust_window_trailing_edge): Specially compute FIRST_PARALLEL for the case of a top-level window and the following minibuffer. Don't exit because of no `next' when there is a parent. Use the FIRST_ONLY feature when resizing following windows. --- src/window.c | 87 ++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 70 insertions(+), 17 deletions(-) diff --git a/src/window.c b/src/window.c index 6993f29e01d..69643ec669a 100644 --- a/src/window.c +++ b/src/window.c @@ -63,7 +63,7 @@ static void window_scroll_pixel_based P_ ((Lisp_Object, int, int, int)); static void window_scroll_line_based P_ ((Lisp_Object, int, int, int)); static int window_min_size_1 P_ ((struct window *, int)); static int window_min_size P_ ((struct window *, int, int, int *)); -static void size_window P_ ((Lisp_Object, int, int, int)); +static void size_window P_ ((Lisp_Object, int, int, int, int, int)); static int freeze_window_start P_ ((struct window *, void *)); static int window_fixed_size_p P_ ((struct window *, int, int)); static void enlarge_window P_ ((Lisp_Object, int, int)); @@ -2826,17 +2826,23 @@ shrink_windows (total, size, nchildren, shrinkable, /* Set WINDOW's height or width to SIZE. WIDTH_P non-zero means set WINDOW's width. Resize WINDOW's children, if any, so that they - keep their proportionate size relative to WINDOW. Propagate - WINDOW's top or left edge position to children. Delete windows - that become too small unless NODELETE_P is non-zero. + keep their proportionate size relative to WINDOW. + + If FIRST_ONLY is 1, change only the first of WINDOW's children when + they are in series. If LAST_ONLY is 1, change only the last of + WINDOW's children when they are in series. + + Propagate WINDOW's top or left edge position to children. Delete + windows that become too small unless NODELETE_P is non-zero. If NODELETE_P is 2, that means we do delete windows that are too small, even if they were too small before! */ static void -size_window (window, size, width_p, nodelete_p) +size_window (window, size, width_p, nodelete_p, first_only, last_only) Lisp_Object window; int size, width_p, nodelete_p; + int first_only, last_only; { struct window *w = XWINDOW (window); struct window *c; @@ -2911,6 +2917,7 @@ size_window (window, size, width_p, nodelete_p) if (!NILP (*sideward)) { + /* We have a chain of parallel siblings whose size should all change. */ for (child = *sideward; !NILP (child); child = c->next) { c = XWINDOW (child); @@ -2918,9 +2925,45 @@ size_window (window, size, width_p, nodelete_p) c->left_col = w->left_col; else c->top_line = w->top_line; - size_window (child, size, width_p, nodelete_p); + size_window (child, size, width_p, nodelete_p, + first_only, last_only); } } + else if (!NILP (*forward) && last_only) + { + /* Change the last in a series of siblings. */ + Lisp_Object last_child; + int child_size; + + for (child = *forward; !NILP (child); child = c->next) + { + c = XWINDOW (child); + last_child = child; + } + + child_size = XINT (width_p ? c->total_cols : c->total_lines); + size_window (last_child, + size - old_size + child_size, + width_p, nodelete_p, first_only, last_only); + } + else if (!NILP (*forward) && first_only) + { + /* Change the first in a series of siblings. */ + int child_size; + + child = *forward; + c = XWINDOW (child); + + if (width_p) + c->left_col = w->left_col; + else + c->top_line = w->top_line; + + child_size = XINT (width_p ? c->total_cols : c->total_lines); + size_window (child, + size - old_size + child_size, + width_p, nodelete_p, first_only, last_only); + } else if (!NILP (*forward)) { int fixed_size, each, extra, n; @@ -2928,7 +2971,7 @@ size_window (window, size, width_p, nodelete_p) int last_pos, first_pos, nchildren, total; int *new_sizes = NULL; - /* Determine the fixed-size portion of the this window, and the + /* Determine the fixed-size portion of this window, and the number of child windows. */ fixed_size = nchildren = nfixed = total = 0; for (child = *forward; !NILP (child); child = c->next, ++nchildren) @@ -2991,7 +3034,7 @@ size_window (window, size, width_p, nodelete_p) /* Set new height. Note that size_window also propagates edge positions to children, so it's not a no-op if we didn't change the child's size. */ - size_window (child, new_size, width_p, 1); + size_window (child, new_size, width_p, 1, first_only, last_only); /* Remember the bottom/right edge position of this child; it will be used to set the top/left edge of the next child. */ @@ -3010,7 +3053,7 @@ size_window (window, size, width_p, nodelete_p) int child_size; c = XWINDOW (child); child_size = width_p ? XINT (c->total_cols) : XINT (c->total_lines); - size_window (child, child_size, width_p, 2); + size_window (child, child_size, width_p, 2, first_only, last_only); } } } @@ -3026,7 +3069,7 @@ set_window_height (window, height, nodelete) int height; int nodelete; { - size_window (window, height, 0, nodelete); + size_window (window, height, 0, nodelete, 0, 0); } @@ -3041,7 +3084,7 @@ set_window_width (window, width, nodelete) int width; int nodelete; { - size_window (window, width, 1, nodelete); + size_window (window, width, 1, nodelete, 0, 0); } /* Change window heights in windows rooted in WINDOW by N lines. */ @@ -4281,8 +4324,8 @@ adjust_window_trailing_edge (window, delta, horiz_flag) if (NILP (window)) { - /* This can happen if WINDOW on the previous iteration was - at top level of the tree and we did not exit. */ + /* This happens if WINDOW on the previous iteration was + at top level of the window tree. */ Fset_window_configuration (old_config); error ("Specified window edge is fixed"); } @@ -4296,6 +4339,14 @@ adjust_window_trailing_edge (window, delta, horiz_flag) { if (! NILP (parent) && !NILP (XWINDOW (parent)->vchild)) first_parallel = XWINDOW (parent)->vchild; + else if (NILP (parent) && !NILP (p->next)) + { + /* Handle the vertical chain of main window and minibuffer + which has no parent. */ + first_parallel = window; + while (! NILP (XWINDOW (first_parallel)->prev)) + first_parallel = XWINDOW (first_parallel)->prev; + } } else { @@ -4304,8 +4355,10 @@ adjust_window_trailing_edge (window, delta, horiz_flag) } /* If this level's succession is in the desired dimension, - and this window is the last one, its trailing edge is fixed. */ - if (NILP (XWINDOW (window)->next) && NILP (first_parallel)) + and this window is the last one, and there is no higher level, + its trailing edge is fixed. */ + if (NILP (XWINDOW (window)->next) && NILP (first_parallel) + && NILP (parent)) { Fset_window_configuration (old_config); error ("Specified window edge is fixed"); @@ -4347,7 +4400,7 @@ adjust_window_trailing_edge (window, delta, horiz_flag) XSETINT (CURBEG (p->next), XINT (CURBEG (p->next)) + delta); size_window (p->next, XINT (CURSIZE (p->next)) - delta, - horiz_flag, 0); + horiz_flag, 0, 1, 0); break; } } @@ -4359,7 +4412,7 @@ adjust_window_trailing_edge (window, delta, horiz_flag) child = XWINDOW (child)->next) if (! EQ (child, window)) size_window (child, XINT (CURSIZE (child)) + delta, - horiz_flag, 0); + horiz_flag, 0, 0, 1); window = parent; } From a5bd14d3ec65acac1e548830d76de810742d4fd6 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Mon, 19 Jun 2006 22:00:00 +0000 Subject: [PATCH 17/20] *** empty log message *** --- etc/TODO | 2 ++ lisp/ChangeLog | 13 +++++++++++++ lispref/ChangeLog | 4 ++++ src/ChangeLog | 10 ++++++++++ 4 files changed, 29 insertions(+) diff --git a/etc/TODO b/etc/TODO index ea070e01398..155cb1c5148 100644 --- a/etc/TODO +++ b/etc/TODO @@ -305,6 +305,8 @@ typically due to pilot errors and should thus be in debug-ignored-errors. ** Check what hooks would help Emacspeak -- see the defadvising in W3. +** Add definitions for symbol properties, for documentation purposes. + ** Add horizontal scroll bars. ** Provide an optional feature which computes a scroll bar slider's diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 3d00b4b06d6..0bd199770ce 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,16 @@ +2006-06-19 Richard Stallman + + * bindings.el (mode-line-format): Save some mode line space. + + * files.el (find-file-noselect): Improve the question wording. + (basic-save-buffer-2): Mask UMASK against 666. + + * mouse.el (mouse-drag-vertical-line-rightward-window): New function. + (mouse-drag-vertical-line): Call it. + + * cus-edit.el (customize-option, customize-option-other-window): + Error if SYMBOL is nil. + 2006-06-19 Carsten Dominik * textmodes/org.el: Require noutline, also on XEmacs. diff --git a/lispref/ChangeLog b/lispref/ChangeLog index e965f92a279..ec4b3650f07 100644 --- a/lispref/ChangeLog +++ b/lispref/ChangeLog @@ -1,3 +1,7 @@ +2006-06-19 Richard Stallman + + * processes.texi (Bindat Spec): Clarify previous change. + 2006-06-16 Richard Stallman * tips.texi (Coding Conventions): Better explain conventions diff --git a/src/ChangeLog b/src/ChangeLog index 9401a93505f..444ec6bd736 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,13 @@ +2006-06-19 Richard Stallman + + * window.c (size_window): New arg FIRST_ONLY. All callers changed. + (adjust_window_trailing_edge): Specially compute FIRST_PARALLEL + for the case of a top-level window and the following minibuffer. + Don't exit because of no `next' when there is a parent. + Use the FIRST_ONLY feature when resizing following windows. + + * syntax.c (init_syntax_once): Give most control chars' syntax Spunct. + 2006-06-17 Kim F. Storm * dispnew.c (update_frame): Check for input pending on entry. From 5cfd0f2e4f1b1eac1c39718cff4232cd7212c474 Mon Sep 17 00:00:00 2001 From: Miles Bader Date: Tue, 20 Jun 2006 00:20:01 +0000 Subject: [PATCH 18/20] Merge from gnus--rel--5.10 Patches applied: * gnus--rel--5.10 (patch 107) - Update from CVS Revision: emacs@sv.gnu.org/emacs--devo--0--patch-317 --- lisp/gnus/ChangeLog | 4 +++ lisp/gnus/message.el | 2 +- man/ChangeLog | 4 +++ man/message.texi | 83 ++++++++++++++++++++++++++------------------ 4 files changed, 59 insertions(+), 34 deletions(-) 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 @@ +2006-06-19 Katsumi Yamaoka + + * message.el (message-syntax-checks): Doc fix. + 2006-06-16 Katsumi Yamaoka * 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', `empty', `existing-newsgroups', `from', `illegible-text', `invisible-text', `long-header-lines', `long-lines', `message-id', `multiple-headers', `new-text', `newsgroups', `quoting-style', -`repeated-newsgroups', `reply-to', `sendsys', `shoot', +`repeated-newsgroups', `reply-to', `sender', `sendsys', `shoot', `shorten-followup-to', `signature', `size', `subject', `subject-cmsg' and `valid-newsgroups'." :group 'message-news diff --git a/man/ChangeLog b/man/ChangeLog index 9de0e4a61be..4f30e374e7b 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -1,3 +1,7 @@ +2006-06-19 Katsumi Yamaoka + + * message.texi (News Headers): Update message-syntax-checks section. + 2006-06-19 Karl Berry * info.texi (Advanced): mention C-q, especially with ?. diff --git a/man/message.texi b/man/message.texi index 58906595f8f..e6e27428aeb 100644 --- a/man/message.texi +++ b/man/message.texi @@ -1681,56 +1681,73 @@ to this list. Valid checks are: @table @code -@item subject-cmsg -Check the subject for commands. -@item sender -@cindex Sender -Insert a new @code{Sender} header if the @code{From} header looks odd. -@item multiple-headers -Check for the existence of multiple equal headers. -@item sendsys -@cindex sendsys -Check for the existence of version and sendsys commands. -@item message-id -Check whether the @code{Message-ID} looks ok. -@item from -Check whether the @code{From} header seems nice. -@item long-lines -@cindex long lines -Check for too long lines. -@item control-chars -Check for invalid characters. -@item size -Check for excessive size. -@item new-text -Check whether there is any new text in the messages. -@item signature -Check the length of the signature. @item approved @cindex approved Check whether the article has an @code{Approved} header, which is something only moderators should include. +@item continuation-headers +Check whether there are continuation header lines that don't begin with +whitespace. +@item control-chars +Check for invalid characters. @item empty Check whether the article is empty. -@item invisible-text -Check whether there is any invisible text in the buffer. -@item empty-headers -Check whether any of the headers are empty. @item existing-newsgroups Check whether the newsgroups mentioned in the @code{Newsgroups} and @code{Followup-To} headers exist. -@item valid-newsgroups -Check whether the @code{Newsgroups} and @code{Followup-to} headers -are valid syntactically. +@item from +Check whether the @code{From} header seems nice. +@item illegible-text +Check whether there is any non-printable character in the body. +@item invisible-text +Check whether there is any invisible text in the buffer. +@item long-header-lines +Check for too long header lines. +@item long-lines +@cindex long lines +Check for too long lines in the body. +@item message-id +Check whether the @code{Message-ID} looks syntactically ok. +@item multiple-headers +Check for the existence of multiple equal headers. +@item new-text +Check whether there is any new text in the messages. +@item newsgroups +Check whether the @code{Newsgroups} header exists and is not empty. +@item quoting-style +Check whether text follows last quoted portion. @item repeated-newsgroups Check whether the @code{Newsgroups} and @code{Followup-to} headers contains repeated group names. +@item reply-to +Check whether the @code{Reply-To} header looks ok. +@item sender +@cindex Sender +Insert a new @code{Sender} header if the @code{From} header looks odd. +@item sendsys +@cindex sendsys +Check for the existence of version and sendsys commands. +@item shoot +Check whether the domain part of the @code{Message-ID} header looks ok. @item shorten-followup-to Check whether to add a @code{Followup-to} header to shorten the number of groups to post to. +@item signature +Check the length of the signature. +@item size +Check for excessive size. +@item subject +Check whether the @code{Subject} header exists and is not empty. +@item subject-cmsg +Check the subject for commands. +@item valid-newsgroups +Check whether the @code{Newsgroups} and @code{Followup-to} headers +are valid syntactically. @end table -All these conditions are checked by default. +All these conditions are checked by default, except for @code{sender} +for which the check is disabled by default if +@code{message-insert-canlock} is non-@code{nil} (@pxref{Canceling News}). @item message-ignored-news-headers @vindex message-ignored-news-headers From 1c7f8620c763dc0df02f83d67bb3daf1a8490e8d Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Tue, 20 Jun 2006 01:31:25 +0000 Subject: [PATCH 19/20] (word-combining-categories): Add entries for 2-byte Han characters. --- lisp/international/characters.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/international/characters.el b/lisp/international/characters.el index 638d09eea6e..0b7c223c258 100644 --- a/lisp/international/characters.el +++ b/lisp/international/characters.el @@ -1258,7 +1258,10 @@ ;;; Setting word boundary. (setq word-combining-categories - '((?l . ?l))) + '((?l . ?l) + (?C . ?C) + (?C . ?H) + (?C . ?K))) (setq word-separating-categories ; (2-byte character sets) '((?A . ?K) ; Alpha numeric - Katakana From 1e0fd4cd530948277283d0fe7b07e00a73fee934 Mon Sep 17 00:00:00 2001 From: Kenichi Handa Date: Tue, 20 Jun 2006 02:06:13 +0000 Subject: [PATCH 20/20] *** empty log message *** --- lisp/ChangeLog | 5 +++++ man/ChangeLog | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 0bd199770ce..886fc6e3a77 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2006-06-20 Kenichi Handa + + * international/characters.el (word-combining-categories): Add + entries for 2-byte Han characters. + 2006-06-19 Richard Stallman * bindings.el (mode-line-format): Save some mode line space. diff --git a/man/ChangeLog b/man/ChangeLog index 4f30e374e7b..4b238b8a7ea 100644 --- a/man/ChangeLog +++ b/man/ChangeLog @@ -26,6 +26,11 @@ * mule.texi (Recognize Coding): Clarify previous change. +2006-06-09 Kenichi Handa + + * mule.texi (Recognize Coding): Describe the convention of "CODING!" + notation. + 2006-06-07 Kevin Ryde * mule.texi (Coding Systems): Footnote xref "MS-DOS and MULE" in main