emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Frederick Giasson <fred@curbside.com>
To: Nicolas Goaziou <mail@nicolasgoaziou.fr>
Cc: emacs-orgmode@gnu.org
Subject: Re: org-detangle seems broken
Date: Mon, 4 Jun 2018 08:42:27 -0400	[thread overview]
Message-ID: <CADjL5rXkqk+i3eGLJ77siAJQgBHgLoJSnFXgjwKB4JiA0vqXmQ@mail.gmail.com> (raw)
In-Reply-To: <87wovhmr0v.fsf@nicolasgoaziou.fr>


[-- Attachment #1.1: Type: text/plain, Size: 1460 bytes --]

Hi Nicolas,

Here it is. If you =detangle= the =broken-detangle--working.el= file, it
will work as expected.

However, if you try to detangle the =broken-detangle--NOT-working.el= file,
you should get a "Not in a source block" error in *message*.

Another thing I noted while creating the ECM is if there is only *one* code
block in the =.org= file, then it throws a =End of Buffer= error.



On Sat, Jun 2, 2018 at 6:17 AM, Nicolas Goaziou <mail@nicolasgoaziou.fr>
wrote:

> Hello,
>
> Frederick Giasson <fred@curbside.com> writes:
>
> > It appears that org-detangle is broken. I am using spacemacs, but even
> with
> > a vanilla Emacs (emacs -Q) it appears to be broken.
> >
> > When I tangle a file with =:comments link= every things works as expected
> > and the comments are added in the tangled file.
> >
> > When I just detangle that tangled file, everything get detangled as
> > expected.
> >
> > If I change one or two lines, it normally works as expected.
> >
> > If I change more than 4 lines, I always get the error message "Not in a
> > block file".
> >
> > Some debugging shows that the function =org-element-at-point= sometimes
> tag
> > the element as =paragraph= instead of =src-block=, like if it doesn't
> know
> > where it is... somehow.
> >
> > Does anybody use that function without experiencing this (apparent major)
> > issue?
>
> Could you provide an ECM demonstrating the issue?
>
> Thank you.
>
> Regards,
>
> --
> Nicolas Goaziou
>

[-- Attachment #1.2: Type: text/html, Size: 2174 bytes --]

[-- Attachment #2: broken-detangle.org --]
[-- Type: application/octet-stream, Size: 900 bytes --]

* Experience broken detangle

In this example, if we tangle this file and immediately detangle it, everything is working as expected without error messages from Org.

#+BEGIN_SRC elisp :tangle broken-detangle.el :comments link
(defun test
    (message "broken detangle"))
#+END_SRC

If I update the *source* file with the following code and that I detangle it, it works as expected:

#+BEGIN_SRC elisp :tangle broken-detangle.el :comments link
(defun test
    (message "broken detangle")
  (message "test"))
#+END_SRC

However, if I add a line of code like this, then I am currently getting a =Not in a source block".

#+BEGIN_SRC elisp :tangle broken-detangle.el :comments link
(defun test
    (message "broken detangle")
    (message "test")
    (message "test"))
#+END_SRC

Another thing to note, if there is only *one* code block in the Orgmode file, then I am getting a =End of Buffer= instead.

[-- Attachment #3: broken-detangle--NOT-working.el --]
[-- Type: text/x-emacs-lisp, Size: 693 bytes --]

;; [[file:~/Documents/git/broken-detangle.org::*Experience%20broken%20detangle][Experience broken detangle:1]]
(defun test
  (message "broken detangle")
  (message "test")
  (message "test"))
;; Experience broken detangle:1 ends here

;; [[file:~/Documents/git/broken-detangle.org::*Experience%20broken%20detangle][Experience broken detangle:2]]
(defun test
    (message "broken detangle")
  (message "test"))
;; Experience broken detangle:2 ends here

;; [[file:~/Documents/git/broken-detangle.org::*Experience%20broken%20detangle][Experience broken detangle:3]]
(defun test
    (message "broken detangle")
    (message "test")
    (message "test"))
;; Experience broken detangle:3 ends here

[-- Attachment #4: broken-detangle--working.el --]
[-- Type: text/x-emacs-lisp, Size: 657 bytes --]

;; [[file:~/Documents/git/broken-detangle.org::*Experience%20broken%20detangle][Experience broken detangle:1]]
(defun test
    (message "broken detangle"))
;; Experience broken detangle:1 ends here

;; [[file:~/Documents/git/broken-detangle.org::*Experience%20broken%20detangle][Experience broken detangle:2]]
(defun test
    (message "broken detangle")
  (message "test"))
;; Experience broken detangle:2 ends here

;; [[file:~/Documents/git/broken-detangle.org::*Experience%20broken%20detangle][Experience broken detangle:3]]
(defun test
    (message "broken detangle")
    (message "test")
    (message "test"))
;; Experience broken detangle:3 ends here

  reply	other threads:[~2018-06-04 12:42 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-01 17:27 org-detangle seems broken Frederick Giasson
2018-06-02 10:17 ` Nicolas Goaziou
2018-06-04 12:42   ` Frederick Giasson [this message]
2018-06-05  9:59     ` Nicolas Goaziou
2018-06-05 12:18       ` Frederick Giasson
2018-06-05 23:19         ` Grant Rettke
2018-06-06 12:31           ` Frederick Giasson
2018-06-06 16:04             ` Grant Rettke
2018-06-06 16:18               ` Frederick Giasson

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=CADjL5rXkqk+i3eGLJ77siAJQgBHgLoJSnFXgjwKB4JiA0vqXmQ@mail.gmail.com \
    --to=fred@curbside.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mail@nicolasgoaziou.fr \
    /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).