2024-04-18

emacs

emacs can be run within a terminal or with a graphical interface for xserver. colors and font-rendering may look different. i prefer emacs on the terminal because it seems simpler, can be used in screen sessions, and i would not have to set up xserver forwarding through ssh sessions for example.

fast startup

start emacs with "emacs --daemon" and open files with "emacsclient -tc" ("t" uses the terminal, "c" creates a new frame). this way emacs is not started anew when you open a file for editing

short name script

these shell scripts can be put, with the executable bit set, into a path listed in $PATH

open and edit files on the current terminal

file name: e

#!/bin/sh

emacsclient -tc

usage

e readme.md

open files in the background

useful for searching and adding files in one terminal and editing in an open emacs window in another terminal.

file name: ea

#!/bin/sh

for file in "$@"
do
  emacsclient -e '(find-file "'$file'")'
done

usage

ea readme.md

modes

  • auto-complete word autocompletion

  • smartparens structural editing of bracket expressions. alternative to paredit

  • web-mode handles syntax-highlighting for files with mixed languages like html templates

  • adaptive-wrap long lines start on the next line with indent

  • sph-scheme-mode simple scheme mode

  • corral quickly surround words with characters in emacs

  • highlight-symbol highlight and rename the current word throughout the buffer

modes i had issues with

  • paredit: syntax recognition, integrated auto-format, overriding keybindings, does not work so well with non-s-expression based languages, commands seem more clear and ordered in smartparens-mode
  • org-mode: i think it does too much and is therefore too complicated. i find #(link-c-one ("itpn" "syntax" "note")) to be a better note taking format than org-modes asterisk syntax

links