.emacs.d
yet another .emacs.d
load path
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)
sanemacs
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 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 "~/.emacs.d/custom.el")
(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
'((".*" . "~/.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))
;; (load "~/.emacs.d/sanemacs.el" nil t)
;;; Your configuration goes below this line.
;;; use-package is already loaded and ready to go!
;;; use-package docs: https://github.com/jwiegley/use-package
all-the-icons
Required by emacs-dashboard
;; all the icons
(require 'all-the-icons)
(use-package all-the-icons :ensure t)
emacs-dashboard
An extensible emacs startup screen showing you what’s most important.
;; dashboard
(require 'dashboard)
(dashboard-setup-startup-hook)
;; Or if you use use-package
(use-package dashboard
:ensure t
:config
(dashboard-setup-startup-hook))
;; emacs --daemon
(setq initial-buffer-choice (lambda () (get-buffer "*dashboard*")))
;; Set the title
;; (setq dashboard-banner-logo-title "Welcome to Emacs Dashboard")
;; (setq dashboard-banner-logo-title "M-x butterfly")
(setq dashboard-banner-logo-title "Welcome to the church of Emacs")
;; Set the banner
;;(setq dashboard-startup-banner "~/.emacs.d/assets/gnu.png")
(setq dashboard-startup-banner 'logo)
;; 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
;; Content is not centered by default. To center, set
(setq dashboard-center-content t)
;; To disable shortcut "jump" indicators for each section, set
(setq dashboard-show-shortcuts nil)
;;To customize which widgets are displayed, you can use the following snippet
(setq dashboard-items '((recents . 4)))
;;To add icons to the widget headings and their items:
(setq dashboard-set-heading-icons t)
(setq dashboard-set-file-icons t)
;;To modify heading icons with another icon from all-the-icons octicons:
(dashboard-modify-heading-icons '((recents . "file-text")
(bookmarks . "book")))
;;To show navigator below the banner:
(setq dashboard-set-navigator t)
;;To customize the buttons of the navigator like this:
;; (setq dashboard-navigator-buttons
;; `(;; line1
;; ((,(all-the-icons-octicon "mark-github" :height 1.1 :v-adjust 0.0)
;; "Homepage"
;; "Browse homepage"
;; (lambda (&rest _) (browse-url "homepage")))
;; ("★" "Star" "Show stars" (lambda (&rest _) (show-stars)) warning)
;; ("?" "" "?/h" #'show-help nil "<" ">"))
;; ;; line 2
;; ((,(all-the-icons-faicon "linkedin" :height 1.1 :v-adjust 0.0)
;; "Linkedin"
;; ""
;; (lambda (&rest _) (browse-url "homepage")))
;; ("⚑" nil "Show flags" (lambda (&rest _) (message "flag")) error))))
;; Format: "(icon title help action face prefix suffix)"
(setq dashboard-navigator-buttons
`(;; line1
((,(all-the-icons-faicon "cloud" :height 1.1 :v-adjust 0.0) "Web" "Browse webpage"
(lambda (&rest _) (browse-url "https://michaeltd.netlify.com/")))
(,(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 "twitter" :height 1.1 :v-adjust 0.0) "Twitter" "Browse twitter"
(lambda (&rest _) (browse-url "https://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/"))))))
;;
;; To show info about the packages loaded and the init time:
(setq dashboard-set-init-info t)
;; Also, the message can be customized like this:
;; (setq dashboard-init-info "This is an init message!")
;; A randomly selected footnote will be displayed. To disable it:
;; (setq dashboard-set-footer nil)
;; To customize it and customize its icon;
;; (setq dashboard-footer "Dashboard is pretty cool!")
(setq dashboard-footer-icon (all-the-icons-octicon "dashboard"
:height 1.1
:v-adjust -0.05
:face 'font-lock-keyword-face))
;; Org mode’s agenda
;; To display today’s agenda items on the dashboard, add agenda to dashboard-items:
;;(add-to-list 'dashboard-items '(agenda) t)
;; To show agenda for the upcoming seven days set the variable show-week-agenda-p to t.
;; (setq show-week-agenda-p t)
;; Note that setting list-size for the agenda list is intentionally ignored; all agenda items for the current day will be displayed.
;; To customize which categories from the agenda items should be visible in the dashboard set the dashboard-org-agenda-categories to the list of categories you need.
;; (setq dashboard-org-agenda-categories '("Tasks" "Appointments"))
;; end dashboard
mode-line
;; 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)
doom-themes setup
(require 'doom-themes)
;; 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 the theme (doom-one, doom-molokai, etc); keep in mind that each
;; theme may have their own settings.
;; (load-theme 'doom-vibrant t)
;; Enable flashing mode-line on errors
(doom-themes-visual-bell-config)
;; Enable custom neotree theme
(doom-themes-neotree-config) ; all-the-icons fonts must be installed!
;; 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)
themes
(setq custom-safe-themes t)
(add-to-list 'custom-theme-load-path "~/.emacs.d/themes")
(load-theme 'doom-outrun-electric t)
;; (load-theme 'jazz t)
;; (load-theme 'tomorrow-night-paradise t)
;; (load-theme 'doom-lazersynth t)
;; (load-theme 'dracula t)
;; (load-theme 'doom-one t)
;; (add-hook 'after-init-hook (lambda () (load-theme 'xresources)))
;; (add-hook 'emacs-startup-hook(lambda () (load-theme 'xresources)))
default font
;; Globally Change the Default Font
;; To change the default font for new (non special-display) frames, put either of these in your init file:
;; (add-to-list 'default-frame-alist '(font . ))
;; (set-face-attribute 'default t :font "Ubuntu Mono Regular-10" )
;; To change the default font for the current frame, as well as future frames, put either of these in your init file:
;; (set-face-attribute 'default nil :font "DejaVuSansMono" )
;; (set-face-attribute 'default nil :font "DroidSansMonoDottedforPowerline" )
;; (set-face-attribute 'default nil :font "FantasqueSansMono" )
;; (set-face-attribute 'default nil :font "FiraMono" )
(set-face-attribute 'default nil :font "Hack" )
;; (set-face-attribute 'default nil :font "LiberationMonoforPowerline" )
;; (set-face-attribute 'default nil :font "LiberationMonoforPowerline" )
;; (set-face-attribute 'default nil :font "Monospace" )
;; (set-face-attribute 'default nil :font "SourceCodePro" )
;; (set-face-attribute 'default nil :font "SpaceMono" )
;; (set-face-attribute 'default nil :font "ShareTechMono" )
;; (set-frame-font FONT nil t)
;; where FONT is a string naming the font you want, for example, "Droid Sans Mono-10".
;; This should work on all platforms. As of Emacs 23, all of your system fonts including TrueType are available to Emacs.
;; If you are using a development snapshot for what will become Emacs 24.4 then see Emacs bug #16529.
;; (There needs to be an explanation for how to set fonts for particular modes or buffers here. Including a set-face-attribute hook as described above for a particular mode does not work; once you enter that mode the new font is set, but it is applied globally to all other open buffers!)
;; Global Fonts, .Xresources, and Emacs Daemon
;; I found that the only way to set fonts so that they remain consistent across emacs -nw, emacs23(-gtk), emacsclient -t, emacsclient -c, was to declare them in .Xresources and .emacs. But the declarations can’t conflict with each other. Otherwise, emacs --daemon complains. It doesn’t like (set-face-attribute ‘default nil :font FONT) and the like. For instance, to use Terminus, 9 pixel size across the board, I needed to insert
;; Emacs.font: Terminus-9
;; (set-default-font “Terminus-9”)
;; in my ~/.Xresources and ~/.emacs, respectively.org-babel
;; 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)))
ido-mode
;; (require 'ido)
;; (setq ido-enable-flex-matching t)
;; (setq ido-everywhere t)
;; (ido-mode t)
exwm
;; exwm :)
;; (require 'exwm)
;; (require 'exwm-config)
;; (exwm-config-default)
help me break the emacs loop
- Whichkey
- Ivy
- Swiper
- Hydra
- Dired-peep
- mini-modeline
- ibuffer

