Questions tagged [fill-paragraph]

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

Filter by
Sorted by
Tagged with
28
votes
4answers
2k views

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, ...
19
votes
2answers
1k views

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 (...
16
votes
2answers
1k views

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 ...
14
votes
2answers
2k views

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 ...
12
votes
3answers
547 views

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 ...
11
votes
3answers
127 views

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 ...
9
votes
2answers
3k views

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 ...
9
votes
1answer
532 views

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 ...
8
votes
1answer
751 views

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 ...
7
votes
3answers
1k views

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 ...
6
votes
1answer
252 views

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 ...
6
votes
2answers
166 views

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 ...
6
votes
1answer
563 views

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 ...
6
votes
1answer
383 views

Retooling fill-paragraph to append trailing spaces

I'm using emacs as an external editor for mutt, and am hoping to get format=flowed messages to compose properly. The default behavior for fill-paragraph is to end lines without any whitespace, but the ...
5
votes
2answers
368 views

How can I stop org-mode treating a number followed by a full stop as a bullet point?

I'm using org-mode to write some documentation. After changing some wording, fill-paragraph has arranged things so there's a number followed by a full stop at the start of a line. Like this: Blah ...
5
votes
2answers
677 views

How to have fill-paragraph/fill-region break the line after a period?

I'm having trouble getting Emacs to properly fill a section of text when the last word of a suitable line ends with a period. Emacs seems to think that words separated by a period (and space) are ...
5
votes
0answers
57 views

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 ...
4
votes
2answers
282 views

Changing fill-column of elisp docstrings

When I'm writing the docstring for a defun or a defvar, if hit M-q the paragraph always gets filled to 65 characters, regardless of the value of fill-column. Q. How can I get fill-paragraph to always ...
4
votes
2answers
341 views

How can I use par as my paragraph formatter

I'm coming from vim, which has a gq operator that acts much like emacs' fill-paragraph function (M-q). There's a 'formatprg' setting that allows you to point gq at an external program for its ...
4
votes
2answers
601 views

Make fill-paragraph in python-mode work on paragraph, not whole string

If I have the following file: #!/usr/bin/env python3 ''' bla.py Does this and that_ ''' ..and call fill-paragraph with the cusor at _, then it acts on the entire docstring: #!/usr/bin/env python3 '...
4
votes
1answer
194 views

Prevent fill-paragraph from breaking LaTeX citations in Org Mode

Stumbled upon the following problem. Whenever fill-paragraph finds a LaTeX citation such as \citep[][p. 10]{darwin1859} (which appears as (Darwin, 1859, p. 10)), the paragraph gets broken like this: ...
4
votes
1answer
809 views

Fill is not working in org-mode?

While in org-mode I've tried calling fill-paragraph directly. I've tried using auto-fill-mode and refill-mode. I've tried org-fill-paragraph. The fill-column is set appropriately. None of them ...
4
votes
0answers
138 views

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 ...
3
votes
1answer
132 views

Emacs auto fill on period

How can I tweak Emacs auto-fill to fill when a period is inserted? For example, with a (setq fill-column 10) the following will auto-fill when I press the space after "fill". ;; good fill ;; good ;;...
3
votes
1answer
567 views

Why does filling in AUCTeX behave so badly?

I'm using AUCTeX to edit LaTeX files. The behavior of the fill command M-q (also C-c C-q C-p, LaTeX-fill-paragraph) is very erratic. For example, if I have the following text: test $1 + 1 = 2$ test $...
3
votes
2answers
115 views

How to prevent LaTeX verbatim environments to be subject to LaTeX-fill-region

With LaTeX-verbatim-environments-local, it is possible to declare environments that AUCTeX should consider as verbatim ones. \documentclass{article} \begin{document} \begin{myverbatimenv} First ...
3
votes
1answer
137 views

Unfill `mu4e` message before sending

I would like to unfill all paragraphs before sending a message with mu4e. This is because format=flowed is not respected by all platforms (particularly Gmail). I figure that message-send-hook is the ...
3
votes
1answer
289 views

How can I easily word wrap long text files that include programming code

In emacs, the command "escape-q" word wraps a paragraph. However a lot of text I copy from the internet has paragraphs that each consist of several sentences, but are not separated by blank lines. ...
3
votes
0answers
55 views

fill-paragraph chokes on semicolons

I use mutt for email (outside of emacs) and set my EDITOR to an emacsclient invocation. Thus, mutt spawns emacsclient in the same terminal when I want to compose an E-mail, then catches the output ...
3
votes
0answers
92 views

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

This is almost the same question as this one, but not quite. I happen to like the docstring style def f(): """ docstring another line """ so in emacs I have python-fill-docstring-...
2
votes
2answers
70 views

Format help buffers to specific width

I'm helping a visually impaired user make viewing documentation in Emacs easier. He sets his font size such that he has about 40 columns of text in a full-screen frame with no splits (and he has ...
2
votes
1answer
70 views

Org-mode paragraph-start not respected

I want to configure it so that bulleted lists in org mode are there own paragraphs - for example, in a org file, i have: . foo bar baz . baz bar bla When I do fill-paragraph, this results in: . foo ...
2
votes
1answer
72 views

Prevent fill-paragraph from wrapping past horizontal rules

Say I have the following document: Sir Bedevere ------------ Well, now, uh, Lancelot, Galahad, and I, wait until nightfall, and then leap out of the rabbit, taking the French by surprise - not only ...
2
votes
1answer
40 views

fill-paragraph does not honor fill-column

C-h v fill-column gives me 80. Pasting the lorem ipsum text in *scratch* (lines longer than 80) then going M-x fill-paragraph fills around column 66. The same in c-mode. In this mode, comment wraps ...
2
votes
1answer
361 views

What is this M-q behaviour in Emacs 26.1 message mode

Since updating to Emacs 26.1. message mode was changed so that M-q does something unexpected. I have fill-column and message-fill-column both set to 72 and pressing M-q on this text: turns it into ...
2
votes
1answer
168 views

Disabling hanging indentations with fill-paragraph

I want to be able to fill a whole paragraph with fill-paragraph, first line included, between the left-margin and fill-column values (adaptive-fill-mode is disabled). I am able to do this, but I ...
2
votes
1answer
185 views

Org-mode: Automatic fill-paragraph for TODO Closing Note?

In Emacs org-mode, I like to use TODO items. I switched on the automatic closing note, when an entry is marked DONE. A small annoyance is that the fill behavior of the closing note usually changes ...
2
votes
0answers
132 views

indent items in auctex

What I would like to achieve is a deeper indentation of lines in items in Auctex. \begin{itemize} \item This is what I would like to achieve. The beginning of the second line aligns with ...
2
votes
0answers
145 views

Prevent fill-paragraph from breaking Org Mode inline source block

The fill-paragraph function isn't aware of the inline Org Mode source block syntax and is able to destroy it. For instance the following paragraph Lorem ipsum dolor sit amet, consectetur src_emacs-...
1
vote
1answer
92 views

pasting from websites results in 1 long line..anyway to keep the paragraph format?

when copy and pasting from any web site a paragraph and pasting into emacs with S-insert, the paragraph is always a very long line. is there anyway to keep the paragraph structure?
1
vote
1answer
54 views

Want to Alt-Q on a long piece of text - but it has no spaces so it doesn't work

When you press Meta-Q to wrap a long blob of text, it doesn't work, probably because my text has no spaces. my text is the result of a curl, json with no spaces. so how do I tell emacs to add ...
1
vote
1answer
107 views

is there a fill paragraph with bullets combo command for emacs

With emacs how can I easily go from this: to this (has nice indentation and fill-paragraph):
1
vote
3answers
79 views

How to make fill-paragraph respect smileys at end of sentences?

I'm a big fan of fill-paragraph, and also sentence-end-double-space being set to t so that I can easily navigate and edit via backward-sentence, forward-sentence, kill-sentence, transpose-sentences ...
1
vote
1answer
33 views

What module handles word+period within paragraph fill?

I'm experienced with elisp, and I'm using emacs 24.5. I want to modify how fill-paragraph works for a special application, and I'm trying to figure out which elisp code handles the case where a short ...
1
vote
1answer
34 views

Auto fill of # style comments in Emacs python-mode not working

My expectation is that, like for comments in other language modes besides python, I could write a long comment, say 150 chars, and it would automatically fill, i.e., newline and indent with comment ...
1
vote
1answer
33 views

how to set a fill suffix?

I want to fill (wrap) long lines at n characters, ensuring that each new line ends with "///". (That is the "continuation character" for long lines in Stata code. So that something like this This is ...
1
vote
0answers
73 views

Why does Emacs fill-paragraph corrupt this paragraph layout?

To reproduce what appears to be a bug that I'm encountering, create a new buffer with Emacs 26.1 (Fundamental mode is fine), and paste the following text in: Without message passing to worry about, ...
1
vote
1answer
84 views

About `fill-paragraph` in `markdown-mode`

I have a buffer on markdown-mode with the following contents. 10 20 30 40 50 60 70 - a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a a ...
1
vote
0answers
271 views

How to add additional comment syntax to a mode?

In general, given a major mode with a defined comment syntax, what do I have to define or change to add a new comment syntax? By "adding", I mean setting some new characters so that they work with ...
1
vote
0answers
213 views

How to justify all paragraphs of the currect buffer?

I would like to fill justify all paragraphs in the current buffer if no region is selected. I wrote the the following function which performs this job. Is there a better way to write this function? ...