From 1a34708ade9934ec303f02e447f124e202b05ff3 Mon Sep 17 00:00:00 2001 From: Eric Schulte Date: Sun, 5 Sep 2010 13:04:58 -0600 Subject: [PATCH 1/3] Babel: org-babel-map-src-blocks now sets a variety of local variables * lisp/ob.el (org-babel-map-src-blocks): now exposes much information about the code block in the form of let-bound local variables. --- lisp/ob.el | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/lisp/ob.el b/lisp/ob.el index 20b0c9a41..c232da8d2 100644 --- a/lisp/ob.el +++ b/lisp/ob.el @@ -728,8 +728,26 @@ portions of results lines." 'org-babel-show-result-all 'append 'local))) (defmacro org-babel-map-src-blocks (file &rest body) - "Evaluate BODY forms on each source-block in FILE. If FILE is -nil evaluate BODY forms on source blocks in current buffer." + "Evaluate BODY forms on each source-block in FILE. +If FILE is nil evaluate BODY forms on source blocks in current +buffer. During evaluation of BODY the following local variables +are set relative to the currently matched code block. + +full-block ------- string holding the entirety of the code block +beg-block -------- point at the beginning of the code block +end-block -------- point at the end of the matched code block +lang ------------- string holding the language of the code block +beg-lang --------- point at the beginning of the lang +end-lang --------- point at the end of the lang +switches --------- string holding the switches +beg-switches ----- point at the beginning of the switches +end-switches ----- point at the end of the switches +header-args ------ string holding the header-args +beg-header-args -- point at the beginning of the header-args +end-header-args -- point at the end of the header-args +body ------------- string holding the body of the code block +beg-body --------- point at the beginning of the body +end-body --------- point at the end of the body" (declare (indent 1)) `(let ((visited-p (or (null ,file) (get-file-buffer (expand-file-name ,file)))) @@ -740,7 +758,22 @@ nil evaluate BODY forms on source blocks in current buffer." (goto-char (point-min)) (while (re-search-forward org-babel-src-block-regexp nil t) (goto-char (match-beginning 0)) - (save-match-data ,@body) + (let ((full-block (match-string 0)) + (beg-block (match-beginning 0)) + (end-block (match-beginning 0)) + (lang (match-string 2)) + (beg-lang (match-beginning 2)) + (end-lang (match-end 2)) + (switches (match-string 3)) + (beg-switches (match-beginning 3)) + (end-switches (match-end 3)) + (header-args (match-string 4)) + (beg-header-args (match-beginning 4)) + (end-header-args (match-end 4)) + (body (match-string 5)) + (beg-body (match-beginning 5)) + (end-body (match-end 5))) + (save-match-data ,@body)) (goto-char (match-end 0)))) (unless visited-p (kill-buffer to-be-removed)) From 3ec475027162b6f42c33dfd8ccbacc1a07071e87 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sun, 5 Sep 2010 21:09:50 +0200 Subject: [PATCH 2/3] Third fix for the time-grid problem. Hopefully the last one. See commit 7b188f7d. Reported by Memnon Anon . --- lisp/org-agenda.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 3a6434475..32c65dbef 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -5117,7 +5117,7 @@ The modified list may contain inherited tags, and tags matched by (throw 'exit list)) (while (setq time (pop gridtimes)) (unless (and remove (member time have)) - (setq time (format "%4d" time)) + (setq time (replace-regexp-in-string " " "0" (format "%4s" time))) (push (org-format-agenda-item nil string "" nil (concat (substring time 0 -2) ":" (substring time -2))) From 872d401fb375695ad53c9762a08d3be65df7c616 Mon Sep 17 00:00:00 2001 From: Bastien Date: Fri, 3 Sep 2010 01:19:35 +0000 Subject: [PATCH 3/3] Use `C-c C-x _' for interactively calling `org-timer-stop' Unless I missed something, `org-timer-stop' has no keybinding yet. I propose to use `C-c C-x _'. Is that okay for everyone? --- lisp/org.el | 1 + 1 file changed, 1 insertion(+) diff --git a/lisp/org.el b/lisp/org.el index 26acc6917..a814cf4da 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -16385,6 +16385,7 @@ BEG and END default to the buffer boundaries." (org-defkey org-mode-map "\C-c\C-x." 'org-timer) (org-defkey org-mode-map "\C-c\C-x-" 'org-timer-item) (org-defkey org-mode-map "\C-c\C-x0" 'org-timer-start) +(org-defkey org-mode-map "\C-c\C-x_" 'org-timer-stop) (org-defkey org-mode-map "\C-c\C-x," 'org-timer-pause-or-continue) (define-key org-mode-map "\C-c\C-x\C-c" 'org-columns)