From mboxrd@z Thu Jan 1 00:00:00 1970 From: Achim Gratz Subject: Re: [PATCH] Update clocktable (C-cxr with point within clocktable) doesn't detect, inserts new clocktable at point Date: Sat, 20 Nov 2010 11:55:03 +0100 Message-ID: <87tyjcb6yg.fsf@Rainer.invalid> References: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from [140.186.70.92] (port=46599 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PJl6F-0002Z8-HE for emacs-orgmode@gnu.org; Sat, 20 Nov 2010 05:55:20 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PJl6D-0005m7-V5 for emacs-orgmode@gnu.org; Sat, 20 Nov 2010 05:55:19 -0500 Received: from lo.gmane.org ([80.91.229.12]:56567) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PJl6D-0005lk-L4 for emacs-orgmode@gnu.org; Sat, 20 Nov 2010 05:55:17 -0500 Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1PJl6C-0005Bj-0n for emacs-orgmode@gnu.org; Sat, 20 Nov 2010 11:55:16 +0100 Received: from p57aabcba.dip.t-dialin.net ([87.170.188.186]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 20 Nov 2010 11:55:16 +0100 Received: from Stromeko by p57aabcba.dip.t-dialin.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 20 Nov 2010 11:55:16 +0100 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= -- Jeff Kowalczyk writes: > With Org Mode git, when I use C-c C-x C-r inside an existing clocktable, Org > inserts a new clocktable at point. The previous behavior was to detect and > update the existing clocktable, which I presume is still the intended behavior. I think this happens because your clocktable is flush left and due to a patch by me that fixes the same bug for indented clocktables. :-P Mistakenly I required at least one whitespace character instead of allowing none also. Sorry for that, I missed it in my testing and thanks for reporting. The attached patch fixes the issue I believe. --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-org-clock.el-fix-regex-to-recognize-indented-clock-t.patch Content-Description: fix for previous patch >From db7440881bed53fca2643b1bd491c336ab387d5c Mon Sep 17 00:00:00 2001 From: Achim Gratz Date: Sat, 20 Nov 2010 11:43:45 +0100 Subject: [PATCH] org-clock.el: fix regex to recognize indented clock tables * lisp/org-clock.el (org-get-clocktable) previous patch incorrectly required whitespace in front of #+BEGIN: and #+END: TINYCHANGE - This patch is in the public domain. --- lisp/org-clock.el | 10 +++++----- 1 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lisp/org-clock.el b/lisp/org-clock.el index 3146926..e798027 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 "^[ \t]+#\\+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 "^[ \t]+#\\+BEGIN:[ \t]+clocktable" nil t) + (and (re-search-backward "^[ \t]*#\\+BEGIN:[ \t]+clocktable" nil t) (setq start (match-beginning 0)) - (re-search-forward "^[ \t]+#\\+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 "^[ \t]+#\\+BEGIN:[ \t]+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 "^[ \t]+#\\+END:") + (re-search-forward "^[ \t]*#\\+END:") (when (and (equal step-time 0) stepskip0) ;; Remove the empty table (delete-region (point-at-bol) -- 1.7.1 --=-=-= Achim. -- +<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+ DIY Stuff: http://Synth.Stromeko.net/DIY.html --=-=-= Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode --=-=-=--