From fee2c2c8dab57bf11ad34526f1364154f57fb020 Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Tue, 16 Nov 2010 00:17:50 +0100 Subject: [PATCH 1/2] org-clock.el: fix regex to recognize indented clock tables * lisp/org-clock.el (org-get-clocktable): (org-in-clocktable-p): (org-clocktable-shift): (org-clocktable-steps): Fix regexp to allow for indented clock tables #+BEGIN: and #+END: were expected only at the first column in some places. #BEGIN: and #END: were erroneously recognized inside normal lines in other instances. always allow whitespace after #BEGIN: and #END:, not just a single space TINYCHANGE - This patch is in the public domain. --- lisp/org-clock.el | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 377c51045..314692652 100644 --- a/lisp/org-clock.el +++ b/lisp/org-clock.el @@ -1623,7 +1623,7 @@ fontified, and then returned." (font-lock-fontify-buffer) (forward-line 2) (buffer-substring (point) (progn - (re-search-forward "^#\\+END" nil t) + (re-search-forward "^[ \t]+#\\+END" nil t) (point-at-bol))))) (defun org-clock-report (&optional arg) @@ -1648,9 +1648,9 @@ buffer and update it." (let ((pos (point)) start) (save-excursion (end-of-line 1) - (and (re-search-backward "^#\\+BEGIN:[ \t]+clocktable" nil t) + (and (re-search-backward "^[ \t]+#\\+BEGIN:[ \t]+clocktable" nil t) (setq start (match-beginning 0)) - (re-search-forward "^#\\+END:.*" nil t) + (re-search-forward "^[ \t]+#\\+END:.*" nil t) (>= (match-end 0) pos) start)))) @@ -1741,7 +1741,7 @@ the currently selected interval size." (and (memq dir '(left down)) (setq n (- n))) (save-excursion (goto-char (point-at-bol)) - (if (not (looking-at "#\\+BEGIN: clocktable\\>.*?:block[ \t]+\\(\\S-+\\)")) + (if (not (looking-at "^[ \t]+#\\+BEGIN:[ \t]+clocktable\\>.*?:block[ \t]+\\(\\S-+\\)")) (error "Line needs a :block definition before this command works") (let* ((b (match-beginning 1)) (e (match-end 1)) (s (match-string 1)) @@ -2134,7 +2134,7 @@ from the dynamic block defintion." "Weekly report starting on: ") (plist-get p1 :tstart) "\n") (setq step-time (org-dblock-write:clocktable p1)) - (re-search-forward "#\\+END:") + (re-search-forward "^[ \t]+#\\+END:") (when (and (equal step-time 0) stepskip0) ;; Remove the empty table (delete-region (point-at-bol) From b59074eca8896080ab8f6481ca367b938846fcbe Mon Sep 17 00:00:00 2001 From: Dan Davison Date: Sun, 14 Nov 2010 15:50:47 +0000 Subject: [PATCH 2/2] babel: Avoid addition of unnecessary ellipsis * lisp/ob-table.el (org-babel-table-truncate-at-newline): Only add "..." if there is something after the newline. --- lisp/ob-table.el | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lisp/ob-table.el b/lisp/ob-table.el index cdc7a6250..c0ca653e9 100644 --- a/lisp/ob-table.el +++ b/lisp/ob-table.el @@ -57,9 +57,9 @@ "Replace newline character with ellipses. If STRING ends in a newline character, then remove the newline character and replace it with ellipses." - (if (and (stringp string) (string-match "[\n\r]" string)) - (concat (substring string 0 (match-beginning 0)) "...") - string)) + (if (and (stringp string) (string-match "[\n\r]\\(.\\)?" string)) + (concat (substring string 0 (match-beginning 0)) + (if (match-string 1 string) "...")) string)) (defmacro sbe (source-block &rest variables) "Return the results of calling SOURCE-BLOCK with VARIABLES.