Several times I see ^L
in (mostly Emacs Lisp) source codes that looks like are separators of larger logical groups. Is it their real purpose? And if so, how can I use them? Is there a built-in Emacs functionality that utilize it?
views:
388answers:
5That is indeed a page break character, which on older line printers skipped to the next page or paper. Code-wise, it does nothing; it is only there to split the code into larger sections. There are convenient Emacs commands to jump to the next and previous "page", and inserting these characters takes advantage of that.
The Emacs commands backward-page
and forward-page
(C-x [
and C-x ]
), among others, take advantage of ^L
s placed in the code as separators.
The habit did not propagate much to languages other than Emacs-lisp, but most languages treat ^L
as a blank, so you can use these separators in your favorite language if you like the idea. You can type your own ^L
s with C-q C-l
.
A page break to split code into sections. See the following for more details.
When exploring a big file with multiple of such "pages" the function "narrow-to-page" (C-x n p) is handy: it hides everything not in the current page. Then for example searching for a function name to see the callers only leads to matches in that section, so you can really focus on understanding the narrowed region.
Use widen (C-x n w) to see the whole file again.