Note that there are some explanatory texts on larger screens.

plurals
  1. POFilling Markdown-style list items with hanging indentation in Emacs
    primarykey
    data
    text
    <p>I'd like Emacs to wrap Markdown-style list items with hanging indentation. In fact, even in <code>fundamental-mode</code>, this works quite well. Consider these three list items:</p> <pre><code>* Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </code></pre> <p>When filled using <code>M-q</code> (<code>fill-paragraph</code>), the result is</p> <pre><code>* Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. - Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. + Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. </code></pre> <p>Note that the first two are filled as I'd like, but the last is not. I'm having trouble understanding why the behavior is different in the last case, and how to modify it appropriately.</p> <p>The comments in the source code for <code>fill-paragraph</code> state that the following steps are tried:</p> <blockquote> <ol> <li>Fill the region if it is active when called interactively.</li> <li>Try <code>fill-paragraph-function</code>.</li> <li>Try our syntax-aware filling code.</li> <li>If it all fails, default to the good ol' text paragraph filling.</li> </ol> </blockquote> <p>There is no active region when I press <code>M-q</code> to fill those list items, so step 1 should be skipped. I have not defined a <code>fill-paragraph-function</code> (I verified that <code>fill-paragraph-function</code> is <code>nil</code> in <code>fundamental-mode</code>).</p> <p>This means we get to step three. In the <code>fundamental-mode</code>, all three list markers have the same syntax (as verified with <code>describe-char</code>):</p> <pre><code>character: * (displayed as *) (codepoint 42, #o52, #x2a) syntax: _ which means: symbol character: - (displayed as -) (codepoint 45, #o55, #x2d) syntax: _ which means: symbol character: + (displayed as +) (codepoint 43, #o53, #x2b) syntax: _ which means: symbol </code></pre> <p>Therefore, I do not understand why this step would treat these paragraphs any differently. In looking at the source, it seems this just tries to handle comments, so I think believe three is skipped in the cases above.</p> <p>So, it seems we move to step four, which makes use of <code>paragraph-start</code>. I tried setting <code>paragraph-start</code> to the following (which allows whitespace before the markers):</p> <pre><code>"\f\\|[ \t]*$\\|^[ \t]*[*+-] " </code></pre> <p>This did not work either, so I am at a loss for how to make this work.</p> <p>Do I need to write a custom fill-paragraph function, or is there a simpler approach?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload