From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Eric Schulte" Subject: Re: Re: [babel] Painless integration of source blocks with language Date: Wed, 19 Jan 2011 00:28:10 -0700 Message-ID: <87oc7dic8k.fsf@gmail.com> 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 Return-path: Received: from [140.186.70.92] (port=53842 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PfSSt-0006WK-9X for emacs-orgmode@gnu.org; Wed, 19 Jan 2011 02:28:24 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PfSSr-0002xn-Qa for emacs-orgmode@gnu.org; Wed, 19 Jan 2011 02:28:23 -0500 Received: from mail-iy0-f169.google.com ([209.85.210.169]:53367) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PfSSr-0002xd-JK for emacs-orgmode@gnu.org; Wed, 19 Jan 2011 02:28:21 -0500 Received: by iyj17 with SMTP id 17so568733iyj.0 for ; Tue, 18 Jan 2011 23:28:17 -0800 (PST) In-Reply-To: (Seth Burleigh's message of "Tue, 18 Jan 2011 12:38:38 -0600") 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: Seth Burleigh Cc: =?utf-8?Q?S=C3=A9bastien?= Vauban , emacs-orgmode@gnu.org Hi Seth, You are correct, while the tangling works, the detangling still needs to be updated to take into account the fact that there may now be nested sections of tangled code -- which it doesn't currently. Hopefully this wont be too large of a code change... Seth Burleigh writes: > 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))) > > _______________________________________________ > 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