From 06ca884162b5d6cc4c2e3623b3583758707a320b Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Wed, 23 Mar 2011 14:47:33 +0100 Subject: [PATCH 1/3] org-list: fix bug with org-toggle-checkbox * lisp/org-list.el (org-list-checkbox): when called from an headline, function would normally skip drawers, but not if a SCHEDULED or DEADLINE keyword is standing before the drawer. Also avoid problems if function is called in buffers not is Org mode. --- lisp/org-list.el | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/org-list.el b/lisp/org-list.el index 535633064..4cc2d5332 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -2073,6 +2073,10 @@ in subtree, ignoring drawers." block-item lim-up lim-down + (drawer-re (concat "^[ \t]*:\\(" + (mapconcat 'regexp-quote org-drawers "\\|") + "\\):[ \t]*$")) + (keyword-re (concat "^[ \t]*" org-keyword-time-regexp)) (orderedp (org-entry-get nil "ORDERED")) (bounds ;; In a region, start at first item in region @@ -2085,11 +2089,14 @@ in subtree, ignoring drawers." (error "No item in region")) (setq lim-down (copy-marker limit)))) ((org-on-heading-p) - ;; On an heading, start at first item after drawers + ;; On an heading, start at first item after drawers and + ;; time-stamps (scheduled, etc.) (let ((limit (save-excursion (outline-next-heading) (point)))) (forward-line 1) - (when (looking-at org-drawer-regexp) - (re-search-forward "^[ \t]*:END:" limit nil)) + (while (or (looking-at drawer-re) (looking-at keyword-re)) + (if (looking-at keyword-re) + (forward-line 1) + (re-search-forward "^[ \t]*:END:" limit nil))) (if (org-list-search-forward (org-item-beginning-re) limit t) (setq lim-up (point-at-bol)) (error "No item in subtree")) From 1c0d592463632293aa4e5685abdcb5732b3c7fe9 Mon Sep 17 00:00:00 2001 From: Julien Danjou Date: Wed, 23 Mar 2011 18:26:32 +0100 Subject: [PATCH 2/3] org-latex: change default date format * lisp/org-latex.el (org-export-latex-date-format): Change default date format to \today. This has the same result but respects the language set in the document by default. Signed-off-by: Julien Danjou --- lisp/org-latex.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-latex.el b/lisp/org-latex.el index 9be842b51..605795ca8 100644 --- a/lisp/org-latex.el +++ b/lisp/org-latex.el @@ -258,7 +258,7 @@ For example \orgTITLE for #+TITLE." :type 'boolean) (defcustom org-export-latex-date-format - "%d %B %Y" + "\\today" "Format string for \\date{...}." :group 'org-export-latex :type 'string) From 051b5b291cb3dbe6b7dba68fc8da5451e2546953 Mon Sep 17 00:00:00 2001 From: Nicolas Goaziou Date: Thu, 17 Mar 2011 13:01:06 +0100 Subject: [PATCH 3/3] org-list: fix infinite loop on erroneous block and drawer constructs * lisp/org-list.el (org-list-struct,org-in-item-p): don't assume end of blocks or drawers necessarily start somewhere. It it isn't the case, treat them as normal text. --- lisp/org-list.el | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lisp/org-list.el b/lisp/org-list.el index 4cc2d5332..7136e2b94 100644 --- a/lisp/org-list.el +++ b/lisp/org-list.el @@ -468,10 +468,10 @@ This checks `org-list-ending-method'." (looking-at org-list-end-re)) (throw 'exit nil)) ;; Skip blocks, drawers, inline-tasks, blank lines - ((looking-at "^[ \t]*#\\+end_") - (re-search-backward "^[ \t]*#\\+begin_" nil t)) - ((looking-at "^[ \t]*:END:") - (re-search-backward drawers-re nil t) + ((and (looking-at "^[ \t]*#\\+end_") + (re-search-backward "^[ \t]*#\\+begin_" lim-up t))) + ((and (looking-at "^[ \t]*:END:") + (re-search-backward drawers-re lim-up t)) (beginning-of-line)) ((and inlinetask-re (looking-at inlinetask-re)) (org-inlinetask-goto-beginning) @@ -689,10 +689,10 @@ Assume point is at an item." (memq (assq (car beg-cell) itm-lst) itm-lst)))) ;; Skip blocks, drawers, inline tasks, blank lines ;; along the way. - ((looking-at "^[ \t]*#\\+end_") - (re-search-backward "^[ \t]*#\\+begin_" nil t)) - ((looking-at "^[ \t]*:END:") - (re-search-backward drawers-re nil t) + ((and (looking-at "^[ \t]*#\\+end_") + (re-search-backward "^[ \t]*#\\+begin_" lim-up t))) + ((and (looking-at "^[ \t]*:END:") + (re-search-backward drawers-re lim-up t)) (beginning-of-line)) ((and inlinetask-re (looking-at inlinetask-re)) (org-inlinetask-goto-beginning) @@ -756,11 +756,11 @@ Assume point is at an item." (throw 'exit (push (cons 0 (point)) end-lst-2))) ;; Skip blocks, drawers, inline tasks and blank lines ;; along the way - ((looking-at "^[ \t]*#\\+begin_") - (re-search-forward "^[ \t]*#\\+end_") + ((and (looking-at "^[ \t]*#\\+begin_") + (re-search-forward "^[ \t]*#\\+end_" lim-down t)) (forward-line 1)) - ((looking-at drawers-re) - (re-search-forward "^[ \t]*:END:" nil t) + ((and (looking-at drawers-re) + (re-search-forward "^[ \t]*:END:" lim-down t)) (forward-line 1)) ((and inlinetask-re (looking-at inlinetask-re)) (org-inlinetask-goto-end))