yet another .emacs.d
- Load Times
It must deliver swift load times to be suitable for ancient hardware such as mine >:’[
time emacs --eval='(kill-emacs)' # should yield -lt 1s
Resulting load times should render
emacs --daemon
a functional choice rather than a practical one. - Out of the clone
It needs to work out of the box for a more “batteries included” like experience. reads: no source packages.
- Eye Candy
It needs to be moderately beautifull in a resource efficient manner.
- UXP
It needs to deliver a next to vanilla user experience.
- init.el
Standard Emacs Init file (with a couple of twists).
- readme.org
This file
- themes
Various tried and true themes, namely:
(setq user-full-name "michaeltd"
user-mail-address "tsouchlarakis@gmail.com"
user-pgp-key "0x01063480"
false nil)
(defun mtd/laptop-p ()
(and (equal (system-name) "genbox")
;;(equal user-login-name "paperjam")
(equal (getenv "USER") "paperjam")))
(defun mtd/reload-emacs-configuration ()
(interactive)
(load-file (concat user-emacs-directory "init.el")))
Add lisp & site-lisp to load path
;; Load path
;; Optimize: Force "lisp"" and "site-lisp" at the head to reduce the startup time.
(defun update-load-path (&rest _)
"Update `load-path'."
(push (expand-file-name "site-lisp" user-emacs-directory) load-path)
(push (expand-file-name "lisp" user-emacs-directory) load-path))
(defun add-subdirs-to-load-path (&rest _)
"Add subdirectories to `load-path'."
(let ((default-directory
(expand-file-name "site-lisp" user-emacs-directory)))
(normal-top-level-add-subdirs-to-load-path)))
(advice-add #'package-initialize :after #'update-load-path)
(advice-add #'package-initialize :after #'add-subdirs-to-load-path)
(update-load-path)
A minimal Emacs config that does just enough and nothing more.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Sanemacs version 0.2.5 ;;;
;;; https://sanemacs.com ;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; Disable menu-bar, tool-bar, and scroll-bar.
(if (fboundp 'menu-bar-mode)
(menu-bar-mode -1))
(if (fboundp 'tool-bar-mode)
(tool-bar-mode -1))
(if (fboundp 'scroll-bar-mode)
(scroll-bar-mode -1))
;;; Fix this bug:
;;; https://www.reddit.com/r/emacs/comments/cueoug/the_failed_to_download_gnu_archive_is_a_pretty/
(when (version< emacs-version "26.3")
(setq gnutls-algorithm-priority "NORMAL:-VERS-TLS1.3"))
;;; Setup package.el
(require 'package)
(setq package-enable-at-startup nil)
;;(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
(unless (assoc-default "melpa" package-archives)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t))
(unless (assoc-default "org" package-archives)
(add-to-list 'package-archives '("org" . "https://orgmode.org/elpa/") t))
(unless package--initialized (package-initialize))
;;; Setup use-package
(unless (package-installed-p 'use-package)
(package-refresh-contents)
(package-install 'use-package))
(eval-when-compile
(require 'use-package))
(setq use-package-always-ensure t)
;;; Useful Defaults
(setq-default cursor-type 'bar) ; Line-style cursor similar to other text editors
;(setq inhibit-startup-screen t) ; Disable startup screen
;(setq initial-scratch-message "") ; Make *scratch* buffer blank
(setq-default frame-title-format '("%b")) ; Make window title the buffer name
(setq ring-bell-function 'ignore) ; Disable bell sound
(fset 'yes-or-no-p 'y-or-n-p) ; y-or-n-p makes answering questions faster
(show-paren-mode 1) ; Show closing parens by default
(setq linum-format "%4d ") ; Prettify line number format
(add-hook 'prog-mode-hook ; Show line numbers in programming modes
(if (fboundp 'display-line-numbers-mode)
#'display-line-numbers-mode
#'linum-mode))
;;(use-package undo-tree ; Enable undo-tree, sane undo/redo behavior
;; :init (global-undo-tree-mode))
;;; Keybindings
(global-set-key (kbd "C->") 'indent-rigidly-right-to-tab-stop) ; Indent selection by one tab length
(global-set-key (kbd "C-<") 'indent-rigidly-left-to-tab-stop) ; De-indent selection by one tab length
;;; Offload the custom-set-variables to a separate file
;;; This keeps your init.el neater and you have the option
;;; to gitignore your custom.el if you see fit.
;;(setq custom-file (expand-file-name "custom.el" user-emacs-directory))
(setq custom-file "/dev/null")
(unless (file-exists-p custom-file)
(write-region "" nil custom-file))
;;; Load custom file. Don't hide errors. Hide success message
(load custom-file nil t)
;;; Avoid littering the user's filesystem with backups
(setq
backup-by-copying t ; don't clobber symlinks
backup-directory-alist
;; '((".*" . (concat user-emacs-directory "saves/"))) ; don't litter my fs tree
;; '((".*" . (expand-file-name "saves/" user-emacs-directory)))
'((".*" . "~/.emacs.d/saves/")) ; don't litter my fs tree
delete-old-versions t
kept-new-versions 6
kept-old-versions 2
version-control t) ; use versioned backups
;;; Lockfiles unfortunately cause more pain than benefit
(setq create-lockfiles nil)
;;; Load wheatgrass as the default theme if one is not loaded already
;; (if (not custom-enabled-themes)
;; (load-theme 'wheatgrass t))
;; Enable the display of the current time, see DisplayTime
(display-time-mode 1)
;; Enable or disable the display of the current line number, see also LineNumbers
(line-number-mode 1)
;; Enable or disable the display of the current column number
(column-number-mode 1)
;; (for Emacs 22 and up) – Enable or disable the current buffer size, Emacs 22 and later, see size-indication-mode
(size-indication-mode 1)
;; Enable or disable laptop battery information, see DisplayBatteryMode.
(display-battery-mode 1)
;; (when (mtd/laptop-p)
;; (use-package doom-modeline
;; :ensure t
;; :init (doom-modeline-mode 1)))
;;(use-package page-break-lines :ensure t)
;;(turn-on-page-break-lines-mode)
;;(use-package all-the-icons :ensure t)
;; (use-package dashboard
;; :ensure t
;; :config
;; (dashboard-setup-startup-hook))
;; (setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
;; (setq dashboard-banner-logo-title "m-x butterfly ret") ;; https://xkcd.com/378/
;; ;; Value can be
;; ;; 'official which displays the official emacs logo
;; ;; 'logo which displays an alternative emacs logo
;; ;; 1, 2 or 3 which displays one of the text banners
;; ;; "path/to/your/image.png" which displays whatever image you would prefer
;; ;; (setq dashboard-startup-banner (concat user-emacs-directory "assets/gnu.png"))
;; ;; (setq dashboard-startup-banner 4)
;; (setq dashboard-startup-banner 'logo)
;; (setq dashboard-center-content t)
;; (setq dashboard-items '((recents . 5)))
;; (setq dashboard-set-heading-icons t)
;; (setq dashboard-set-file-icons t)
;; (setq dashboard-set-navigator t)
;; (setq dashboard-navigator-buttons
;; `(;; line1
;; ((,(all-the-icons-octicon "mark-github" :height 1.1 :v-adjust 0.0)
;; "GitHub"
;; "Browse GitHub"
;; (lambda (&rest _) (browse-url "https://github.com/michaeltd")))
;; (,(all-the-icons-faicon "cloud" :height 1.1 :v-adjust 0.0)
;; "Homepage"
;; "Browse Homepage"
;; (lambda (&rest _) (browse-url "https://michaeltd.netlify.com/")))
;; (,(all-the-icons-faicon "twitter" :height 1.1 :v-adjust 0.0)
;; "Twitter"
;; "Browse Twitter"
;; (lambda (&rest _) (browse-url "https://www.twitter.com/tsouchlarakismd")))
;; (,(all-the-icons-faicon "linkedin" :height 1.1 :v-adjust 0.0)
;; "LinkedIn"
;; "Browse LinkedIn"
;; (lambda (&rest _) (browse-url "https://www.linkedin.com/in/michaeltd"))))))
;; (setq dashboard-set-init-info t)
(use-package rainbow-delimiters :ensure t)
(add-hook 'clojure-mode-hook 'rainbow-delimiters-mode)
(add-hook 'prog-mode-hook 'rainbow-delimiters-mode)
(setq custom-safe-themes t)
(add-to-list 'custom-theme-load-path (concat user-emacs-directory "themes/"))
;; (when (not (mtd/laptop-p)) (load-theme 'dracula t))
(when (mtd/laptop-p) (load-theme 'dracula t))
;; (when (mtd/laptop-p) (load-theme 'tron-legacy t))
;; (load-theme 'dracula t)
;; (add-hook 'after-init-hook (lambda () (load-theme 'xresources)))
;; (add-hook 'emacs-startup-hook (lambda () (load-theme 'xresources)))
;; (when (not (mtd/laptop-p))
;; (use-package doom-themes
;; :config
;; ;; Global settings (defaults)
;; (setq doom-themes-enable-bold t ; if nil, bold is universally disabled
;; doom-themes-enable-italic t) ; if nil, italics is universally disabled
;; ;; (load-theme 'doom-outrun-electric t)
;; ;; Enable flashing mode-line on errors
;; (doom-themes-visual-bell-config)
;; ;; Enable custom neotree theme (all-the-icons must be installed!)
;; (doom-themes-neotree-config)
;; ;; or for treemacs users
;; (setq doom-themes-treemacs-theme "doom-colors") ; use the colorful treemacs theme
;; (doom-themes-treemacs-config)
;; ;; Corrects (and improves) org-mode's native fontification.
;; (doom-themes-org-config)))
(when (mtd/laptop-p) (set-face-attribute 'default nil :font "Source Code Pro" ))
(setq dired-listing-switches "-aBhl --group-directories-first")
(global-prettify-symbols-mode t)
(setq scroll-conservatively 100)
;; (global-hl-line-mode)
(setq inhibit-startup-screen t)
;; Org-Babel tangle
(require 'ob-tangle)
;; Setup Babel languages. Can now do Literate Programming
(org-babel-do-load-languages 'org-babel-load-languages
'((python . t)
(shell . t)
(emacs-lisp . t)
;;(ledger . t)
(ditaa . t)
(js . t)
(C . t)))
(use-package rust-mode :ensure t)
;; (use-package neotree :ensure t)
;; (global-set-key [f8] 'neotree-toggle)
;; (setq neo-theme (if (display-graphic-p) 'icons 'arrow))
This package is for creating and managing multiple terminal buffers in Emacs.
(when (require 'multi-term nil t)
(progn
;; custom
;; (customize-set-variable 'multi-term-program "/usr/local/bin/fish")
(customize-set-variable 'multi-term-program "bash")
;; focus terminal window after you open dedicated window
(customize-set-variable 'multi-term-dedicated-select-after-open-p t)
;; the buffer name of term buffer.
(customize-set-variable 'multi-term-buffer-name "multi-term")
;; binds (C-x) prefix
(define-key ctl-x-map (kbd "<C-return>") 'multi-term)
(define-key ctl-x-map (kbd "x") 'multi-term-dedicated-toggle)))
(when (mtd/laptop-p)
(use-package vterm :ensure t))
(use-package eterm-256color
:ensure t
:hook (term-mode . eterm-256color-mode))
EmaX Window Manager [+.-]
;; (when (mtd/laptop-p)
;; ;; (use-package exwm :ensure t)
;; (require 'exwm)
;; (require 'exwm-config)
;; ;; (exwm-config-default)
;; )
(use-package bats-mode :ensure t)
;; find aspell and hunspell automatically
(cond
;; try hunspell at first
;; if hunspell does NOT exist, use aspell
((executable-find "hunspell")
(setq ispell-program-name "hunspell")
(setq ispell-local-dictionary "en_US")
(setq ispell-local-dictionary-alist
;; Please note the list `("-d" "en_US")` contains ACTUAL parameters passed to hunspell
;; You could use `("-d" "en_US,en_US-med")` to check with multiple dictionaries
'(("en_US" "[[:alpha:]]" "[^[:alpha:]]" "[']" nil ("-d" "en_US") nil utf-8))))
((executable-find "aspell")
(setq ispell-program-name "aspell")
;; Please note ispell-extra-args contains ACTUAL parameters passed to aspell
(setq ispell-extra-args '("--sug-mode=ultra" "--lang=en_US"))))
;; (use-package spell-fu)
;; (global-spell-fu-mode)
(setq org-startup-truncated nil)
- Q: How to install this?
- A: Don’t!
This is my personal .emacs.d and batteries may or may not be included, depending on what I’m up to at any given moment. If you’d like to experiment though the commands are as follows:
# pkill -TERM -u "${USER}" emacs # or exit emacs via any other appropriate means. # ~/.emacs.d should be moveable/erasable without # lock/save/temp stale artifacts, or git will complain. cd mv .emacs.d .emacs.d.bkp.$(date +%s) git clone https://github.com/michaeltd/.emacs.d emacs
Wait a bit and watch the message log scroll along while melpa and org work their magic and in a matter of seconds your install will be complete.
If exwm appears “moody” during install, fire up emacs once more, chances are it’s installed and working fine. If not, fire up a
M-x package-install R exwm R
or comment out exwm entirely.To use exwm you’ll need to uncomment the requires/exwm-config-default elisp statements and launch from your DM of choice a /usr/share/xsessions/exwm.desktop file similar to the following:
[Desktop Entry] Name=EmaX Window Manager Comment=A Window Manager for the Emacs OS TryExec=emacs --daemon -f exwm-enable Exec=/usr/bin/emacs --daemon -f exwm-enable Type=Application
Desktop selection shortcut is
s-w
and async shell command iss-&
. (s
as inSuper
orWin key
, notShift
) All other keyboard shortcuts you’ll need are the standard window/buffer emacs shortcuts.More on EmaX Window Manager at EXWM wiki
In no particular order:
- emacs-starter-kit
- a reasonable emacs config
- prelude
- Centaur Emacs
- sanemacs
- sasha chua dot emacs
- spacemacs
- doom-emacs
- Harry R. Schwartz
- quark-emacs
- awesome-emacs
Typos, syntactics and grammar welcomed, other than that, PR and we’ll take it from there… Or you could buy me some coffee in € or ₿ (bitcoin:19TznUEx2QZF6hQxL64bf3x15VWNy8Xitm).