OS integration

Pass system shell environment to Emacs. This is important primarily for shell inside Emacs, but also things like Org mode export to Tex PDF don’t work, since it relies on running external command pdflatex, which is loaded from PATH.

Navigation and editing

Kill line with s-Backspace, which is Cmd+Backspace by default. Note that thanks to Simpleclip, killing doesn’t rewrite the system clipboard. Kill one word by M+Backspace. Also, kill forward word with =Alt-Shift-Backspace, since Alt-Backspace is kill word backwards.

Smarter open-line by bbatsov. Once again, I’m taking advantage of CMD and using it to quickly insert new lines above or below the current line, with correct indentation and stuff.

(defunsmart-open-line ()
"Insert an empty line after the current line. Position the cursor at its beginning, according to the current mode."
(interactive)
(move-end-of-linenil)
(newline-and-indent))
(defunsmart-open-line-above ()
"Insert an empty line above the current line. Position the cursor at it's beginning, according to the current mode."
(interactive)
(move-beginning-of-linenil)
(newline-and-indent)
(forward-line-1)
(indent-according-to-mode))
(global-set-key (kbd"s-<return>") 'smart-open-line)
(global-set-key (kbd"s-S-<return>") 'smart-open-line-above)

Spellchecking

Spellchecking requires an external command to be available. Install aspell on your Mac, then make it the default checker for Emacs’ ispell. Note that personal dictionary is located at ~/.aspell.LANG.pws by default.

(setq ispell-program-name "aspell")

Enable spellcheck on the fly for all text modes. This includes org, latex and LaTeX.

Allow shift selection with arrows. This will not interfere with some built-in shift+arrow functionality in Org.

(setq org-support-shift-select t)

While writing this configuration file in Org mode, I have to write code blocks all the time. Org has templates, so doing <s TAB creates a source code block. Here I create a custom template for emacs-lisp specifically. So, <el TAB creates the Emacs lisp code block and puts the cursor inside.