emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Paul Dumais <paul@unstate.ca>
To: emacs-orgmode@gnu.org
Subject: Re: Detangle - How to get it to work
Date: Mon, 5 Aug 2013 17:10:33 -0600	[thread overview]
Message-ID: <CAPE4mm_NnzOEreSh-vtJHm0E9nmthr9zK7aha8v77HvM2vZBKQ@mail.gmail.com> (raw)
In-Reply-To: <CAPE4mm-9c315XsF9Um+7W6eQAgRR4Lb52T3rGD3vUzkgdzHzPw@mail.gmail.com>

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!

      reply	other threads:[~2013-08-05 23:10 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-08-05 19:36 Detangle - How to get it to work Paul Dumais
2013-08-05 23:10 ` Paul Dumais [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAPE4mm_NnzOEreSh-vtJHm0E9nmthr9zK7aha8v77HvM2vZBKQ@mail.gmail.com \
    --to=paul@unstate.ca \
    --cc=emacs-orgmode@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).