25.4 Emacs File Local Variables for Markdown


If collaborating with colleagues writing Markdown documents, managed through git, you may be presented with documents that have paragraphs on a single line! This might simply be the default of some Markdown editors. An inclination might be to re-fill the paragraphs over several lines so they fit the screen. However that is not friendly in a git environment.

Instead, when editing documents with very long single line paragraphs, and to retain them, set up some Emacs configurations. By default the long lines get cut off in buffers with no line wrap. So turn on line wrap at words with M-x visual-line-mode or from the menus under Options -> Line Wrapping in This Buffer -> Word Wrap (Visual Line mode). It is also useful to introduce a very large fill column so that a M-q (which I often automatically type) does not re-wrap the line. Do this with C-u 10000 C-x f.

To have this done automatically on loading a Markdown file place this at the top of the file:

<!-- -*- fill-column: 10000; eval: (visual-line-mode t); -*- -->

Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0