emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Re: [babel] Painless integration of source blocks with lan


From: Eric Schulte
Subject: Re: [Orgmode] Re: [babel] Painless integration of source blocks with language
Date: Wed, 19 Jan 2011 00:28:10 -0700
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

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 <address@hidden> 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.
> address@hidden
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode



reply via email to

[Prev in Thread] Current Thread [Next in Thread]