Emacs: Show Form Feed 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://xahlee.info/emacs/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 ( [2012-11-14 https://twitter.com/sanityinc ] ) for his page-break-lines.el package.

Emacs Init

Init Basics



Text Editing



Restore Things





Advanced Init Tips