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. Abbrevs
In Evil mode C-p runs the command evil-complete-previous which use Dynamic Abbrevs.
4. 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.
4.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
methodpart describes the connection method used to reach the remote host - The
userpart is the username for accessing the remote host - The
hostpart must be a hostname which can be resolved on your local host
4.2. Using SSH method
The simplest remote file name is /ssh:user@host:/path/to/file.
The Host keyword inside an SSH config file can be used to open a
remote connection like so /ssh:framboise:/path/to/file
4.3. Using sudo method
Sometimes, it is necessary to work on your local host under different
permissions. For this, you can use the su or sudo connection method. On
OpenBSD systems, the doas connection method offers the same
functionality. These methods use root as default user name and the return
value of (system-name) as default host name.
Therefore, it is convenient to open a file as /sudo::/path/to/file.
/sudo::/path/to/file is an abbreviation (by assuming default values) for /sudo:root@localhost:/path/to/file
4.4. Combining SSH with sudo
If the su, sudo or doas option should be performed on another host, it can
be combined with a leading ssh or plink option. That means that TRAMP
connects first to the other host with non-administrative credentials, and
changes to administrative credentials on that host afterwards.
In a simple case, the syntax looks like /ssh:alan@remote|sudo::/path/to/file.
5. References
- https://github.com/emacs-tw/awesome-emacs
- https://protesilaos.com/
- https://systemcrafters.net/
- https://www.emacswiki.org/
- https://www.gnu.org/software/emacs/manual/
- https://savannah.gnu.org/mail/?group=emacs
- https://www.masteringemacs.org/
- https://www.youtube.com/@DistroTube
- https://www.youtube.com/@protesilaos
- https://www.youtube.com/@SystemCrafters