Git hosting

form-feed: Display ^L glyphs as horizontal lines

Clone

git clone https://depp.brause.cc/form-feed.git

Files

Size Path
img/
35148 LICENSE
3130 README.md
5832 form-feed.el

README.md

About

form-feed is a minor mode that displays pesky ^L glyphs certain developers use to delimit pages in the form of lines spanning the entire window width. It is also possible to display a less wide line by customizing form-line-width before loading the package, see its docstring for possible options.

Screenshot

Installation

Install from MELPA (stable) with M-x package-install RET form-feed RET.

form-feed is also available as a recipe in GNU Guix. Install with guix install emacs-form-feed.

Usage

Enable the minor mode manually with M-x form-feed or in a hook:

(add-hook 'emacs-lisp-mode-hook 'form-feed-mode)

You can also enable it globally:

(global-form-feed-mode)

This allows customizing what modes it should and shouldn't be enabled in, see form-feed-include-modes and form-feed-exclude-modes.

Internals

There are a bunch of ways of attacking the problem, one of the more obscure ones is manipulating the display table of every window displaying the buffer. Unfortunately this approach is limited to replacing a glyph with an array of other glyphs, but guaranteed to work on non-graphical display as well. The other approach is putting an overlay or text property over the glyph which manipulates its look. Since a face on its own won't do the trick, this package uses a lesser known feature of font-lock that allows one to add text properties as part of the face definition associated with the page delimiter glyph and tells it to remove those on fontification changes to make sure disabling works equally well. This also means that while this package is conceptually very simple and non-invasive, it might not work on non-graphical displays. As a workaround I've made Emacs use underlining instead of strike-through on such displays.

The implementation of display lines was inspired by the magic-buffer package, but did eventually remove its "cursor kicking" due to a rather puzzling bug.

Alternatives