From cbbe00e30eb0b911b14e45d7cea9e972c5e76b28 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Sun, 14 May 2017 10:25:13 +0200 Subject: [PATCH] org-element: Do not parse timestamps within planning line * lisp/org-element.el (org-element-context): Do not parse timestamps within planning line. * testing/lisp/test-org-element.el (test-org-element/context): Remove test. Strictly speaking, timestamps within planning lines are parameters values that use timestamp syntax, not real timestamps belonging to the document contents. --- lisp/org-element.el | 11 ----------- testing/lisp/test-org-element.el | 9 --------- 2 files changed, 20 deletions(-) diff --git a/lisp/org-element.el b/lisp/org-element.el index 12a4bc67c..bbe430b01 100644 --- a/lisp/org-element.el +++ b/lisp/org-element.el @@ -5867,17 +5867,6 @@ Providing it allows for quicker computation." (or (< pos cend) (and (= pos cend) (eobp)))) (narrow-to-region cbeg cend) (throw 'objects-forbidden element)))) - ;; At a planning line, if point is at a timestamp, return it, - ;; otherwise, return element. - ((eq type 'planning) - (dolist (p '(:closed :deadline :scheduled)) - (let ((timestamp (org-element-property p element))) - (when (and timestamp - (<= (org-element-property :begin timestamp) pos) - (> (org-element-property :end timestamp) pos)) - (throw 'objects-forbidden timestamp)))) - ;; All other locations cannot contain objects: bail out. - (throw 'objects-forbidden element)) (t (throw 'objects-forbidden element))) (goto-char (point-min)) (let ((restriction (org-element-restriction type)) diff --git a/testing/lisp/test-org-element.el b/testing/lisp/test-org-element.el index 3e4393866..a96d35a96 100644 --- a/testing/lisp/test-org-element.el +++ b/testing/lisp/test-org-element.el @@ -3417,15 +3417,6 @@ Text (eq 'table-cell (org-test-with-temp-text "| a | b {{{macro}}} |" (org-element-type (org-element-context))))) - ;; Find objects in planning lines. - (should - (eq 'timestamp - (org-test-with-temp-text "* H\n SCHEDULED: <2012-03-29 thu.>" - (org-element-type (org-element-context))))) - (should-not - (eq 'timestamp - (org-test-with-temp-text "* H\n SCHEDULED: <2012-03-29 thu.>" - (org-element-type (org-element-context))))) ;; Find objects in item tags. (should (eq 'bold