diff --git a/litorgy/litorgy.el b/litorgy/litorgy.el index 63c6b1426..82306e93f 100644 --- a/litorgy/litorgy.el +++ b/litorgy/litorgy.el @@ -144,10 +144,30 @@ the header arguments specified at the source code block." (defun litorgy-get-src-block-info () "Return the information of the current source block as a list of the following form. (language body header-arguments-alist)" - (let ((case-fold-search t)) - (if (save-excursion ;; full source block - (beginning-of-line 1) - (looking-at litorgy-src-block-regexp)) + (let ((case-fold-search t) + top middle bottom) + (if (or + (save-excursion ;; on a #+srcname: line + (beginning-of-line 1) + (and + (looking-at "#\\+srcname") + (progn + (forward-line 1) + (looking-at litorgy-src-block-regexp)))) + (save-excursion ;; on a #+begin_src line + (beginning-of-line 1) + (looking-at litorgy-src-block-regexp)) + (save-excursion ;; inside a src block + (and + (setq middle (point)) + (re-search-backward "#\\+begin_src" nil t) + (setq top (point)) + (re-search-forward "#\\+end_src" nil t) + (setq bottom (point)) + (< top middle) + (< middle bottom) + (goto-char top) + (looking-at litorgy-src-block-regexp)))) (litorgy-parse-src-block-match) (if (save-excursion ;; inline source block (re-search-backward "[ \f\t\n\r\v]" nil t) diff --git a/rorg.org b/rorg.org index 536ac8b0c..3fcb02c87 100644 --- a/rorg.org +++ b/rorg.org @@ -3,7 +3,7 @@ #+SEQ_TODO: TODO OPEN PROPOSED | DONE DEFERRED REJECTED #+STARTUP: oddeven -* Tasks [8/20] +* Tasks [9/20] ** TODO results-type header (scalar/vector) In response to a point in Dan's email. We should allow the user to force scalar or vector results. This could be done with a header @@ -41,15 +41,6 @@ configuration variable. commands, or at least articulate under this TODO the reasons for using our custom R-interaction commands. -** TODO make C-c C-c work anywhere within source code block? - This seems like it would be nice to me, but perhaps it would be - inefficient or ugly in implementation? I suppose you could search - forward, and if you find #+end_src before you find #+begin_src, - then you're inside one. [DED] - - Agreed, I think inside of the =#+srcname: line= would be useful as - well. - ** TODO share litorgy how should we share litorgy? @@ -215,6 +206,20 @@ one that comes to mind is the ability to treat a source-code block like a function which accepts arguments and returns results. Actually this can be it's own TODO (see [[* source blocks as functions][source blocks as functions]]). +** DONE make C-c C-c work anywhere within source code block? + This seems like it would be nice to me, but perhaps it would be + inefficient or ugly in implementation? I suppose you could search + forward, and if you find #+end_src before you find #+begin_src, + then you're inside one. [DED] + + Agreed, I think inside of the =#+srcname: line= would be useful as + well. + +#+srcname: testing-out-cc +#+begin_src emacs-lisp +'schulte +#+end_src + ** DONE integration with org tables We should make it easy to call litorgy source blocks from org-mode table formulas. This is practical now that it is possible to pass