Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wspecial-worf-add destroys nested org structure, bug? #34

Open
thorstengrothe opened this issue Sep 30, 2017 · 7 comments
Open

Wspecial-worf-add destroys nested org structure, bug? #34

thorstengrothe opened this issue Sep 30, 2017 · 7 comments

Comments

@thorstengrothe
Copy link

I open a new issue because it has not much to do with my issue a a couple of days ago.. I do not have redefined any worf-mode keys ins this scenario.

Take this simple structure of a org file:

* Testing A
   ** Testing a
   ** Testing b
* Testing B

go to *** Testing A** headline press i to fold it and hit a (wspecial-worf-add) to insert a new heading below. The result looks like this:

bildschirmfoto_2017-09-30_17-04-03

The command inserts the heading after **Testing b, is this a bug?

When I hit c (change mode) + a it works without problems. This are my settings for blank lines in org-mode.

(setq org-blank-before-new-entry
        '((heading . auto)
          (plain-list-item . auto)))

I commented them out but it does not help.

Regards
Thorsten

@abo-abo
Copy link
Owner

abo-abo commented Oct 1, 2017

Here's the state of the buffer when I press a when folded:

* Testing A...
* |
* Testing B

It's consistent with a when unfolded:

* Testing A
** Testing a
** Testing b
* |
* Testing B

Are you getting something else, it's not clear from the screenshot? Can you write down the buffer state as text?

The intention of a is to add a new heading below on the same level.
And ca will add a new heading above, also on the same level.

@thorstengrothe
Copy link
Author

Ok after some testing I found following out...

Start position:

* |Testing A ...
* Testing B

Press a when folded, result looks like this:

* Testing A|...
* Testing B

Go back to beginning of Testing A... and press i nothing happens, press /, structure looks so:

* |Testing A
** Testing a
** Testing b
*
* Testing B

Now go back to Testing A and press i again, suddenly folding works and it looks like this:

* |Testing A...
*
* Testing B

Now back to start positon:

* |Testing A ...
* Testing B

unfold * |Testing A... and press a, result:

* Testing A
** Testing a
** Testing b
*|
* Testing B

Now the last test with the start position:

* |Testing A ...
* Testing B

Run M-x org-insert-heading-respect-content, now it works fine and looks so:

* Testing A...
*|
* Testing B

I guess it has something to do with empty lines between the headers that org needs to distinguish the structure?

I hope it's clear enough now, so you can reproduce the error?

abo-abo added a commit that referenced this issue Oct 2, 2017
* Makefile: New targets - update, compile, plain.

Re #34
@abo-abo
Copy link
Owner

abo-abo commented Oct 2, 2017

Still can't reproduce with emacs -Q.

I added a new setup to improve reproduction. Clone the repo and make update && make plain.

@thorstengrothe
Copy link
Author

Thanks for the support and the setup. I installed it and made some tests and I found the reason for the problem. Pretty simple, this works fine, because there is no space between the lines.

* |A
** a
** b
* c

This works not, because there is an empty line between b and c but if you fold * A you don't see the empty line and it fails, if you delete the line between ** b and * c it works again.

* |A
** a
** b

* c

Next I started with:

* A
* |B

If you pres a everything is fine but if you try this example:

* A
* B

* |C

and press a org inserts automatically an empty line like this:

* A
* B

* C

*|

and I think this is the problem. So it has nothing to to with worf it's a orgmode problem, very strange..

@thorstengrothe
Copy link
Author

Can you reproduce this now?

@abo-abo
Copy link
Owner

abo-abo commented Oct 6, 2017

Can you reproduce this now?

I reproduce it, but this is the expected behavior of worf-add. It looks at the spacing before the current heading and reproduces it for the new heading.
This feature was requested by a user, and I find it convenient as well.

@thorstengrothe
Copy link
Author

Ok, thanks for explanation, I found another reason for this behaviour. In my .init.el I got

(org-hide-block-all)

this made problems to add a new heading. I disabled this and with no space after the last line it works now fine:

* Test
#+begin_src emacs-lisp
 Code
#+end_src
* Next Heading

It's important that source blocks ar not folded otherwise it does not work for me. I guess that was the jumping point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants