Open hmelman opened 6 years ago
Could you explain how to reproduce this issue with sample markdown text ? Sorry my English is very poor and it is difficult to understand what you say only English sentences.
This document where Title is level 1 and the months are level 2 headings:
Put cursor on line with "Four", type C-c C-u and point moves to "# Title". I'd like it to move to "## January".
Also I think there should be a command to use when point is on "Four" to move to "## February"
Moving up via C-c C-u
should indeed move to ## January
. That is indeed a bug, and thanks for reporting it. I suspect we need to test if the point is at a list first, and if so move to the previous heading.
For the second, in absence of the "up" bug, the best would be a sequence of two commands: C-c C-u
to move up to ## January
and then C-c C-f
to move forward (same level) to ## February
. I'm not sure about adding "up and forward" as a distinct command. That makes for a lot of navigation commands, but of course it's easy to add bindings or macros for those if you use them a lot. Do outline-mode
doesn't have such a command, nor does org
that I know of (both of which markdown-mode
borrows its navigation bindings from).
(Finally a note, which I think you know already, but for the sake of others: Conceptually, markdown-mode
treats the list as a third outline level. So, "previous/back" and "next/forward" with when at * Four
mean the previous and next list items. But the bug is that "up" isn't honoring that concept.)
Please also remember that if there are sublists, "up" should move you up a "list level" and not immediately to the outline level.
I'm not sure what is correct behavior. However current markdown-mode navigation commands behaves similar to org-mode(outline-mode
) navigation commands except a few cases.
* Title
** January
- One
- Two
- Three
- Four
- Five
** February
C-c C-u
(outline-up-heading) on - Four
then cursor moves on * Title
, not ** January
C-c C-b
behavior is different between org-mode
(org-backward-heading-same-level
) and markdown-mode
(markdown-outline-previous-same-level
) in some case(not same level previous header case). In above examples cursor is on Four
and input C-c C-b
then cursor moves on ** January
, while markdown-mode moves cursor on # title
. I suppose org-mode
stops current header if there is no same level previous header, while markdown-mode
does not check there is no same level previous header.
I ran into this again, and had forgotten I had opened this. I tried the outline-mode
example @syohex gave above and indeed that's correct. But it makes some sense. Take this example:
* Main Title
** Sub Title
*** January
- One
- Two
- Three
- Four
- Five
*** February
With point at Four, C-c C-u
moves to "Sub Title" and C-c C-b
moves to "January" (and repeated C-c C-b
from there don't move point). So in outline-mode
the list is treated as the body of the section, C-c C-b
moves back at the same level (which is says it does) and C-c C-u
moves up to the parent level (Sub Title) and C-c C-u
moves up again to "Title". I think this would make sense for markdown-mode
I have a document with one level 1 heading and 12 level 2 headings (one for each month). The body of each of the 12 sections is an unordered list. I found myself editing one of the later list items in October (a few before the end of the section) and wanting to go to the top of November. I figured there was a move to next section command but it turns out there isn't.
First I tried C-c C-n but that moved to the next list item. Fair enough, that's useful. Looking at the menu it seems that command navigates through lists and sections and I find that a little odd (though I appreciate the well named menu item). So I thought I'd move up to the section top and then go to next, C-c C-u moved me to the top level 1 heading instead of the level 2 heading for October. This seems like a bug.
markdown-forward-block
would kind of work in my case, but while a reasonable binding, C-M-} is too hard to type and it would fail if my section had multiple blocks (say two lists or multiple paragraphs) and moves me to the end of the current block and not the top of the next section.So I'd like a way to move from the body of the current section to the start of the next section, even if the body is a list. I'm not sure of the difference between C-c C-f and C-c C-n when in a list, seems like they do the same thing, and if so, I think C-c C-n should move to next section (and not list item).
Also I think there's a bug in
markdown-outline-up
.