Questions tagged [fill-paragraph]

a command which wraps the words or redistributes the newlines within a paragraph as defined by the current major-mode

76 questions
30
votes
5 answers

Editing files with one-sentence-per-line

A bit of background. I’m trying to version-control my latex documents, and the effectiveness of this initiative would be greatly improved if I adopt a one-sentence-per-line approach. For instance, the following is what my documents will look…
Malabarba
  • 22,878
  • 6
  • 78
  • 163
19
votes
2 answers

Is there fully-automatic fill-paragraph-mode for code comments?

I'm looking for a minor mode to keep paragraphs filled at all times while typing (similar to what aggressive-indent-mode does for indentation). It also needs to be smart enough to only fill comments (and maybe strings depending on the…
dshepherd
  • 1,281
  • 6
  • 18
17
votes
2 answers

Make fill-paragraph in python docstring leave the triple-quotes on separate line

I type a python docstring all on one line like this: """ This is a long docstring. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Donec a diam lectus. Sed sit amet ipsum mauris. Maecenas congue ligula ac quam viverra nec consectetur ante…
bstpierre
  • 280
  • 2
  • 10
14
votes
2 answers

How can I split paragraph into one-line-per-sentence but still keep it wrapped visually?

This is similar to Editing files with one-sentence-per-line (in function as well as motive), but I wish to have a full, flowing paragraph rather than visual breaks at every sentence. I would like to have a minor mode that, when active, will visually…
Sean Allred
  • 6,861
  • 16
  • 85
12
votes
3 answers

How to make fill-region/paragraph identify a paragraph prefix?

Let's say I have the following buffer. 1. lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum Hitting M-q here while in text-mode leads to the following. 1. lorem ipsum lorem ipsum lorem ipsum…
Malabarba
  • 22,878
  • 6
  • 78
  • 163
11
votes
3 answers

fill-paragraph marks file as changed, even if it didn't do anything

Whenever I call fill-paragraph, the buffer is always marked as modified, even if the command had no effect (i.e. if the paragraph was already filled). It also creates an empty undoable action (easily detected with undo-tree-mode). Other commands…
Lily Chung
  • 375
  • 1
  • 8
9
votes
1 answer

Overriding fill-paragraph in LaTeX mode

I would like to change the behavior of fill-paragraph in certain modes (e.g. LaTeX-mode provided by AucTeX). I could just rebind the key M-q, but I am also using evil-mode whose implementation of evil-fill-and-move uses fill-region. Ideally, my…
Kevin
  • 534
  • 1
  • 5
  • 15
9
votes
2 answers

How to fill (wrap) an org mode heading?

I would like to fill (wrap) a long heading in org mode. I don't see mention of how to do so in the org manual. If I manually wrap the line by inserting a newline, org mode does not recognize the wrapped text as a heading. Is this possible? Note:…
David J.
  • 1,809
  • 1
  • 13
  • 23
9
votes
1 answer

org-fill-paragraph in a list with checkboxes doesn't take into account the checkboxes

I'm trying to figure out a way to change the behavior of org-fill-paragraph for a list with checkboxes. I would like the indentation to take into account the checkbox, but here is what I see: - This is a long line in a plain list and fill-paragraph…
Yoav
  • 91
  • 2
9
votes
1 answer

How to fix markdown-mode's fill-paragraph?

markdown-mode is pretty good at filling paragraphs overall, but there's one flaw that really bothers me. If a paragraph contains a line which ends in two spaces, it only starts filling never fills that line. For instance, take the following example,…
Malabarba
  • 22,878
  • 6
  • 78
  • 163
7
votes
1 answer

fill-paragraph (`M-q`) for s-expressions?

With M-q (aka fill-paragraph), it is possible to format a single line of text nicely. Is there a command or function which does a similar thing for lisps s-expressions? It should break one-liner lisp expression where it is reasonable. A command or…
jue
  • 4,476
  • 8
  • 20
7
votes
1 answer

How realign existing contents of buffer on column-width?

I added the following settings to my dot-Emacs: (add-hook 'org-mode-hook 'turn-on-auto-fill) (add-hook 'org-mode-hook (lambda() (set-fill-column 80))) When I'm typing sentences in an existing Org-file which are longer than 80 columns, it…
ReneFroger
  • 3,855
  • 22
  • 63
7
votes
3 answers

Copy region from emacs without newlines

I would like to be able to easily select a region of text from Emacs and then paste it into another app or browser - with all the extra fill-paragraph newlines removed so that the paragraph display in the other app can work properly. The…
jmay
  • 363
  • 2
  • 9
6
votes
2 answers

How can I fill-paragraph a string according to its value rather than its input syntax?

I have a docstring to a simple function, but the docstring uses many escape sequences to explain the reasoning for the function. (defun sx-encoding-normalize-line-endings (string) "Normalize the line endings for STRING. The API returns strings…
Sean Allred
  • 6,861
  • 16
  • 85
6
votes
0 answers

Incorrect filling of Python docstrings in pep257 mode

I have python-fill-docstring-style set to pep-257 (default) and I'm trying to fill docstring paragraphs. However, python mode does not count """ towards the number of characters, nor does it consider indentation, resulting in: def function(self): …
1
2 3 4 5 6