From mboxrd@z Thu Jan 1 00:00:00 1970 From: Seth Burleigh Subject: Re: Re: [babel] Painless integration of source blocks with language Date: Tue, 18 Jan 2011 12:38:38 -0600 Message-ID: References: <87lj2ukfia.fsf@gmail.com> <87k4icegwl.fsf@ucl.ac.uk> <87wrmbwdsm.fsf@gmail.com> <87aaj5tbgl.fsf@ucl.ac.uk> <87bp3ka458.fsf@gmail.com> <87hbd8kgqw.fsf@gmail.com> <80pqrv40ch.fsf@missioncriticalit.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Return-path: Received: from [140.186.70.92] (port=48255 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PfGS4-0006CP-VP for emacs-orgmode@gnu.org; Tue, 18 Jan 2011 13:38:51 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PfGRz-0000RV-NC for emacs-orgmode@gnu.org; Tue, 18 Jan 2011 13:38:44 -0500 Received: from mail-iw0-f169.google.com ([209.85.214.169]:56189) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PfGRz-0000RQ-JR for emacs-orgmode@gnu.org; Tue, 18 Jan 2011 13:38:39 -0500 Received: by iwn40 with SMTP id 40so6894605iwn.0 for ; Tue, 18 Jan 2011 10:38:39 -0800 (PST) In-Reply-To: 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: =?ISO-8859-1?Q?S=E9bastien_Vauban?= Cc: emacs-orgmode@gnu.org ok, so im not sure how you got it working, but heres the problem in the code (i think). We start with the tangled output -------------------------------------- ;; [[file:~/Desktop/test.org][/home/seth/Desktop/test\.org:2]] (let ((x 1)) (message "x=%s" x) ;; [[file:~/Desktop/test.org][wrappable]] (setq x (+ 4 x)) ;; wrappable ends here (message "x=%s" x)) ;;>> before org-babel-detangle calls org-babel-tangle-jump-to-org, it is at this point ;; /home/seth/Desktop/test\.org:2 ends here -------------------------------------- The code jumps to the point marked above (notice any comment with ;;>> is just my markup) So, lets go to the relevant portion of org-babel-tangle-jump-to-org. -------------------------------------- (defun org-babel-tangle-jump-to-org () "Jump from a tangled code file to the related Org-mode file." (interactive) (let ((mid (point)) start end done target-buffer target-char link path block-name body) (save-window-excursion (save-excursion (while (and (re-search-backward org-bracket-link-analytic-regexp nil t) (not ; ever wider searches until matching block comments (and (setq start (point-at-eol)) (setq link (match-string 0)) (setq path (match-string 3)) (setq block-name (match-string 5)) (save-excursion (save-match-data (re-search-forward (concat " " (regexp-quote block-name) " ends here") nil t) (setq end (point-at-bol)))))))) ;;(message "start %s mid %s end %s" start mid end) (unless (and start (< start mid) (< mid end)) (error (format "not in tangled code %s %s %s " start mid end))) --------------------------------------- notice that mid is set to the point commented previously. Then it searches backward for org-bracket-link-analytic-regexp , and it finds ;; [[file:~/Desktop/test.org][wrappable]]. Then it searches forward and matches ;; wrappable ends here. So, start and end encompass the inner block, but the mid point is in the outside block. Therefore, it fails with the error message (unless (and start (< start mid) (< mid end)) (error (format "not in tangled code %s %s %s " start mid end)))