From 11f19abcf2793ddc57bf36ac157cbfcf8c58c66c Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 8 Mar 2011 10:40:46 +0100 Subject: [PATCH 01/29] org-timer: fix bug with `org-timer-item' * lisp/org-timer.el (org-timer-item): save-excursion prevents `org-list-struct' to get the list structure when point isn't on the first line of the item. --- lisp/org-timer.el | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lisp/org-timer.el b/lisp/org-timer.el index aaa496e80..7cf4f0e82 100644 --- a/lisp/org-timer.el +++ b/lisp/org-timer.el @@ -207,21 +207,20 @@ it in the buffer." (defun org-timer-item (&optional arg) "Insert a description-type item with the current timer value." (interactive "P") - (let ((itemp (org-in-item-p))) + (let ((itemp (org-in-item-p)) (pos (point))) (cond ;; In a timer list, insert with `org-list-insert-item', ;; then fix the list. - ((and itemp - (save-excursion (goto-char itemp) (org-at-item-timer-p))) + ((and itemp (goto-char itemp) (org-at-item-timer-p)) (let* ((struct (org-list-struct)) (prevs (org-list-prevs-alist struct)) (s (concat (org-timer (when arg '(4)) t) ":: "))) - (setq struct (org-list-insert-item (point) struct prevs nil s)) + (setq struct (org-list-insert-item pos struct prevs nil s)) (org-list-write-struct struct (org-list-parents-alist struct)) (looking-at org-list-full-item-re) (goto-char (match-end 0)))) ;; In a list of another type, don't break anything: throw an error. - (itemp (error "This is not a timer list")) + (itemp (goto-char pos) (error "This is not a timer list")) ;; Else, start a new list. (t (beginning-of-line) From 4090006ab124dd10698f21f1ee44c913b5faf990 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Tue, 8 Mar 2011 23:49:39 +0100 Subject: [PATCH 02/29] org-list: fix confusion due to indent-tabs-mode --- lisp/org-list.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/org-list.el b/lisp/org-list.el index 1906d9573..430c9ffb9 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -1150,10 +1150,10 @@ This function modifies STRUCT." ;; BEFOREP and SPLIT-LINE-P. The difference of size ;; between what was cut and what was inserted in buffer ;; is stored in SIZE-OFFSET. - (ind (let ((ind-ref (org-list-get-ind item struct))) - (if (not indent-tabs-mode) - ind-ref - (+ (/ ind-ref tab-width) (mod ind-ref tab-width))))) + (ind (org-list-get-ind item struct)) + (ind-size (if indent-tabs-mode + (+ (/ ind tab-width) (mod ind tab-width)) + ind)) (bullet (org-list-bullet-string (org-list-get-bullet item struct))) (box (when checkbox "[ ]")) (text-cut @@ -1170,7 +1170,7 @@ This function modifies STRUCT." text-cut)) ""))) (item-sep (make-string (1+ blank-nb) ?\n)) - (item-size (+ ind (length body) (length item-sep))) + (item-size (+ ind-size (length body) (length item-sep))) (size-offset (- item-size (length text-cut)))) ;; 4. Insert effectively item into buffer (goto-char item) From f54814d108aa2efeaef7e9399e0ff634e0c7a643 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 9 Mar 2011 10:56:47 +0100 Subject: [PATCH 03/29] org-macs.el (org-with-wide-buffer): Bugfix. * org-macs.el (org-with-wide-buffer): Bugfix: use `save-excursion' and `save-restriction'. --- lisp/org-macs.el | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/lisp/org-macs.el b/lisp/org-macs.el index e67ddb876..5c1c6d281 100644 --- a/lisp/org-macs.el +++ b/lisp/org-macs.el @@ -334,13 +334,11 @@ point nowhere." data))))) (defmacro org-with-wide-buffer (&rest body) - "Execute body while temporarily widening the buffer." - `(let ((beg (point-min)) (end (point-max)) (pos (point))) - (prog2 - (widen) - ,@body - (narrow-to-region beg end) - (goto-char pos)))) + "Execute body while temporarily widening the buffer." + `(save-excursion + (save-restriction + (widen) + ,@body))) (defmacro org-with-limited-levels (&rest body) "Execute BODY with limited number of outline levels." From 85f03c0859d84d0b3b51764f379644d1461733df Mon Sep 17 00:00:00 2001 From: Jason Dunsmore Date: Tue, 15 Feb 2011 21:31:17 +0000 Subject: [PATCH 04/29] Bugfix: honor `org-blank-before-new-entry' correctly in various contexts. * org.el (org-back-over-empty-lines): Bugfix. Honor `org-blank-before-new-entry' correctly in various contexts. --- lisp/org.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 92f24065b..eda5fe247 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18773,10 +18773,10 @@ Taken from `count' in cl-seq.el with all keyword arguments removed." "Move backwards over whitespace, to the beginning of the first empty line. Returns the number of empty lines passed." (let ((pos (point))) - (skip-chars-backward " \t\n\r") - ;; (if (cdr (assoc 'heading org-blank-before-new-entry)) - ;; (skip-chars-backward " \t\n\r") - ;; (forward-line -1)) + ;;(skip-chars-backward " \t\n\r") + (if (cdr (assoc 'heading org-blank-before-new-entry)) + (skip-chars-backward " \t\n\r") + (forward-line -1)) (beginning-of-line 2) (goto-char (min (point) pos)) (count-lines (point) pos))) From e6d74f92539b2c2ecb2d6f2442a7cc5c86089d8f Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 9 Mar 2011 11:06:57 +0100 Subject: [PATCH 05/29] org.el: remove useless comment. --- lisp/org.el | 1 - 1 file changed, 1 deletion(-) diff --git a/lisp/org.el b/lisp/org.el index eda5fe247..018bf770f 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18773,7 +18773,6 @@ Taken from `count' in cl-seq.el with all keyword arguments removed." "Move backwards over whitespace, to the beginning of the first empty line. Returns the number of empty lines passed." (let ((pos (point))) - ;;(skip-chars-backward " \t\n\r") (if (cdr (assoc 'heading org-blank-before-new-entry)) (skip-chars-backward " \t\n\r") (forward-line -1)) From 3151ef60bebdd0ff3f67e18b99ba625a983c862f Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 9 Mar 2011 11:17:33 +0100 Subject: [PATCH 06/29] org.el (org-default-properties): Add EXPORT_OPTIONS. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit (org-buffer-property-keys): docstring fix. (org-default-properties): Add EXPORT_OPTIONS. Thanks to Sébastien Vauban for catching this and his patch. --- lisp/org.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 018bf770f..077b0ef6e 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -13401,7 +13401,7 @@ but in some other way.") (defconst org-default-properties '("ARCHIVE" "CATEGORY" "SUMMARY" "DESCRIPTION" "CUSTOM_ID" "LOCATION" "LOGGING" "COLUMNS" "VISIBILITY" - "TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE" + "TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE" "EXPORT_OPTIONS" "EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE" "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS") @@ -13853,7 +13853,8 @@ and the new value.") With INCLUDE-SPECIALS, also list the special properties that reflect things like tags and TODO state. With INCLUDE-DEFAULTS, also include properties that has special meaning -internally: ARCHIVE, CATEGORY, SUMMARY, DESCRIPTION, LOCATION, and LOGGING. +internally: ARCHIVE, CATEGORY, SUMMARY, DESCRIPTION, LOCATION, and LOGGING +and others. With INCLUDE-COLUMNS, also include property names given in COLUMN formats in the current buffer." (let (rtn range cfmt s p) From 44684a9977f5331d7c3fb0d6e445b99bda0990af Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Tue, 8 Mar 2011 19:30:27 +0000 Subject: [PATCH 07/29] org-html.el: Bugfix: don't insert closing HTML tags when exporting body only. * org-html.el (org-export-as-html): Bugfix: don't insert closing HTML tags when exporting body only. --- lisp/org-html.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index 333cf4df6..9361af0b8 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1715,7 +1715,7 @@ lang=\"%s\" xml:lang=\"%s\"> (if org-export-html-with-timestamp (insert org-export-html-html-helper-timestamp)) - (insert "\n\n\n\n") + (unless body-only (insert "\n\n\n\n")) (unless (plist-get opt-plist :buffer-will-be-killed) (normal-mode) From f920974f43d8781cc40f46c6886e3baee0993a34 Mon Sep 17 00:00:00 2001 From: Matt Lundin Date: Tue, 8 Mar 2011 06:04:00 +0000 Subject: [PATCH 08/29] org-footnote.el: Fix sorting of footnotes. * org-footnote.el (org-footnote-create-definition) (org-insert-footnote-reference-near-definition): Fix sorting of footnotes. --- lisp/org-footnote.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org-footnote.el b/lisp/org-footnote.el index b6a9bca7d..f2b348988 100644 --- a/lisp/org-footnote.el +++ b/lisp/org-footnote.el @@ -314,7 +314,7 @@ or new, let the user edit the definition of the footnote." ;; Skip existing footnotes (while (re-search-forward "^[[:space:]]*\\[[^]]+\\] " nil t) (forward-line)) - (insert "[" label "] \n") + (insert "\n[" label "] \n") (goto-char (1- (point))) (message "Edit definition and go back with `C-c &' or, if unique, with `C-c C-c'."))) @@ -500,7 +500,7 @@ ENTRY is (fn-label num-mark definition)." (when (re-search-forward (format ".\\[%s[]:]" (regexp-quote (car entry))) nil t) (org-footnote-goto-local-insertion-point) - (insert (format "\n\n[%s] %s" (car entry) (nth 2 entry)))))) + (insert (format "\n[%s] %s\n" (car entry) (nth 2 entry)))))) (defun org-footnote-goto-local-insertion-point () "Find insertion point for footnote, just before next outline heading." From eafdbc575b66ec2876634438ece5163bb073d36c Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Wed, 9 Mar 2011 15:44:11 +0100 Subject: [PATCH 09/29] * org.el (org-default-properties): Add EXPORT_TEXT. --- lisp/org.el | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 077b0ef6e..d06608140 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -10390,7 +10390,7 @@ This can be done with a 0 prefix: `C-0 C-c C-w'" (defun org-refile-get-location (&optional prompt default-buffer new-nodes) "Prompt the user for a refile location, using PROMPT. PROMPT should not be suffixed with a colon and a space, because -this function appends the default value from +this function appends the default value from `org-refile-history' automatically, if that is not empty." (let ((org-refile-targets org-refile-targets) (org-refile-use-outline-path org-refile-use-outline-path)) @@ -13401,8 +13401,9 @@ but in some other way.") (defconst org-default-properties '("ARCHIVE" "CATEGORY" "SUMMARY" "DESCRIPTION" "CUSTOM_ID" "LOCATION" "LOGGING" "COLUMNS" "VISIBILITY" - "TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE" "EXPORT_OPTIONS" - "EXPORT_FILE_NAME" "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" + "TABLE_EXPORT_FORMAT" "TABLE_EXPORT_FILE" + "EXPORT_OPTIONS" "EXPORT_TEXT" "EXPORT_FILE_NAME" + "EXPORT_TITLE" "EXPORT_AUTHOR" "EXPORT_DATE" "ORDERED" "NOBLOCKING" "COOKIE_DATA" "LOG_INTO_DRAWER" "REPEAT_TO_STATE" "CLOCK_MODELINE_TOTAL" "STYLE" "HTML_CONTAINER_CLASS") "Some properties that are used by Org-mode for various purposes. @@ -15554,7 +15555,7 @@ customizing `org-effort-durations' (which see). Entries containing a colon are interpreted as H:MM by `org-hh:mm-string-to-minutes'." (let ((result 0) - (re (concat "\\([0-9]+\\) *\\(" + (re (concat "\\([0-9]+\\) *\\(" (regexp-opt (mapcar 'car org-effort-durations)) "\\)"))) (while (string-match re s) From 72011fc4073cbf41dde21b1117daf7ace30d6dea Mon Sep 17 00:00:00 2001 From: Manuel Giraud Date: Wed, 9 Mar 2011 20:06:37 +0000 Subject: [PATCH 10/29] org-html.el: correct HTML export of dedicated target. * org-html.el (org-format-org-table-html): fix anchors in HTML export (thanks to ) (org-html-protect): fix a bug that prevents some target to be rendered correctly. * org-exp.el (org-solidify-link-text): a single "-" to avoid a "&ndash" rewrite in HTML export later. --- lisp/org-exp.el | 2 +- lisp/org-html.el | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index 709317adc..dff86b6ab 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2062,7 +2062,7 @@ can work correctly." (let* ((rtn (mapconcat 'identity - (org-split-string s "[^a-zA-Z0-9_\\.-]+") "--")) + (org-split-string s "[^a-zA-Z0-9_\\.-]+") "-")) (a (assoc rtn alist))) (or (cdr a) rtn)))) diff --git a/lisp/org-html.el b/lisp/org-html.el index 9361af0b8..c60c90d1b 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1996,8 +1996,8 @@ for formatting. This is required for the DocBook exporter." ;; DocBook document, we want to always include the caption to make ;; DocBook XML file valid. (push (format "%s" (or caption "")) html) - (when label (push (format "" (org-solidify-link-text label) (org-solidify-link-text label)) - html)) + (when label + (setq html-table-tag (org-export-splice-attributes html-table-tag (format "id=\"%s\"" (org-solidify-link-text label))))) (push html-table-tag html)) (setq html (mapcar (lambda (x) @@ -2181,12 +2181,12 @@ that uses these same face definitions." (defun org-html-protect (s) "Convert characters to HTML equivalent. Possible conversions are set in `org-export-html-protect-char-alist'." - (let ((start 0) - (cl org-export-html-protect-char-alist) c) + (let ((cl org-export-html-protect-char-alist) c) (while (setq c (pop cl)) - (while (string-match (car c) s start) - (setq s (replace-match (cdr c) t t s) - start (1+ (match-beginning 0))))) + (let ((start 0)) + (while (string-match (car c) s start) + (setq s (replace-match (cdr c) t t s) + start (match-beginning 0))))) s)) (defun org-html-expand (string) From 6ff4c9f42f39d2a85f5bf38e2f621988af9b0435 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 9 Mar 2011 17:48:16 +0100 Subject: [PATCH 11/29] List indentation has priority over block indentation * lisp/org.el (org-indent-line-function): text in both a list and a valid block is indented with regards to current item, not to block boundaries. --- lisp/org.el | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index d06608140..22fe9ad9a 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -18991,6 +18991,12 @@ If point is in an inline task, mark that task instead." ;; Literal examples ((looking-at "[ \t]*:[ \t]") (setq column (org-get-indentation))) ; do nothing + ;; Lists + ((ignore-errors (goto-char (org-in-item-p))) + (setq column (if itemp + (org-get-indentation) + (org-list-item-body-column (point)))) + (goto-char pos)) ;; Drawers ((and (looking-at "[ \t]*:END:") (save-excursion (re-search-backward org-drawer-regexp nil t))) @@ -19012,12 +19018,6 @@ If point is in an inline task, mark that task instead." ;; src blocks: let `org-edit-src-exit' handle them (org-get-indentation) (org-get-indentation (match-string 0))))) - ;; Lists - ((ignore-errors (goto-char (org-in-item-p))) - (setq column (if itemp - (org-get-indentation) - (org-list-item-body-column (point)))) - (goto-char pos)) ;; This line has nothing special, look at the previous relevant ;; line to compute indentation (t From f8ca5d85baa749b69f7b044079f8110825ec0f64 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 9 Mar 2011 20:30:18 +0100 Subject: [PATCH 12/29] org-list: small refactoring * lisp/org-list.el (org-list-in-valid-block-p): new function. (org-at-item-p,org-list-search-generic): use new function. --- lisp/org-list.el | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/lisp/org-list.el b/lisp/org-list.el index 430c9ffb9..a092e2bc2 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -400,6 +400,17 @@ group 4: description tag") (goto-char (match-end 0))) (looking-at regexp)))) +(defun org-list-in-valid-block-p () + "Non-nil if point is in a valid block. +Invalid blocks are referring to `org-list-forbidden-blocks'." + (save-match-data + (let ((case-fold-search t)) + (not (org-in-regexps-block-p + (concat "^[ \t]*#\\+begin_\\(" + (mapconcat 'regexp-quote org-list-forbidden-blocks "\\|") + "\\)") + '(concat "^[ \t]*#\\+end_" (match-string 1))))))) + (defun org-in-item-p () "Return item beginning position when in a plain list, nil otherwise. This checks `org-list-ending-method'." @@ -476,8 +487,7 @@ This checks `org-list-ending-method'." "Is point in a line starting a hand-formatted item?" (save-excursion (beginning-of-line) - (and (looking-at (org-item-re)) - (not (eq (nth 2 (org-list-context)) 'invalid))))) + (and (looking-at (org-item-re)) (org-list-in-valid-block-p)))) (defun org-at-item-bullet-p () "Is point at the bullet of a plain list item?" @@ -1037,9 +1047,9 @@ in `re-search-forward'." (unless (funcall search re bound noerr) (throw 'exit (and (goto-char (if (memq noerr '(t nil)) origin bound)) nil))) - ;; 2. Match in an `invalid' context: continue searching. Else, - ;; return point. - (unless (eq (org-list-context) 'invalid) (throw 'exit (point))))))) + ;; 2. Match in valid context: return point. Else, continue + ;; searching. + (when (org-list-in-valid-block-p) (throw 'exit (point))))))) (defun org-list-search-backward (regexp &optional bound noerror) "Like `re-search-backward' but stop only where lists are recognized. From b12f0dd309db71a25a04808d67e79380b51a7d75 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 10 Mar 2011 00:51:03 +0100 Subject: [PATCH 13/29] Fix fill-region in an item * lisp/org.el (org-adaptive-fill-function): when a region is specified first line of paragraph isn't skipped, so fill-paragraph have to be computed even if point is at an item. --- lisp/org.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 22fe9ad9a..e120c5e6b 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -19208,15 +19208,15 @@ the functionality can be provided as a fall-back.") ;; Comment line ((looking-at "#[ \t]+") (match-string-no-properties 0)) + ;; Plain list item + ((org-at-item-p) + (make-string (org-list-item-body-column (point-at-bol)) ?\ )) ;; Point is in a list after `backward-paragraph': original ;; point wasn't in the list, or filling would have been taken ;; care of by `org-auto-fill-function', but the list and the ;; real paragraph are not separated by a blank line. Thus, move ;; point after the list to go back to real paragraph and - ;; determine fill-prefix. If point is at an item, do not - ;; compute prefix and list structure, as first line of - ;; paragraph will be skipped anyway. - ((org-at-item-p) "") + ;; determine fill-prefix. ((setq itemp (org-in-item-p)) (goto-char itemp) (let* ((struct (org-list-struct)) From d008facdabd8062ab0fe724aaabd0649be7156da Mon Sep 17 00:00:00 2001 From: Bernt Hansen Date: Thu, 10 Mar 2011 06:40:20 +0000 Subject: [PATCH 14/29] Allow setting default clocking task to current clocking task * lisp/org-clock.el (org-clock-in): Set default clocking task when already clocking the task The default clocking task can now be set to the current clocking task. Previously this just threw an error stating the clock continues in the current clocking task. The double prefix now forces setting the default clocking task instead of forcing the user to clock out and back in again just to set the default clocking task to the current clocking task. --- lisp/org-clock.el | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index c0c6c827f..693025adf 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -992,6 +992,7 @@ the clocking selection, associated with the letter `d'." ts selected-task target-pos (msg-extra "") (leftover (and (not org-clock-resolving-clocks) org-clock-leftover-time))) + (when (and org-clock-auto-clock-resolution (or (not interrupting) (eq t org-clock-auto-clock-resolution)) @@ -1000,11 +1001,17 @@ the clocking selection, associated with the letter `d'." (setq org-clock-leftover-time nil) (let ((org-clock-clocking-in t)) (org-resolve-clocks))) ; check if any clocks are dangling + (when (equal select '(4)) (setq selected-task (org-clock-select-task "Clock-in on task: ")) (if selected-task (setq selected-task (copy-marker selected-task)) (error "Abort"))) + + (when (equal select '(16)) + ;; Mark as default clocking task + (org-clock-mark-default-task)) + (when interrupting ;; We are interrupting the clocking of a different task. ;; Save a marker to this task, so that we can go back. @@ -1028,10 +1035,6 @@ the clocking selection, associated with the letter `d'." (let ((org-clock-clocking-in t)) (org-clock-out t))) - (when (equal select '(16)) - ;; Mark as default clocking task - (org-clock-mark-default-task)) - ;; Clock in at which position? (setq target-pos (if (and (eobp) (not (org-on-heading-p))) From 0f301d133be89a33a41794c49842459674694283 Mon Sep 17 00:00:00 2001 From: Bernt Hansen Date: Thu, 10 Mar 2011 06:40:21 +0000 Subject: [PATCH 15/29] Allow clocking in new tasks inserted before the current clocking task * lisp/org-clock.el (org-clock-in): Allow clocking in new tasks inserted before the current clocking task org-clock-in now checks that the name of the task you are clocking in also matches org-clock-current-task. This allows us to insert a new task in front of the current clocking task (with M-S-RET on the heading of the current clocking task) and then clock in the new task. Previously this just stated that clocking continues in the old task since the marker point now matches the new task. A side-effect of this change is that changing the current clocking task headline and clocking in again will now close the current clock and open a new entry as well as update the name of the current clocking task in the modeline. --- lisp/org-clock.el | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 693025adf..cc0e51fbf 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1026,7 +1026,8 @@ the clocking selection, associated with the letter `d'." (= (marker-position org-clock-hd-marker) (if selected-task (marker-position selected-task) - (point))))) + (point))) + (equal org-clock-current-task (nth 4 (org-heading-components))))) (message "Clock continues in \"%s\"" org-clock-heading) (throw 'abort nil)) (move-marker org-clock-interrupted-task From 5b1b94ac4253d44121da9b0da582282df123e36b Mon Sep 17 00:00:00 2001 From: Puneeth Chaganti Date: Tue, 8 Mar 2011 18:28:30 +0000 Subject: [PATCH 16/29] * org-agenda.el (org-agenda-bulk-action): Allow the user to run a function. * org-agenda.el (org-agenda-bulk-action): Allow the user to run a function. --- lisp/org-agenda.el | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 5b48a2fff..0f7fcbc3c 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -7969,7 +7969,7 @@ The prefix arg is passed through to the command if possible." (interactive "P") (unless org-agenda-bulk-marked-entries (error "No entries are marked")) - (message "Bulk: [r]efile [$]arch [A]rch->sib [t]odo [+/-]tag [s]chd [S]catter [d]eadline") + (message "Bulk: [r]efile [$]arch [A]rch->sib [t]odo [+/-]tag [s]chd [S]catter [d]eadline [f]unction") (let* ((action (read-char-exclusive)) (org-log-refile (if org-log-refile 'time nil)) (entries (reverse org-agenda-bulk-marked-entries)) @@ -8059,6 +8059,11 @@ The prefix arg is passed through to the command if possible." (org-agenda-date-later distance) (error nil))))))) + ((equal action ?f) + (setq cmd (list (intern + (org-icompleting-read "Function: " + obarray 'fboundp t nil nil))))) + (t (error "Invalid bulk action"))) ;; Sort the markers, to make sure that parents are handled before children From 25ea18739d73907c2c4495852ec452708588297b Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 10 Mar 2011 10:42:57 +0100 Subject: [PATCH 17/29] Remove trailing whitespaces. --- lisp/org-agenda.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 0f7fcbc3c..4b4dd680e 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -3492,7 +3492,7 @@ given in `org-agenda-start-on-weekday'." (setq org-agenda-last-arguments (list include-all start-day span)) (org-compile-prefix-format 'agenda) (org-set-sorting-strategy 'agenda) - (let* ((span (org-agenda-ndays-to-span + (let* ((span (org-agenda-ndays-to-span (or span org-agenda-ndays org-agenda-span))) (today (org-today)) (sd (or start-day today)) @@ -4339,7 +4339,7 @@ of what a project is and how to check if it stuck, customize the variable (if (zerop (buffer-size)) (setq entries nil) (setq entries (buffer-substring (point-min) (- (point-max) 1))) - (setq entries + (setq entries (with-temp-buffer (insert entries) (goto-char (point-min)) (while (re-search-forward "\n[ \t]+\\(.+\\)$" nil t) @@ -4702,7 +4702,7 @@ This function is invoked if `org-agenda-todo-ignore-deadlines', b3 (match-beginning 3) e3 (match-end 3) todo-state (save-match-data (ignore-errors (org-get-todo-state))) show-all (or (eq org-agenda-repeating-timestamp-show-all t) - (member todo-state + (member todo-state org-agenda-repeating-timestamp-show-all))) (catch :skip (and (org-at-date-range-p) (throw :skip nil)) @@ -4956,7 +4956,7 @@ be skipped." pos (1- (match-beginning 1)) todo-state (save-match-data (org-get-todo-state)) show-all (or (eq org-agenda-repeating-timestamp-show-all t) - (member todo-state + (member todo-state org-agenda-repeating-timestamp-show-all)) d2 (org-time-string-to-absolute (match-string 1) d1 'past show-all) @@ -5461,7 +5461,7 @@ The modified list may contain inherited tags, and tags matched by 2 (length (car new)) 'face 'org-time-grid (car new)))) (when (and todayp org-agenda-show-current-time-in-grid) (push (org-format-agenda-item - nil + nil org-agenda-current-time-string "" nil (format-time-string "%H:%M ")) @@ -7918,7 +7918,7 @@ This is a command that has to be installed in `calendar-mode-map'." (when (string-match regexp (get-text-property (point) 'txt)) (setq entries-marked (+ entries-marked 1)) (call-interactively 'org-agenda-bulk-mark)))) - (if (not entries-marked) + (if (not entries-marked) (message "No entry matching this regexp.")))) (defun org-agenda-bulk-unmark () @@ -8060,7 +8060,7 @@ The prefix arg is passed through to the command if possible." (error nil))))))) ((equal action ?f) - (setq cmd (list (intern + (setq cmd (list (intern (org-icompleting-read "Function: " obarray 'fboundp t nil nil))))) From b814d83b513b96740e65af4de0744a382f5ae8b6 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 10 Mar 2011 11:18:40 +0100 Subject: [PATCH 18/29] * org-attach.el: Allow to store a link to the attach-dir location. * org-attach.el (org-attach-store-link-p): Allow to create a link to the attach-dir location of the file. (org-attach-attach): Allow to store a link to the attach-dir location. This was requested by Darlan Cavalcante Moreira. --- lisp/org-attach.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/org-attach.el b/lisp/org-attach.el index 6b9633858..f87d428cc 100644 --- a/lisp/org-attach.el +++ b/lisp/org-attach.el @@ -102,7 +102,10 @@ ln create a hard link. Note that this is not supported (defcustom org-attach-store-link-p nil "Non-nil means store a link to a file when attaching it." :group 'org-attach - :type 'boolean) + :type '(choice + (const :tag "Don't store link" nil) + (const :tag "Link to origin location" 'origin) + (const :tag "Link to the attach-dir location" 'attach-dir))) ;;;###autoload (defun org-attach () @@ -294,8 +297,10 @@ METHOD may be `cp', `mv', or `ln', default taken from `org-attach-method'." ((eq method 'ln) (add-name-to-file file fname))) (org-attach-commit) (org-attach-tag) - (when org-attach-store-link-p - (org-attach-store-link file)) + (cond ((eq org-attach-store-link-p 'origin) + (org-attach-store-link file)) + ((eq org-attach-store-link-p 'attach-dir) + (org-attach-store-link fname))) (if visit-dir (dired attach-dir) (message "File \"%s\" is now a task attachment." basename))))) From b1909f0afa9fadf0b96c4c3d278b3ae95f07f6da Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 10 Mar 2011 11:22:33 +0100 Subject: [PATCH 19/29] (org-attach-store-link-p): Use `t' instead of 'origin for backward compatibility. --- lisp/org-attach.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/org-attach.el b/lisp/org-attach.el index f87d428cc..7111b7961 100644 --- a/lisp/org-attach.el +++ b/lisp/org-attach.el @@ -104,7 +104,7 @@ ln create a hard link. Note that this is not supported :group 'org-attach :type '(choice (const :tag "Don't store link" nil) - (const :tag "Link to origin location" 'origin) + (const :tag "Link to origin location" t) (const :tag "Link to the attach-dir location" 'attach-dir))) ;;;###autoload @@ -297,10 +297,10 @@ METHOD may be `cp', `mv', or `ln', default taken from `org-attach-method'." ((eq method 'ln) (add-name-to-file file fname))) (org-attach-commit) (org-attach-tag) - (cond ((eq org-attach-store-link-p 'origin) - (org-attach-store-link file)) - ((eq org-attach-store-link-p 'attach-dir) - (org-attach-store-link fname))) + (cond ((eq org-attach-store-link-p 'attach-dir) + (org-attach-store-link fname)) + ((eq org-attach-store-link-p t) + (org-attach-store-link file))) (if visit-dir (dired attach-dir) (message "File \"%s\" is now a task attachment." basename))))) From aaf0bb396776ef05951f28420b5b4c7a823d9e8a Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Thu, 10 Mar 2011 11:25:17 +0100 Subject: [PATCH 20/29] (org-attach-store-link-p): Use 'attached instead of 'attach-dir. --- lisp/org-attach.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org-attach.el b/lisp/org-attach.el index 7111b7961..e73e01e13 100644 --- a/lisp/org-attach.el +++ b/lisp/org-attach.el @@ -105,7 +105,7 @@ ln create a hard link. Note that this is not supported :type '(choice (const :tag "Don't store link" nil) (const :tag "Link to origin location" t) - (const :tag "Link to the attach-dir location" 'attach-dir))) + (const :tag "Link to the attach-dir location" 'attached))) ;;;###autoload (defun org-attach () @@ -297,7 +297,7 @@ METHOD may be `cp', `mv', or `ln', default taken from `org-attach-method'." ((eq method 'ln) (add-name-to-file file fname))) (org-attach-commit) (org-attach-tag) - (cond ((eq org-attach-store-link-p 'attach-dir) + (cond ((eq org-attach-store-link-p 'attached) (org-attach-store-link fname)) ((eq org-attach-store-link-p t) (org-attach-store-link file))) From a0dead7f10f3736fafea80606d383bb5c99d0ed6 Mon Sep 17 00:00:00 2001 From: Rodrigo Lazo Date: Thu, 10 Mar 2011 22:13:30 +0000 Subject: [PATCH 21/29] Docstring fix for org-export-preprocess-string Hi, I found a trivial error with this docstring. --8<---------------cut here---------------start------------->8--- --8<---------------cut here---------------end--------------->8--- Best regards, Seb --- lisp/org-exp.el | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index dff86b6ab..34f101d5a 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -1042,7 +1042,7 @@ Pressing `1' will switch between these two options." "Alist of code references and line numbers.") (defun org-export-preprocess-string (string &rest parameters) - "Cleanup STRING so that that the true exported has a more consistent source. + "Cleanup STRING so that the true exported has a more consistent source. This function takes STRING, which should be a buffer-string of an org-file to export. It then creates a temporary buffer where it does its job. The result is then again returned as a string, and the exporter works @@ -3084,4 +3084,3 @@ The depends on the variable `org-export-copy-to-kill'." ;; arch-tag: 65985fe9-095c-49c7-a7b6-cb4ee15c0a95 ;;; org-exp.el ends here - From efa562c1ee7cd857d3cf8c3e47d44b9ae1bb25d4 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 10 Mar 2011 19:45:47 +0100 Subject: [PATCH 22/29] Fix compatibility with emacsen < 23 * lisp/org.el (org-fill-paragraph): fill-forward-paragraph function has been introduced with emacs 23.1. --- lisp/org.el | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index e120c5e6b..717b7d1fa 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -19185,13 +19185,13 @@ the functionality can be provided as a fall-back.") ;; a paragraph adjacent to a list: make sure this paragraph ;; doesn't get merged with the end of the list by narrowing ;; buffer first. - ((save-excursion (fill-forward-paragraph -1) + ((save-excursion (forward-paragraph -1) (setq itemp (org-in-item-p))) (let ((struct (save-excursion (goto-char itemp) (org-list-struct)))) (save-restriction (narrow-to-region (org-list-get-bottom-point struct) - (save-excursion (fill-forward-paragraph 1) + (save-excursion (forward-paragraph 1) (point))) (fill-paragraph justify) t))) ;; Else simply call `fill-paragraph'. From f6752c805ead638d81bb2718aa32c19924eb1e73 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Fri, 11 Mar 2011 18:30:36 +0100 Subject: [PATCH 23/29] * org-html.el: Bugfix: prevent infinite matching of the `&' character. * org-html.el (org-html-protect): Bugfix: prevent infinite matching of the `&' character. This bug was spotted by Rehan Iftikhar. --- lisp/org-html.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index c60c90d1b..1f3394e35 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -2184,7 +2184,9 @@ Possible conversions are set in `org-export-html-protect-char-alist'." (let ((cl org-export-html-protect-char-alist) c) (while (setq c (pop cl)) (let ((start 0)) - (while (string-match (car c) s start) + (while (and (string-match (car c) s start) + ;; prevent infinite matching of & + (not (string-match "&" s start))) (setq s (replace-match (cdr c) t t s) start (match-beginning 0))))) s)) From ed8a9616a2c86fda8f6a20da88d8ac58d88c9f58 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Fri, 11 Mar 2011 18:37:22 +0100 Subject: [PATCH 24/29] Revert "* org-html.el: Bugfix: prevent infinite matching of the `&' character." This reverts commit f6752c805ead638d81bb2718aa32c19924eb1e73. --- lisp/org-html.el | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index 1f3394e35..c60c90d1b 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -2184,9 +2184,7 @@ Possible conversions are set in `org-export-html-protect-char-alist'." (let ((cl org-export-html-protect-char-alist) c) (while (setq c (pop cl)) (let ((start 0)) - (while (and (string-match (car c) s start) - ;; prevent infinite matching of & - (not (string-match "&" s start))) + (while (string-match (car c) s start) (setq s (replace-match (cdr c) t t s) start (match-beginning 0))))) s)) From 3bf379aee9210ddd9ba8533281188792ecff2d78 Mon Sep 17 00:00:00 2001 From: Kim Rutherford Date: Fri, 11 Mar 2011 22:30:43 +0000 Subject: [PATCH 25/29] Fix for infinite loop in org-html-protect When I export the following as HTML, emacs hangs in org-html-protect: #+begin_src org & #+end_src The attached patch fixes the problem for me. Thanks, Kim. >From cfb1ccb6f9cfd84530c73b7f72d686a2062b3c3b Mon Sep 17 00:00:00 2001 From: Kim Rutherford Date: Fri, 11 Mar 2011 16:44:09 +0000 Subject: [PATCH] Fix infinite loop in org-html-protect --- lisp/org-html.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index c60c90d1b..2312b21b8 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -2186,7 +2186,7 @@ Possible conversions are set in `org-export-html-protect-char-alist'." (let ((start 0)) (while (string-match (car c) s start) (setq s (replace-match (cdr c) t t s) - start (match-beginning 0))))) + start (1+ (match-beginning 0)))))) s)) (defun org-html-expand (string) From 70de130bba6302a46c94c37ed717953c8deea987 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sat, 12 Mar 2011 05:22:41 +0100 Subject: [PATCH 26/29] * org-html.el (org-export-as-html): bugfix: insert email correctly. Thanks to Bernt Hansen for spotting this. --- lisp/org-html.el | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index 2312b21b8..c9a089ec6 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -1289,7 +1289,7 @@ lang=\"%s\" xml:lang=\"%s\"> `((?t . ,title) (?a . ,author) (?d . ,date) (?e . ,email))))) (insert "

" title "

"))) - + (if (and org-export-with-toc (not body-only)) (progn (push (format "%s\n" @@ -1705,7 +1705,8 @@ lang=\"%s\" xml:lang=\"%s\"> (when (and (plist-get opt-plist :author-info) author) (insert "

" (nth 1 lang-words) ": " author "

\n")) (when (and (plist-get opt-plist :email-info) email) - (insert "

<" email ">

\n")) + (insert "

<" email ">

\n")) (when (plist-get opt-plist :creator-info) (insert "

" (concat "Org version " org-version " with Emacs version " From df26ae8e69dd8a93fe74ff122e39c69b38a63973 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sat, 12 Mar 2011 16:40:37 +0100 Subject: [PATCH 27/29] Checkboxes should progress from intermediate state to checked Thanks to Matt Lundin for pointing that out. --- lisp/org-list.el | 4 ++-- lisp/org.el | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/org-list.el b/lisp/org-list.el index a092e2bc2..4b50910a2 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -2107,8 +2107,8 @@ in subtree, ignoring drawers." ((equal toggle-presence '(16)) "[-]") ((equal toggle-presence '(4)) (unless cbox "[ ]")) - ((equal "[ ]" cbox) "[X]") - (t "[ ]")))))) + ((equal "[X]" cbox) "[ ]") + (t "[X]")))))) ;; When an item is found within bounds, grab the full list at ;; point structure, then: 1. set checkbox of all its items ;; within bounds to ref-checkbox; 2. fix checkboxes of the whole diff --git a/lisp/org.el b/lisp/org.el index 717b7d1fa..96ad8ffbf 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -17514,8 +17514,8 @@ This command does many different things, depending on context: (cond ((equal arg '(16)) "[-]") ((equal arg '(4)) nil) - ((equal "[ ]" cbox) "[X]") - (t "[ ]"))) + ((equal "[X]" cbox) "[ ]") + (t "[X]"))) (org-list-struct-fix-ind struct parents) (org-list-struct-fix-bul struct prevs) (setq block-item From c6f5bf72e9d6635a037324ac462c74eb12ac8d14 Mon Sep 17 00:00:00 2001 From: David Maus Date: Sun, 13 Mar 2011 20:08:10 +0100 Subject: [PATCH 28/29] Revert "Fix bug when exporing inactive timestamps." This reverts commit ca69b556241ae904c5f291c98a6453f4ce830557. --- lisp/org-html.el | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index c9a089ec6..35f76eb31 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -2113,14 +2113,14 @@ But it has the disadvantage, that Org-mode's HTML conversions cannot be used." (or b (setq b (substring s 0 (match-beginning 0)))) (setq r (concat r (substring s 0 (match-beginning 0)) - " " + " @" (if (match-end 1) - (format "%s " + (format "@%s @" (match-string 1 s))) - (format " %s" + (format " @%s@" (substring (org-translate-time (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) From 6a369c26d3f936bc71cba9d7148dcecf1b2c9677 Mon Sep 17 00:00:00 2001 From: David Maus Date: Sun, 13 Mar 2011 20:27:12 +0100 Subject: [PATCH 29/29] Expand char entities after creating markup for links and timestamps * org-html.el (org-html-make-link, org-html-handle-links): Protect generated XHTML elements. (org-export-as-html): Expand character entities after creating markup for links and timestamps. This fixes a problem with exporting active timestamps, reported by Daniel Clemente . --- lisp/org-html.el | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/lisp/org-html.el b/lisp/org-html.el index 35f76eb31..6651fd3b2 100644 --- a/lisp/org-html.el +++ b/lisp/org-html.el @@ -826,9 +826,9 @@ MAY-INLINE-P allows inlining it as an image." (message "image %s %s" thefile org-par-open) (org-export-html-format-image thefile org-par-open)) (concat - "" + "@" (org-export-html-format-desc desc) - ""))))) + "@"))))) (defun org-html-handle-links (line opt-plist) "Return LINE with markup of Org mode links. @@ -864,7 +864,7 @@ OPT-PLIST is the export options list." (if (string-match "^file:" desc) (setq desc (substring desc (match-end 0))))) (setq desc (org-add-props - (concat "") + (concat "@") '(org-protected t)))) (cond ((equal type "internal") @@ -990,9 +990,9 @@ OPT-PLIST is the export options list." (t ;; just publish the path, as default - (setq rpl (concat "<" type ":" + (setq rpl (concat "@<" type ":" (save-match-data (org-link-unescape path)) - ">")))) + ">@")))) (setq line (replace-match rpl t t line) start (+ start (length rpl)))) line)) @@ -1504,17 +1504,17 @@ lang=\"%s\" xml:lang=\"%s\"> "@ ") t t line))))) + ;; Format the links + (setq line (org-html-handle-links line opt-plist)) + + (setq line (org-html-handle-time-stamps line)) + ;; replace "&" by "&", "<" and ">" by "<" and ">" ;; handle @<..> HTML tags (replace "@>..<" by "<..>") ;; Also handle sub_superscripts and checkboxes (or (string-match org-table-hline-regexp line) (setq line (org-html-expand line))) - ;; Format the links - (setq line (org-html-handle-links line opt-plist)) - - (setq line (org-html-handle-time-stamps line)) - ;; TODO items (if (and (string-match org-todo-line-regexp line) (match-beginning 2))