#+title: init.el.org #+date: [2025-10-31 Fri] #+lastmod: [2025-11-01 Sat 00:03] #+hugo_auto_set_lastmod: t #+hugo_base_dir: ~/projects/blog.minded.net/ #+export_file_name: init.el.org.md #+hugo_section: pages/emacs/ #+hugo_draft: false #+hugo_tags: emacs * My Emacs configuration :PROPERTIES: :header-args: :tangle ~/.emacs.d/init.el :END: More about [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html][the Emacs initialization file]] ~~/.emacs.d/init.el~ is generated from this org file with [[https://orgmode.org/worg/org-contrib/babel/][Org-babel]] How to tangle: ~M-x org-babel-tangle~ or ~C-c C-v t~ My Emacs repository: [[https://git.minded.net/anne/emacs][git.minded.net/anne/emacs]] The source version of this file: [[https://git.minded.net/anne/emacs/src/branch/main/init.el.org?display=source][git.minded.net/anne/emacs/src/branch/main/init.el.org]] Or view this file on my blog: [[https://blog.minded.net/pages/emacs/init.el.org][blog.minded.net/pages/emacs/init.el.org]] ** About me #+begin_src elisp (setq user-full-name "Anne" user-mail-address "anne@minded.net") #+end_src ** Use-package [[https://github.com/jwiegley/use-package]] #+begin_src elisp (require 'package) (add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/")) (package-initialize) (unless (package-installed-p 'use-package) (package-refresh-contents) (package-install 'use-package)) (require 'use-package) (setq use-package-always-ensure 't) #+end_src ** Reload configuration ~M-x reload-emacs-init~ #+begin_src elisp (defun reload-emacs-init () (interactive) (load-file "~/.emacs.d/init.el") (message "Configuarion reloaded!")) #+end_src ** Customizations file [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Saving-Customizations.html]] You can choose to save customizations somewhere other than your initialization file. #+begin_src elisp (setq custom-file "~/.emacs.d/custom.el") (load custom-file 'noerror 'nomessage) #+end_src ** TRAMP https://www.gnu.org/software/emacs/manual/html_node/tramp/Auto_002dsave-File-Lock-and-Backup.html #+begin_src elisp (setq tramp-allow-unsafe-temporary-files t) #+end_src ** zone-mode #+begin_src elisp (add-to-list 'auto-mode-alist '("/etc/bind/zones/" . zone-mode)) #+end_src ** Lock files [[https://www.gnu.org/software/emacs/manual/html_node/elisp/File-Locks.html]] If create-lockfiles is nil, Emacs does not lock files. #+begin_src elisp :tangle no (setq create-lockfiles nil) #+end_src ** Yes-or-no prompts [[https://www.emacswiki.org/emacs/YesOrNoP]] #+begin_src elispx1 (defalias 'yes-or-no-p 'y-or-n-p) #+end_src ** Keeping buffers up-to-date [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Auto-Revert.html]] #+begin_src elisp (global-auto-revert-mode 1) (setq global-auto-revert-non-file-buffers t) #+end_src ** Disable startup screen [[https://www.gnu.org/software/emacs/manual/html_node/elisp/Startup-Summary.html]] #+begin_src elisp :tangle no (setq inhibit-startup-screen nil) #+end_src ** What to display [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Frames.html]] I do like the menu bar after all. #+begin_src elisp (tool-bar-mode -1) ;;(menu-bar-mode -1) (tooltip-mode -1) #+end_src ** Mode line column and line numbers [[https://www.gnu.org/software/emacs/manual/html_node/efaq/Displaying-the-current-line-or-column.html]] #+begin_src elisp (column-number-mode t) #+end_src ** Theme #+begin_src elisp (use-package ef-themes :ensure t :demand t :config (ef-themes-select 'ef-dream)) #+end_src #+begin_src elisp (custom-set-faces '(helm-buffer-directory ((t (:extend t :background "dim gray" :foreground "DarkRed")))) '(helm-ff-directory ((t (:extend t :background "dim gray" :foreground "DarkRed")))) '(org-agenda-date-today ((t (:inherit org-agenda-date :underline nil)))) '(menu ((t (:background "magenta"))))) #+end_src ** Mood-line [[https://gitlab.com/jessieh/mood-line]] A lightweight, drop-in replacement for the default Emacs mode line configuration. #+begin_src elisp (use-package mood-line :config (mood-line-mode) ;;(setq mood-line-format mood-line-format-default) (setq mood-line-format mood-line-format-default-extended) (setq mood-line-glyph-alist mood-line-glyphs-unicode)) #+end_src ** Suppress dialog boxes [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Dialog-Boxes.html]] #+begin_src elisp (setq use-dialog-box nil) #+end_src ** Sentences [[https://www.gnu.org/software/emacs/manual/html_node/efaq/Filling-paragraphs-with-a-single-space.html]] #+begin_src elisp (setq sentence-end-double-space nil) #+end_src ** Minibuffer [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Minibuffer-Edit.html]] #+begin_src elisp (setq resize-mini-windows t) (setq max-mini-window-height 0.5) #+end_src ** Word wrap [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Visual-Line-Mode.html]] #+begin_src elisp (add-hook 'text-mode-hook 'visual-line-mode) #+end_src ** Mouse support [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Mouse-Input.html]] #+begin_src elisp (xterm-mouse-mode 1) (mouse-wheel-mode 1) (context-menu-mode 1) #+end_src ** Kill-line [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Killing-by-Lines.html]] If non-nil, ~kill-line~ with no arg at start of line kills the whole line. #+begin_src elisp (setq kill-whole-line t) #+end_src ** Indentation [[https://www.gnu.org/software/emacs/manual/html_node/eintr/Indent-Tabs-Mode.html]] #+begin_src elisp (setq-default indent-tabs-mode nil) #+end_src ** Electric pair mode [[https://emacsdocs.org/docs/emacs/Matching]] #+begin_src elisp (electric-pair-mode 1) #+end_src ** Overwrite highlighted region [[https://www.gnu.org/software/emacs/manual/html_node/efaq/Replacing-highlighted-text.html]] #+begin_src elisp (delete-selection-mode t) #+end_src ** Scrolling [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Scrolling.html]] #+begin_src elisp (setq scroll-error-top-bottom t) #+end_src ** Cursor [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Cursor-Display.html]] #+begin_src elisp (global-hl-line-mode t) #+end_src ** Window handling [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Window-Convenience.html]] Winner mode is a global minor mode that records the changes in the window configuration (i.e., how the frames are partitioned into windows), so that you can undo them. #+begin_src elisp (winner-mode 1) #+end_src The Windmove package defines commands for moving directionally between neighboring windows in a frame. #+begin_src elisp (use-package windmove :bind ((" " . windmove-right) (" " . windmove-left) (" " . windmove-up) (" " . windmove-down))) #+end_src ** Crux [[https://github.com/bbatsov/crux]] A Collection of Ridiculously Useful eXtensions for Emacs. crux bundles many useful interactive commands to enhance your overall Emacs experience. #+begin_src elisp (use-package crux :bind ("C-a" . crux-move-beginning-of-line) ("C-c o" . crux-open-with) ("C-k" . crux-kill-whole-line) ("C-c f" . crux-cleanup-buffer-or-region) ("C-x C-a" . crux-sudo-edit) :config (crux-with-region-or-buffer indent-region) (crux-with-region-or-buffer untabify) (crux-with-region-or-line comment-or-uncomment-region)) #+end_src ** Dired [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Dired.html]] #+begin_src elisp (put 'dired-find-alternate-file 'disabled nil) (setq dired-listing-switches "-agho --group-directories-first") #+end_src ** Kill buffer #+begin_src elisp (global-set-key (kbd "C-x k") 'kill-current-buffer) #+end_src ** Unset C-z Unset C-z which is bound to `suspend-frame' by default. #+begin_src elisp (global-unset-key (kbd "C-z")) #+end_src ** Backups [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Backup.html]] Automatically backup buffers/files into the ~.emacs.d/backup/ directory. #+begin_src elisp (setq backup-directory-alist '(("." . "~/.emacs.d/backups"))) (setq backup-by-copying t ; Don't delink hardlinks version-control t ; Use version numbers on backups delete-old-versions t ; Automatically delete excess backups kept-new-versions 20 ; how many of the newest versions to keep kept-old-versions 5) ; and how many of the old #+end_src ** backup-walker https://github.com/lewang/backup-walker #+begin_src elisp (use-package backup-walker :bind ("C-c b" . backup-walker-start)) #+end_src ** Auto save [[https://www.gnu.org/software/emacs/manual/html_node/emacs/Auto-Save-Control.html]] #+begin_src elisp (setq auto-save-timeout 20 ; number of seconds idle time before auto-save (default: 30) auto-save-interval 200) ; number of keystrokes between auto-saves (default: 300) #+end_src ** Lastmod time stamp #+begin_src elisp (setq time-stamp-start "\\(^:last_modified: \\\\?[\[<]+\\|^:LASTMOD: \\\\?[\[<]+\\|^#\\+lastmod: \\\\?[\[<]+\\|^;; lastmod: \\\\?[\[<]+\\)") (setq time-stamp-end "\\\\?[\]>]") (setq time-stamp-format "%Y-%02m-%02d %3a %02H:%02M") (setq time-stamp-limit 12) (add-hook 'before-save-hook 'time-stamp) (setq time-stamp-active t) #+end_src ** Magit [[https://magit.vc/]] [[https://systemcrafters.net/mastering-git-with-magit/introduction/]] #+begin_src elisp (use-package magit :ensure t) #+end_src ** Which-key [[https://github.com/justbur/emacs-which-key]] which-key is a minor mode for Emacs that displays the key bindings following your currently entered incomplete command (a prefix) in a popup. #+begin_src elisp (use-package which-key :config (which-key-mode) (setq which-key-idle-delay 0.5 which-key-idle-secondary-delay 0.5) (which-key-setup-side-window-bottom)) #+end_src ** Helm [[https://emacs-helm.github.io/helm/]] Imagine a life without Helm... #+begin_src elisp (use-package helm :ensure t :config ;;(require 'helm-config) :init (helm-mode 1) (setq helm-split-window-inside-p t) :diminish helm-mode :bind (("M-x" . helm-M-x) ; Evaluate functions ("C-x C-f" . helm-find-files) ; Open or create files ("C-x b" . helm-mini) ; Select buffers ("C-x C-b" . helm-buffers-list) ("C-x C-r" . helm-recentf) ; Select recently saved files ("C-c i" . helm-imenu) ; Select document heading ("M-y" . helm-show-kill-ring) ; Show the kill ring ("C-x c g" . helm-do-grep-ag) :map helm-map ("C-z" . helm-select-action) ("" . helm-execute-persistent-action))) #+end_src ** Org-appear [[https://github.com/awth13/org-appear]] Make invisible parts of Org elements appear visible. #+begin_src elisp (use-package org-appear :load-path "~/.emacs.d/etc/elisp/org-appear" :hook (org-mode . org-appear-mode) :init (setq org-appear-autolinks t)) #+end_src Hide emphasis markers by default. #+begin_src elisp (setq org-hide-emphasis-markers t) #+end_src ** Org-roam https://github.com/org-roam/org-roam https://www.orgroam.com/ #+begin_src elisp (use-package org-roam :ensure t ;;:init ;;(setq org-roam-v2-ack t) :custom (org-roam-directory "~/org/notes") (org-roam-completion-everywhere t) (org-roam-capture-templates '(("d" "default" plain "%?" :target (file+head "%<%Y%m%d>-${slug}.org" ":PROPERTIES:\n:CREATED: %U\n:LASTMOD: []\n:END:\n#+title: ${title}\n\n\n") :unnarrowed t))) :config (org-roam-db-autosync-mode) (setq org-roam-node-display-template (concat "${title:*} " (propertize "${tags:42}" 'face 'org-tag))) :bind (("C-c n l" . org-roam-buffer-toggle) ("C-c n f" . org-roam-node-find) ("C-c n i" . org-roam-node-insert) ("C-c n c" . org-roam-capture) ("C-c n d" . org-id-get-create) ("C-c n t" . org-roam-tag-add) ("C-c n u" . org-roam-tag-remove) ("C-c n a" . org-roam-alias-add) ("C-c n b" . org-roam-alias-remove))) #+end_src