Emacs

Table of Contents

1. Description

Some notes and references about GNU Emacs.

2. Selecting an area of text

To select text like Vim characterwise-visual mode we can use rectangles, C-x SPC to toggle rectangle mark mode.

3. Isearch

Search through Info pages with commands like isearch-forward or isearch-backward.

See M-x describe-function RET isearch-forward RET for a list of commands to run while searching, e.g. M-% to use query-replace.

4. Imenu

Jump to a package in list-packages with imenu bound to M-g i.

5. Narrowing

6. Kill ring

Yank (paste) from kill-ring (“clipboard”) with M-y (yank-pop)

7. Increment numbers

Press C-M-% (query-replace-regexp) then 1 and \# as arguments to change numbers from 1 1 1 1 to 0 1 2 3.

8. Abbrevs

In Evil mode insert state C-p runs the command evil-complete-previous which use dynamic abbrevs.

9. Highlight

Highlight symbol near point with M-s h . (highlight-symbol-at-point) and M-s h u (unhighlight-regexp) to unhighlight things, see M-s h C-h for other key bindings.

10. Define key bindings

  1. info “(use-package) Displaying keybindings”
  2. info “(use-package) Global keybindings”
  3. info “(emacs) Init Rebinding”
  4. info “(elisp) Low-Level Key Binding”

The bind-key.el library (used by use-package keyword :bind) adds the defined key bindings to describe-personal-keybindings (function provided by the same library) [1] [2].

The keymap.el library (provides functions like keymap-global-set) does not benefits from describe-personal-keybindings [3].

They all seems to use define-key under the hood which is a lower level function to define key bindings [4].

11. TRAMP

TRAMP extends the Emacs file name syntax by adding a remote component. A remote file name always looks like /method:user@host:/path/to/file.

11.1. File name syntax

Remote file names have method, user and host parts prepended. All of them, and also the local file name part, are optional, in case of a missing part a default value is assumed. The default value for an empty local file name part is the remote user’s home directory. The shortest remote file name is thus /-::. The - notation for the default method is used for syntactical reasons, *note info “(tramp) Default Method”.

/method:host:/path/to/file opens file /PATH/TO/FILE on the remote host HOST, using the method METHOD.

11.2. Open file on local host with sudo

Abbreviation of /sudo:root@localhost:/path/to/file (see notes:sudo).

/sudo::/path/to/file

11.3. Open file on remote host

The remote host can be the Host keyword value defined in the ssh client configuration file (see notes:ssh).

/ssh:framboise:~/file

11.4. Open file on remote host with doas

Combining methods to open a remote file as admin (see notes:doas).

/ssh:framboise|doas::/path/to/file

12. References

lun. 13 juillet 2026

Generated with Emacs 30.1 (Org mode 9.7.11)