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 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.
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

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>
 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

Footnotes


Comments

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