emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] M-x fill-region equivalent for lists?


From: John Hendy
Subject: Re: [O] M-x fill-region equivalent for lists?
Date: Wed, 18 Sep 2013 10:31:12 -0500

On Wed, Sep 18, 2013 at 4:15 AM, Eric S Fraga <address@hidden> wrote:
> John Hendy <address@hidden> writes:
>
>> Greetings,
>>
>>
>> When editing lists after deleting words (shortening lines) and/or
>> concatenating one line with the one that follows (to remedy a
>> shortened line), I end up with an "unfilled" list item. Is there an
>> Org equivalent to `M-x fill-region` on paragraphs to tidy up the Org
>> document list entries?
>
> Doesn't fill-paragraph work?  It does for me.
>
> Well, to be precise, I have M-q bound to maybe-fill-paragraph which is
> defined as
>

Sort of. Screenshots attached:
- as-is.png is the text from my initial email just yanked into Emacs

- uneven-start.png is the result of `M-x fill-paragraph` on that text

- even-start.png is the result of `M-x fill-paragraph` on the text if
I make sure the start of every line is justified with two spaces, as
it would if I'd been writing that full line directly in an Org list
item and then deleted/shortened some of the lines.

- default.org is me taking the original yanked text and arranging it
all on one line, then pressing space at the end of the line.

So... if the start of the lines in an item aren't even, you get an
uneven fill, and in both cases, the right ragged edge is more ragged
than Org would have done on it's own. I didn't know about this
function and have just always used fill-region (not sure why!), so
thanks for suggesting it, as it's definitely getting things close.


John

> #+begin_src emacs-lisp
> (defun maybe-fill-paragraph (&optional justify region)
>   "Fill paragraph at or after point (see `fill-paragraph').
>
> Does nothing if `visual-line-mode' is on."
>   (interactive (progn
>          (barf-if-buffer-read-only)
>          (list (if current-prefix-arg 'full) t)))
>   (or visual-line-mode
>       (fill-paragraph justify region)))
> #+end_src
>
> HTH,
> eric
> --
> : Eric S Fraga (0xFFFCF67D), Emacs 24.3.50.1, Org release_8.1.1-7-gaecdf5
>

Attachment: as-is.png
Description: PNG image

Attachment: uneven-start.png
Description: PNG image

Attachment: even-start.png
Description: PNG image

Attachment: default-org.png
Description: PNG image


reply via email to

[Prev in Thread] Current Thread [Next in Thread]