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: Seth Burleigh
Subject: Re: [Orgmode] Re: [babel] Painless integration of source blocks with language
Date: Tue, 18 Jan 2011 12:38:38 -0600

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)))



reply via email to

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