/emacs

a personalized, intimate config for emacs

Primary LanguageEmacs LispMIT LicenseMIT

Note: Screenshots are probably outdated.

previews/preview1.png previews/preview2.png

A heavily customized configuration for vanilla emacs. It originally started as a fork of elegant-emacs, though by now most of it is written from scratch.

Deps

  • Emacs built from master branch. Older versions are not guaranteed to work. If you have an emacs version < 27, this config definitely won’t work. Given the various enhancements, I don’t think you should be running a version less than 27 anyways.
  • Fonts (optional):
    • Fixed pitch: Cascadia code
    • Fixed pitch serif: Go Mono (used for texinfo docs, help buffers, and other text heavy monospace things)
    • Variable pitch serif: ETBembo
    • Variable pitch sans serif: Cantarell
    • CJK: Noto Serif CJK JP

Tips

Make sure to check the lisp/custom-ops.el before you use the config. These contain system specific options that you will need to change to match your system. In fact, if you want you can remove the contents of the entire file, leaving only (provide 'custom-ops). I recommend you put all your custom system-specific or package-specific configuration in this one file, so it’s all in one place. This is also the file which stores your options set with M-x customize.

If you want to use the same packages I do, just do M-x package-install-selected-packages after running M-x package-refresh-contents.

This config is created with the intent to replace most system interaction with emacs. Though the startup time is fairly reasonable due to lazy loading most things (should be <1s on any relatively modern system), using emacs as a daemon is still highly recommended. Here are some additional usage info about this config:

Packages
I use the built-in package.el. I prefer managing the precise times things are loaded myself rather than using something like use-package, though you can use that if you want to. If you want to a streamlined way to fetch code snippets from places like EmacsWiki or Github that aren’t in any package repo, I strongly suggest using quelpa recipes. Don’t forget to run M-x package-refresh-contents each time before you perform package actions.
Org-mode
This config is fairly heavily optimized for writing in Org-mode.
  • The default LaTeX compiler is xelatex, so if you are planning on exporting with LaTeX, make sure you have that installed, or change it.
  • I recommend using Org agenda for planning. It can be called with C-c a.
  • I recommend the additional org packages to look into: org-cdlatex , org-download, org-fragtog
  • For citing sources in academic writing, the following is the setup I use, integrating the built-in org-cite (C-c C-x @) with BibTeX:
;; Use after M-x package-install bibtex-completion
;; replace paths with ones on your system
(require 'bibtex-completion)
(setq bibtex-completion-bibliography '("~/media/academic/references.bib")
      bibtex-completion-library-path "~/media/academic/pdfs/"
      bibtex-completion-notes-path "~/media/academic/notes/")

(defun open-pdf-from-bibtex ()
  "Open a pdf file from a bibtex entry, if it exists"
  (interactive)
  (bibtex-completion-open-pdf (list (bibtex-completion-get-key-bibtex))))
(defun open-notes-from-bibtex ()
  (interactive)
  (bibtex-completion-edit-notes (list (bibtex-completion-get-key-bibtex))))

(define-key bibtex-mode-map (kbd "C-c C-v p") 'open-pdf-from-bibtex)
(define-key bibtex-mode-map (kbd "C-c C-v n") 'open-notes-from-bibtex)

(setq org-cite-global-bibliography bibtex-completion-bibliography)
    
Shell commands
Most of my shell interaction is through emacs using the (shell-command) (M-S-!)and (async-shell-command) (M-S-&) functions. In the case you need an interactive shell, I recommend the built-in eshell, some usability customizations of it are included in this config. In the case you need a full terminal emulator, I recommend the vterm package.
Dired
This config includes configuration for dired. Before you use it, I would very strongly recommend you install and enable the dired-async package. Otherwise, if you move a large file that takes some time, it will block emacs until the operation is finished.
RSS/atom feed reader
This config includes configuration for the built-in newsticker. If you have curl installed, I strongly recommend you to use that instead of emacs built-in (url-retrieve):
(setq newsticker-retrieval-method 'extern
      newsticker-wget-name "curl"
      newsticker-wget-arguments '("--silent" "--location"))
    
Matrix and IRC
I recommend using ement for Matrix, and the builtin ERC for IRC.
Light/Dark theme
This config includes both a light and dark theme. The default theme is light theme and the function is called blossom. The dark theme function is called sayo. To toggle theme on the fly, use M-x theme-toggle.
Splash Screen
This config includes a very rudimentary splash screen (see data/splash.el) which shows an image, and the init time. To customize the images, just change the files in the data/splash-img directory. An image will be randomly chosen from there. The names of the files don’t matter, and you can use any image type supported by your build of emacs.
Ligatures
Use this snippet with this (assuming you are using Cascadia code and ET Bembo). Note that performance will be negatively impacted:
(let ((mono-ligset '("|||>" "<|||" "<==>" "<!--" "####" "~~>" "***" "||=" "||>"
                     ":::" "::=" "=:=" "===" "==>" "=!=" "=>>" "=<<" "=/=" "!=="
                     "!!." ">=>" ">>=" ">>>" ">>-" ">->" "->>" "-->" "---" "-<<"
                     "<~~" "<~>" "<*>" "<||" "<|>" "<$>" "<==" "<=>" "<=<" "<->"
                     "<--" "<-<" "<<=" "<<-" "<<<" "<+>" "</>" "###" "#_(" "..<"
                     "..." "+++" "/==" "///" "_|_" "www" "&&" "^=" "~~" "~@" "~="
                     "~>" "~-" "**" "*>" "*/" "||" "|}" "|]" "|=" "|>" "|-" "{|"
                     "[|" "]#" "::" ":=" ":>" ":<" "$>" "==" "=>" "!=" "!!" ">:"
                     ">=" ">>" ">-" "-~" "-|" "->" "--" "-<" "<~" "<*" "<|" "<:"
                     "<$" "<=" "<>" "<-" "<<" "<+" "</" "#{" "#[" "#:" "#=" "#!"
                     "##" "#(" "#?" "#_" "%%" ".=" ".-" ".." ".?" "+>" "++" "?:"
                     "?=" "?." "??" ";;" "/*" "/=" "/>" "//" "__" "~~" "(*" "*)"
                     "\\\\" "://"))
      (variable-ligset '("fl" "fi" "ffi" "ffl")))
  (ligature-set-ligatures 't '("www"))
  (dolist (mode '(eww-mode org-mode))
    (ligature-set-ligatures mode variable-ligset))
  (ligature-set-ligatures 'prog-mode mono-ligset)
  (ligature-set-ligatures 'org-mode mono-ligset) ;; for codeblocks
  (global-ligature-mode t))
    
Buffer management
This config comes with configuration for ibuffer. You can set your own rules for filter groups. Check here for examples.
Scratch buffer
The scratch buffer is very useful for storing temporary information and testing code. This config is set up with Org-mode in the scratch buffer with three headings and a code block for testing. I highly recommend using persistent-scratch to save the scratch buffer across sessions.
Scrolling enhancements
This config comes with reasonable defaults for keyboard and mouse wheel scrolling. If you would like smooth scrolling, I recommend using the new built-in pixel-scroll-precision-mode. Make sure to build with --with-xinput2 flag if you want it to work well.