Willem Hoek  »  Using Emacs

Jan 05, 2020

The Great Wave off Kanagawa, Hokusai, 1829 - 1833

These notes / reminders are how I use Emacs. It is for my own usage but it might be useful to some of you.

Start Emacs in client/server mode

Emacs can run as a server (daemon) in the background, this speeds up startup time. If there isn’t an Emacs daemon running, it will start one and connect to it.

C:\emacs\bin\emacsclientw.exe -n -c -a ""

Org Mode

C-x n n     Narrow down MARKED AREA
C-x n d     Narrow down to the current NODE
C-x n w     Widen to entire buffer- CANCEL NARROW 

C-c C-e     Export
C-c .       Insert Date-time stamp
C-x r m     Set the bookmark for the visited file (once of)
C-x r l     Bookmark select

Key bindings

C-x RIGHT  switch buffer
C-w     Cut (same as Ctrl-X in Windows)
M-w     Copy (same as Ctrl-C in Windows)
C-y     Paste (same as Ctrl-V in Windows)
C-k     Cut until end of line

C-x c   Exit
C-x s   Save

C-x o	  Select OTHER window
C-x 0	  Close THIS window
C-x 1 	Close all but THIS ONE
C-x 2   Split HOR
C-x 3 	Split VERT

C-x c-b     Buffer list, then d -> kill,  x -> execute)
C-x b       Buffer switch
C-x r-l     (lowercase "L")    Bookmark list

F3      Start recording macro
F4      Stop recording / Play

M-%	Search / replace
M-s o	show all

Entries in ~/.emacs

(setq inhibit-startup-message t)
(setq-default indent-tabs-mode nil)
(setq inhibit-splash-screen t)
(setq ring-bell-function 'ignore)

;; ido mode
(setq ido-enable-flex-matching t)
(setq ido-everywhere t)
(ido-mode 1)

(defalias 'list-buffers 'ibuffer)   ;; make ibuffer default

(require 'package)
(add-to-list 'package-archives
             '("melpa-stable" . "https://stable.melpa.org/packages/"))

(global-set-key (kbd "C-;") 'switch-window) ;; same as C-x o
(global-set-key (kbd "C-c w") 'visual-line-mode)   ;; handy when working with text files

References and further reading

[1] GNU Emacs website https://www.gnu.org/software/emacs/

[2] Using Emacs Series - videos and posts by Mike Zamansky. https://cestlaz.github.io/stories/emacs/

[3] Org Mode - https://orgmode.org/