Table of Contents

1. Emacs

Created Saturday 06 January 2024


1.1. having melpa and use-package

(require 'package)
(add-to-list 'package-archives

'("melpa" . "https://melpa.org/packages/") t)

(package-initialize)
(eval-when-compile (require 'use-package))

1.2. a ^H backspace

(global-set-key [(control h)] 'delete-backward-char)
(keyboard-translate ?\C-h ?\C-?)

1.3. neat

(setq require-final-newline t)
(setq show-trailing-whitespace t)

1.4. custom-set-variables

'(custom-enabled-themes '(tsdh-dark))
'(indicate-empty-lines t)
'(menu-bar-mode nil)
'(tab-bar-mode t)
'(tool-bar-mode nil)
'(tool-bar-position 'bottom)
'(warning-suppress-types '((comp)))

1.5. doas

to use doas, use TRAMP's /doas::/path/to/file in find-file. Better than switching to straight-use-package or manually cloning a tiny doas-edit just for this.
Back in 2020 maintainer of Tramp said on Reddit that Tramp will not be prepared for doas on GNU/Linux, and in 2023 it still needed some troubleshooting https://adam.kruszewski.name/2023-05-07-opondoas-emacs-tramp-and-gentoo.html
but for me it works out of the box right now on Arch with maybe a bit unusually recent Emacs.

1.6. use-package

in (use-package package-name), :ensure t will make it auto-download.

1.6.1. ssh-deploy

:hook ((find-file . ssh-deploy-find-file)) to have it run its hook checking for its variables on file opened
:config (ssh-deploy-add-menu) to have it have a menu

1.7. define a minor mode for simple keymap

(define-minor-mode minor-mode-name-mode

"docstring"
:lighter " XX"
:keymap

(let ((map (make-sparse-keymap)))

(define-key map (kbd "C-{") 'whatever-command)
(define-key map (kbd "C-}") 'whichever-command)
map))

define the commands like (defun whichever-command() (interactive) (insert (concat "whatever" "whichever")))