Emacs notes
From Reboil
This page contains notes for using Emacs.
Stats
Commands
- downcase-region
- (Shortcut:
C-x C-l) Lowercases selected region. See also upcase-region.
- downcase-word
- (Shorcut:
M-l) Lowercases word after point.
- capitalize-word
- (Shorcut:
M-c) Uppercase word following point.
- fill-paragraph
- (Shortcut:
M-q) Depending on mode, reduces column width of text to that set byset-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 aTABcharacter.
- 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-=, orC-x C--) Increase or decrease size of text, pressing+,-or0to adjust. Note: only effective on GUI.
- upcase-region
- (Shortcut:
C-x C-u) Uppercases selected region. See also downcase-region.
- upcase-word
- (Shorcut:
M-u) Uppercases word after point. See also downcase-word.
Modes
hs-minor-mode
Shortcuts:
- Hide current block (
M-x hs-hide-block) - Show current block (
M-x hs-show-block)C-c @ C-s
- Hide all
C-c @ C-M-hC-c @ C-t
- Show all
C-c @ C-M-sC-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> RET M-x query-replace-regexp \([0-9]+\)$ <sup>[[../Notes#c4n\1|\1]]</sup> RET
Turn roman numeral subsection into roman numeral subsubsection via query-replace-regexp using a backreference[2].
M-x query-replace-regexp ^J== \([IVX]+\) ==^J ;; Note: the above may be composed via: C-q C-j = = \ ( [ I V X ] + \ ) = = C-q C-j RET ^J=== \1 ===^J RET
- This converts
== VII ==
- into:
=== VII ===
History
See also
External links
References
- ↑ Kirk Kelsey. (2010-07-19). “How can I enable line wrap on word boundaries only in Emacs?”. stackoverflow.com. Accessed 2024-03-13.
- ↑ “17.10.2 Regexp Replacement”. gnu.org. Accessed 2025-10-17.
Footnotes
Comments
- ↑ Baltakatei: 2025-01-20: For more on Emacs's particular flavor of regular expressions, see the manual.