Emacs notes

From Reboil

This page contains notes for using Emacs.

Stats

Commands

fill-paragraph
(Shortcut: M-q) Depending on mode, reduces column width of text to that set by set-fill-column
query-replace
Search and replace, prompting (i.e. querying) for each replacement.
query-replace-regexp
Search and replace with regular expressions[cmt 1], prompting (i.e. querying) for each replacement.
quoted-insert TAB
(Shortcut: C-q TAB) Inserts a TAB character.
revert-buffer
Reload file to buffer, discarding changes.
set-fill-column
Prompts setting the paragraph width produced by commands such as fill-paragraph
toggle-truncate-lines
Make long lines wrap around to stay within view in a window.
text-scale-adjust
(Shortcut: C-x C-+, C-x C-=, or C-x C--) Increase or decrease size of text, pressing +, - or 0 to adjust. Note: only effective on GUI.

Modes

hs-minor-mode

Reference manual.

Shortcuts:

  • Hide current block (M-x hs-hide-block)
    • C-c @ C-h
    • C-c @ C-d (note: required for vg2's LXQt desktop environment )
  • Show current block (M-x hs-show-block)
    • C-c @ C-s
  • Hide all
    • C-c @ C-M-h
    • C-c @ C-t
  • Show all
    • C-c @ C-M-s
    • C-c @ C-a

visual-line-mode

Wraps lines at word boundaries.[1]

M-x visual-line-mode

Useful techniques

Reformat footnote numbers with query-replace-regexp in Mediawiki wikicode. (e.g. link to a corresponding #c4n{n} anchor in a subpage at [[../Notes]].)

 M-x query-replace-regexp
 \([0-9]+\) 
 <sup>[[../Notes#c4n\1|\1]]</sup>
 ENTER

 M-x query-replace-regexp
 \([0-9]+\)$
 <sup>[[../Notes#c4n\1|\1]]</sup>
 ENTER

History

See also


External links

References

Footnotes


Comments

  1. Baltakatei: 2025-01-20: For more on Emacs's particular flavor of regular expressions, see the manual.