Emacs: Show Formfeed ^L as Line

By Xah Lee. Date: . Last updated: .

Displaying Form Feed Character as Line

Emacs lisp uses the Form Feed character (Form Feed; U+0C) as source code section marker. It is displayed as “^L”.

emacs formfeed as line 2018-08-30 444e7
emacs formfeed as line 2018-08-30

Here's a command to display the Form Feed character as a line.

(defun xah-show-formfeed-as-line ()
  "Display the formfeed ^L char as line.
URL `http://ergoemacs.org/emacs/emacs_form_feed_section_paging.html'
Version 2018-08-30"
  ;; 2016-10-11 thanks to Steve Purcell's page-break-lines.el
    (when (not buffer-display-table)
      (setq buffer-display-table (make-display-table)))
    (aset buffer-display-table ?\^L
          (vconcat (make-list 70 (make-glyph-code ?─ 'font-lock-comment-face))))

Insert Form Feed Character

To insert form feed character, press Ctrl+q then Ctrl+l.

[see Emacs Key Syntax Explained]

Move Cursor to Prev/Next Formfeed

Move cursor to the prev/next page break:

You can set a more easy key that can be held down:

;; keys for moving to prev/next code section (Form Feed; ^L)
(global-set-key (kbd "<C-M-prior>") 'backward-page) ; Ctrl+Alt+PageUp
(global-set-key (kbd "<C-M-next>") 'forward-page)   ; Ctrl+Alt+PageDown

Using Ctrl+Alt makes it consistent with the default keys to navigate lisp code. [see Emacs: How to Edit Lisp Code]

For a detailed discussion of using the Form Feed character as page section marker, see: Emacs Form Feed ^L.

Thanks to Steve Purcell ( https://twitter.com/sanityinc ) for his page-break-lines.el package.

If you have a question, put $5 at patreon and message me on xah discord.
Or support me by Buy Xah Emacs Tutorial

Emacs Tutorial

Emacs Init

Emacs Keys


ELisp Examples

ELisp Write Major Mode

Emacs Init

Init Basics


text editing