Re: [O] org-detangle seems broken

2018-06-06 Thread Frederick Giasson
Hi


>
> > block to its tangled source is created, then we could use it with that
> option in `org-babel-detangle` to switch back to the source if it is the
> wish of the user.
>
> It sounds like org-babel-tangle-jump-to-org is what you want.
>

In fact it is its opposite that I need, code block to tangled source file.

Fred

>


Re: [O] org-detangle seems broken

2018-06-06 Thread Grant Rettke
On Wed, Jun 6, 2018 at 7:31 AM, Frederick Giasson  wrote:
> If this is really the behavior, then I think that a new option should be 
> added to it such that we can choose one behavior or the other. If a function 
> that jump from a code
> block to its tangled source is created, then we could use it with that option 
> in `org-babel-detangle` to switch back to the source if it is the wish of the 
> user.

It sounds like org-babel-tangle-jump-to-org is what you want.



Re: [O] org-detangle seems broken

2018-06-06 Thread Frederick Giasson
Hi Grant,


I think it is expected. The code looks like this:
>
> (when (setq new-body (org-babel-tangle-jump-to-org))
>   (org-babel-update-block-body new-body))
>

Yeah not sure I fully understand that code. Basically it does this for each
code block that needs to be detangled right? I am just not sure why the
focus doesn't return back to the source at the end of the process.


> The first time I detangled I was surprised, too.
>
> But then it hit me: if you are detangling then you probably might want to
> 1. See the updated code
> 2. Commit the updated code
>

Yes, I agree with you. However on a team that work on a LP project,
different people have different preferences and workflows. Personally I
only code in the Org-file, and toggle a code block to its major mode if I
need something provided by the major mode (coding in Clojure). However,
some people prefer see the full namespace (one namespace per Org file)
directly in Cider (the major mode) and detangle from there (this is why I
got interested in detangling).

In their case, having the buffer switching back to the Org file is a bit
irritating, particularly since there is no (yet) any function that let you
switch to the tangle source file of a code block.

If this is really the behavior, then I think that a new option should be
added to it such that we can choose one behavior or the other. If a
function that jump from a code block to its tangled source is created, then
we could use it with that option in `org-babel-detangle` to switch back to
the source if it is the wish of the user.

Thoughts?


Thanks,

Fred


Re: [O] org-detangle seems broken

2018-06-05 Thread Grant Rettke
On Tue, Jun 5, 2018 at 7:18 AM, Frederick Giasson  wrote:
> There is one last thing related to =org-babel-detangle= that seems "broken"
> is that as far as I can see, the top =save-excursion= should save the
> position of the cursor of the source file and keep the buffer at that
> position when we perform a detangling on it, no?
>
> Right now, the behavior is that when we do a detangle from a source file,
> the org file get opened in the buffer of the source file.
>
> However, I think that the right behavior is that when we detangle that the
> remain at the same position in the source file otherwise this gets confusing
> in my opinion.
>
> Is that a bug or the expected behavior?

I think it is expected. The code looks like this:

(when (setq new-body (org-babel-tangle-jump-to-org))
  (org-babel-update-block-body new-body))

The first time I detangled I was surprised, too.

But then it hit me: if you are detangling then you probably might want to
1. See the updated code
2. Commit the updated code

So now I like it.



Re: [O] org-detangle seems broken

2018-06-05 Thread Frederick Giasson
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*.
>
> This is fixed in "master".
>

That is great! Working perfectly no, thanks!



> > 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.
>
> I couldn't reproduce this. If the fix below doesn't solve it, could you
> provide a dedicated ECM?
>

Yes, that fixed it as well.



There is one last thing related to =org-babel-detangle= that seems "broken"
is that as far as I can see, the top =save-excursion= should save the
position of the cursor of the source file and keep the buffer at that
position when we perform a detangling on it, no?

Right now, the behavior is that when we do a detangle from a source file,
the org file get opened in the buffer of the source file.

However, I think that the right behavior is that when we detangle that the
remain at the same position in the source file otherwise this gets
confusing in my opinion.

Is that a bug or the expected behavior?

Thanks!

Take care

Fred


Re: [O] org-detangle seems broken

2018-06-05 Thread Nicolas Goaziou
Hello,

Frederick Giasson  writes:

> 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*.

This is fixed in "master".

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

I couldn't reproduce this. If the fix below doesn't solve it, could you
provide a dedicated ECM?

Thank you.

Regards,

-- 
Nicolas Goaziou0x80A93738



Re: [O] org-detangle seems broken

2018-06-04 Thread Frederick Giasson
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 
wrote:

> Hello,
>
> Frederick Giasson  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
>


broken-detangle.org
Description: Binary data
;; [[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
;; [[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


Re: [O] org-detangle seems broken

2018-06-02 Thread Nicolas Goaziou
Hello,

Frederick Giasson  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



[O] org-detangle seems broken

2018-06-01 Thread Frederick Giasson
Hi Everybody,

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?

Thanks,

Take care,

Fred