emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Detangle - How to get it to work
@ 2013-08-05 19:36 Paul Dumais
  2013-08-05 23:10 ` Paul Dumais
  0 siblings, 1 reply; 2+ messages in thread
From: Paul Dumais @ 2013-08-05 19:36 UTC (permalink / raw)
  To: emacs-orgmode

Hi, I think detangle is a must for collaborative work.

I think I have read the instructions correctly, yet I can't seem to
get it to work. Here is a minimal test:

Org file named test.org:
#+PROPERTY: comments link
* Some source
#+begin_src clojure :tangle yes
  (defn hello [] (println "hello"))
#+end_src

This produces the following file named test.clj upon tangling:

;; [[file:~/test.org::*Some%20source][Some\ source:1]]

(defn hello [] (println "hello"))

;; Some\ source:1 ends here

When I add a line to the file:
(def x 1)

 and save, then do M-x org-babel-detangle, it says:
Detangled 0 code blocks

Is there something I'm missing?

Thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Detangle - How to get it to work
  2013-08-05 19:36 Detangle - How to get it to work Paul Dumais
@ 2013-08-05 23:10 ` Paul Dumais
  0 siblings, 0 replies; 2+ messages in thread
From: Paul Dumais @ 2013-08-05 23:10 UTC (permalink / raw)
  To: emacs-orgmode

Ok, I have a work-around which involves handling an error in
ob-tangle.el. The bug is in the org-babel-tangle-jump-to-org function
where 'forward-char' is spitting out an unhandled error as it tries to
move beyond the end of the buffer.

Here's the diff for my simple (half) fix:

1 file changed, 4 insertions(+), 1 deletion(-)
 lisp/ob-tangle.el | 5 ++++-

Modified   lisp/ob-tangle.el
diff --git a/lisp/ob-tangle.el b/lisp/ob-tangle.el
index 8141943..5cf50d4 100644
--- a/lisp/ob-tangle.el
+++ b/lisp/ob-tangle.el
@@ -542,7 +542,10 @@ which enable the original code blocks to be found."
       (org-edit-special)
       ;; Then move forward the correct number of characters in the
       ;; code buffer.
-      (forward-char (- mid body-start))
+      (condition-case err
+  (forward-char (- mid body-start))
+ (error (message "mid %d body-start %d\nerror message: %s"
+ mid body-start (error-message-string err))))
       ;; And return to the Org-mode buffer with the point in the right
       ;; place.
       (org-edit-src-exit)

The real fix would involve finding out why the (- mid body-start)
value is not calculated correctly and puts point beyond the end of the
buffer.

On Mon, Aug 5, 2013 at 1:36 PM, Paul Dumais <paul@unstate.ca> wrote:
> Hi, I think detangle is a must for collaborative work.
>
> I think I have read the instructions correctly, yet I can't seem to
> get it to work. Here is a minimal test:
>
> Org file named test.org:
> #+PROPERTY: comments link
> * Some source
> #+begin_src clojure :tangle yes
>   (defn hello [] (println "hello"))
> #+end_src
>
> This produces the following file named test.clj upon tangling:
>
> ;; [[file:~/test.org::*Some%20source][Some\ source:1]]
>
> (defn hello [] (println "hello"))
>
> ;; Some\ source:1 ends here
>
> When I add a line to the file:
> (def x 1)
>
>  and save, then do M-x org-babel-detangle, it says:
> Detangled 0 code blocks
>
> Is there something I'm missing?
>
> Thanks!

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-08-05 23:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-05 19:36 Detangle - How to get it to work Paul Dumais
2013-08-05 23:10 ` Paul Dumais

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).