From mboxrd@z Thu Jan 1 00:00:00 1970 From: Vitalie Spinu Subject: ob: Make src block location available to execution backend Date: Wed, 05 Jun 2013 15:49:08 +0200 Message-ID: <874ndcoegb.fsf@gmail.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:60559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkEG4-0008EE-5H for emacs-orgmode@gnu.org; Wed, 05 Jun 2013 10:00:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UkEFw-0007US-Lb for emacs-orgmode@gnu.org; Wed, 05 Jun 2013 10:00:12 -0400 Received: from plane.gmane.org ([80.91.229.3]:33187) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UkEFw-0007QU-Ee for emacs-orgmode@gnu.org; Wed, 05 Jun 2013 10:00:04 -0400 Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1UkEFv-0004Q5-Dl for emacs-orgmode@gnu.org; Wed, 05 Jun 2013 16:00:03 +0200 Received: from dhcp-077-249-018-128.chello.nl ([77.249.18.128]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 05 Jun 2013 16:00:03 +0200 Received: from spinuvit by dhcp-077-249-018-128.chello.nl with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 05 Jun 2013 16:00:03 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --=-=-= Content-Type: text/plain Hi, ESS has a visual debugger that depends on the availability of source references. It would be very nice if the debugger could step directly through org buffers. ESS was detecting org-src-edit buffers and redirecting references to original org file for already quite a while. That because of the availability of org-edit-src-beg-marker in src-edit buffers. Unfortunately similar functionality is not available in babel. I attach a patch that would allow ess-eval-buffer from ob-R.el to access the location of the currently executed block through a temporary stored marker in org-babel-current-exec-src-block-head. Vitalie --=-=-= Content-Type: text/x-diff Content-Disposition: inline Modified lisp/ob-core.el diff --git a/lisp/ob-core.el b/lisp/ob-core.el index 8d26c4e..653975a 100644 --- a/lisp/ob-core.el +++ b/lisp/ob-core.el @@ -251,7 +251,7 @@ references; a process which could likely result in the execution of other code blocks. Returns a list - (language body header-arguments-alist switches name indent)." + (language body header-arguments-alist switches name indent block-head)." (let ((case-fold-search t) head info name indent) ;; full code block (if (setq head (org-babel-where-is-src-block-head)) @@ -274,7 +274,7 @@ Returns a list ;; resolve variable references and add summary parameters (when (and info (not light)) (setf (nth 2 info) (org-babel-process-params (nth 2 info)))) - (when info (append info (list name indent))))) + (when info (append info (list name indent head))))) (defvar org-current-export-file) ; dynamically bound (defmacro org-babel-check-confirm-evaluate (info &rest body) @@ -535,6 +535,8 @@ can not be resolved.") ;;; functions (defvar call-process-region) +(defvar org-babel-current-exec-src-block-head nil + "Marker to the currently processed src block.") ;;;###autoload (defun org-babel-execute-src-block (&optional arg info params) @@ -562,6 +564,7 @@ block." (let* ((params (if params (org-babel-process-params merged-params) (nth 2 info))) + (org-babel-current-exec-src-block-head (nth 6 info)) (cachep (and (not arg) (cdr (assoc :cache params)) (string= "yes" (cdr (assoc :cache params))))) (new-hash (when cachep (org-babel-sha1-hash info))) @@ -1592,7 +1595,7 @@ If the point is not on a source block then return nil." (< top initial) (< initial bottom) (progn (goto-char top) (beginning-of-line 1) (looking-at org-babel-src-block-regexp)) - (point)))))) + (point-marker)))))) ;;;###autoload (defun org-babel-goto-src-block-head () --=-=-=--