remove crafted emacs from config

This commit is contained in:
Peter Tillemans 2024-12-02 14:43:46 +01:00
parent 4a32ca2d37
commit 02e69fb344
2 changed files with 633 additions and 209 deletions

View file

@ -51,23 +51,6 @@
(elpaca elpaca-use-package
(elpaca-use-package-mode))
;; Wait for elpaca ;
(message "Waiting for elpaca")
;(elpaca-wait)
(setq crafted-emacs-home "~/.local/share/crafted-emacs")
(defun check-crafted-emacs-fresh-repo ()
"Check if the crafted-emacs repo is fresh."
(if (file-exists-p crafted-emacs-home)
(progn
(message "Crafted Emacs repo exists. Pulling...")
(shell-command (format "cd %s && git pull" crafted-emacs-home)))
(progn
(message "Crafted Emacs repo does not exist. Cloning...")
(shell-command (format "git clone https://github.com/SystemCrafters/crafted-emacs.git %s" crafted-emacs-home)))
))
;; tangling to generate scripts for the local bin directory. This
;; causes the name of the scripts to be returned in the car of the
;; tangle command which is used to load the file. The net result is
@ -80,23 +63,4 @@
(when (file-newer-than-file-p src tgt)
(message "tangling init.org")
(delete-file tgt)
(org-babel-tangle-file src tgt "emacs-lisp")
;; this is a good time to check if the crafted-emacs repo is fresh
;; - we just updated the init.org file so we expect changes.
;; - or this is the initial tangling and we need the repo to exist.
(message "checking crafted emacs repo...")
(check-crafted-emacs-fresh-repo)
))
;; Configure Crafted Emacs
(setq crafted-package-system 'elpaca)
(setq crafted-package-installer #'elpaca-try)
(setq crafted-package-installed-predicate #'elpaca-installed-p)
;; Startup Crafted Emacsa
(message "start crafted emacs")
(load (expand-file-name "modules/crafted-package-config" crafted-emacs-home))
(load (expand-file-name "modules/crafted-early-init-config" crafted-emacs-home))
(message "early-init done")
(org-babel-tangle-file src tgt "emacs-lisp")))

804
init.org
View file

@ -2,12 +2,9 @@
#+PROPERTY: header-args :tangle yes
#+PROPERTY: header-args:emacs-lisp :lexical yes :tangle yes :comments nil :padline yes
* Literate Configuration for Emacs
** Goals
- Manage *init.el* as an org-file
- Use a simple robust tangling solution which works together with
Crafted Emacs
- Leverage inclusion of ~use-package~ in Emacs29 for configuration and
loading
- Reduce dependencies : read evaluate the value a package brings
@ -38,6 +35,89 @@ one to use.
- [[https://github.com/jwiegley/dot-emacs/blob/master/init.org][John Wiegley's .emacs file]]
- [[https://github.com/TheBB/dotemacs/blob/master/init.el][Eivind Fonn's init.el]]
* Bootstrapping Emacs Configuration
#+BEGIN_SRC emacs-lisp :tangle "early-init.el"
;;; Bootstrap elpaca
(setq package-enable-at-startup nil)
;; for guix emacs-next packages you can find the date with
;; ➜ stat /gnu/store/*emacs-next-[23]*.drv | rg Birth | cut -d' ' -f3 | tr -d '-'
;; 20240727
;;
;; it is possible there are more so probably the most recent one is the one to use.
(setq elpaca-core-date "20241111")
(defvar elpaca-installer-version 0.8)
(defvar elpaca-directory (expand-file-name "elpaca/" user-emacs-directory))
(defvar elpaca-builds-directory (expand-file-name "builds/" elpaca-directory))
(defvar elpaca-repos-directory (expand-file-name "repos/" elpaca-directory))
(defvar elpaca-order '(elpaca :repo "https://github.com/progfolio/elpaca.git"
:ref nil :depth 1
:files (:defaults "elpaca-test.el" (:exclude "extensions"))
:build (:not elpaca--activate-package)))
(let* ((repo (expand-file-name "elpaca/" elpaca-repos-directory))
(build (expand-file-name "elpaca/" elpaca-builds-directory))
(order (cdr elpaca-order))
(default-directory repo))
(add-to-list 'load-path (if (file-exists-p build) build repo))
(unless (file-exists-p repo)
(make-directory repo t)
(when (< emacs-major-version 28) (require 'subr-x))
(condition-case-unless-debug err
(if-let* ((buffer (pop-to-buffer-same-window "*elpaca-bootstrap*"))
((zerop (apply #'call-process `("git" nil ,buffer t "clone"
,@(when-let* ((depth (plist-get order :depth)))
(list (format "--depth=%d" depth) "--no-single-branch"))
,(plist-get order :repo) ,repo))))
((zerop (call-process "git" nil buffer t "checkout"
(or (plist-get order :ref) "--"))))
(emacs (concat invocation-directory invocation-name))
((zerop (call-process emacs nil buffer nil "-Q" "-L" "." "--batch"
"--eval" "(byte-recompile-directory \".\" 0 'force)")))
((require 'elpaca))
((elpaca-generate-autoloads "elpaca" repo)))
(progn (message "%s" (buffer-string)) (kill-buffer buffer))
(error "%s" (with-current-buffer buffer (buffer-string))))
((error) (warn "%s" err) (delete-directory repo 'recursive))))
(unless (require 'elpaca-autoloads nil t)
(require 'elpaca)
(elpaca-generate-autoloads "elpaca" repo)
(load "./elpaca-autoloads")))
(add-hook 'after-init-hook #'elpaca-process-queues)
(elpaca `(,@elpaca-order))
;; Enable :elpaca use-package keyword.
(elpaca elpaca-use-package
(elpaca-use-package-mode))
#+END_SRC
Tangle the init file if it has been updated. I maintain the same
configuration on multiple machines and fetch changes with a ~git pull~
outside emacs so there is on opportunity to tangle the new file. If
I see it is outdated I tangle it.
#+BEGIN_SRC emacs-lisp :tangle "early-init.el"
;; tangling to generate scripts for the local bin directory. This
;; causes the name of the scripts to be returned in the car of the
;; tangle command which is used to load the file. The net result is
;; that not the initialization is loaded, but the first exported
;; script.
(use-package ob-tangle)
(let ((src (concat user-emacs-directory "init.org"))
(tgt (concat user-emacs-directory "init.el"))
(enable-local-variables nil)) ;; disable local variables to prevent asking confirmation before frame is available
(when (file-newer-than-file-p src tgt)
(message "tangling init.org")
(delete-file tgt)
(org-babel-tangle-file src tgt "emacs-lisp")))
#+END_SRC
* First Things First
** Make tangled file read-only
@ -114,15 +194,17 @@ then load it.
Needs to load early so the ~:general~ keyword is available for ~use-package~.
#+BEGIN_SRC emacs-lisp
(use-package general
:ensure t
:demand t)
(use-package general :ensure t :demand t)
#+END_SRC
#+RESULTS:
*** Enable Undo Tree
undo-tree is my preferred way of undoing and redoing stuff. The main reason is it doesnt create a linear undo/redo history, but rather a complete tree you can navigate to see your complete editing history. One of the two obvious things to do are to tell Emacs to save all its undo history fies in a dedicated directory, otherwise wed risk littering all of our directories. The second thing is to simply globally enable its mode.
#+BEGIN_SRC emacs-lisp
(use-package undo-tree
:defer t
:straight (:build t)
@ -133,8 +215,6 @@ undo-tree is my preferred way of undoing and redoing stuff. The main reason is i
:init
(global-undo-tree-mode)
:config
<<undo-tree-ignore-text-properties>>
<<undo-tree-compress-files>>
(setq undo-tree-visualizer-diff t
undo-tree-auto-save-history t
undo-tree-enable-undo-in-region t
@ -142,7 +222,21 @@ undo-tree is my preferred way of undoing and redoing stuff. The main reason is i
undo-strong-limit (* 12 1024 1024)
undo-outer-limit (* 128 1024 1024)))
#+END_SRC
#+RESULTS:
: [nil 26444 18481 193426 nil elpaca-process-queues nil nil 879000 nil]
*** Wait for initial installations
#+BEGIN_SRC emacs-lisp
(elpaca-wait)
#+END_SRC
** Utility Functions
@ -192,59 +286,6 @@ metadata and get the version number from the JSON.
#+RESULTS:
: v1.2024.6
* Crafted Emacs
#+BEGIN_SRC emacs-lisp
(report-time-since-load "Crafted Emacs")
#+END_SRC
When I could not solve the persistent slowness I experienced on
Windows using Doom Emacs, I wanted to switch to a more hands-on
minimal Emacs configuration. I just watched the 'Rational Emacs'
episode and that seemed as good a starting point as any. Then in
August '22 it was renamed to Crafted Emacs which prompted a
(minor) refactoring.
I used for a quite a long term Doom on Linux and Rational/Crafted on
Windows till I was comfortable enough and not started Doom anymore.
** Initialize Crafted Emacs
Loads the Crafted Emacs initialization configuration:
#+BEGIN_SRC emacs-lisp
;; initialize crafted-emacs
(setq crafted-startup-inhibit-splash t)
(load "~/.local/share/crafted-emacs/modules/crafted-init-config")
#+END_SRC
** Add and configure packages and load crafted and custom modules
Lists and installs a variety of packages and includes custom configurations for them:
#+BEGIN_SRC emacs-lisp
(require 'crafted-completion-packages)
(require 'crafted-evil-packages)
(require 'crafted-lisp-packages)
(require 'crafted-writing-packages)
(require 'crafted-ui-packages)
(report-time-since-load "loading packages")
(crafted-package-install-selected-packages)
(elpaca-wait)
(require 'crafted-defaults-config)
(require 'crafted-evil-config)
(require 'crafted-completion-config)
(require 'crafted-org-config)
(require 'crafted-lisp-config)
(require 'crafted-writing-config)
(require 'crafted-ui-config):
#+END_SRC
#+RESULTS:
: pti-org-config
* Integration with Environment
#+BEGIN_SRC emacs-lisp
@ -410,6 +451,19 @@ It provides a minor-mode
: [nil 26383 36877 803383 nil elpaca-process-queues nil nil 768000 nil]
** Collect visible URLs to open in browser
#+BEGIN_SRC emacs-lisp
(use-package fancy-ffap-menu
:ensure (:host "codeberg.org" :repo "kakafarm/emacs-fancy-ffap-menu"
:main "fancy-ffap-menu.el")
:commands (fancy-ffap-menu-list-urls)
)
#+END_SRC
#+RESULTS:
: [nil 26432 21940 582674 nil elpaca-process-queues nil nil 547000 nil]
* Editor Features
#+BEGIN_SRC emacs-lisp
@ -417,48 +471,297 @@ It provides a minor-mode
#+END_SRC
** Emacs configuration
#+BEGIN_SRC emacs-lisp
;; A few more useful configurations...
(use-package emacs
:custom
;; Support opening new minibuffers from inside existing minibuffers.
(enable-recursive-minibuffers t)
;; Hide commands in M-x which do not work in the current mode. Vertico
;; commands are hidden in normal buffers. This setting is useful beyond
;; Vertico.
(read-extended-command-predicate #'command-completion-default-include-p)
:init
;; Add prompt indicator to `completing-read-multiple'.
;; We display [CRM<separator>], e.g., [CRM,] if the separator is a comma.
(defun crm-indicator (args)
(cons (format "[CRM%s] %s"
(replace-regexp-in-string
"\\`\\[.*?]\\*\\|\\[.*?]\\*\\'" ""
crm-separator)
(car args))
(cdr args)))
(advice-add #'completing-read-multiple :filter-args #'crm-indicator)
;; Do not allow the cursor in the minibuffer prompt
(setq minibuffer-prompt-properties
'(read-only t cursor-intangible t face minibuffer-prompt))
(add-hook 'minibuffer-setup-hook #'cursor-intangible-mode))
#+END_SRC
** Enable undo-tree
see [[https://elpa.gnu.org/packages/undo-tree.html][undo-tree web page]]. There is a lot of background info there to
explain the problems and solutions.
Emacs actually maintains undo/redo information is an way that any
state can be restored. Both undo and redo is remembered in contrast to
many apps which essentially reset after doing a redo operation. It is
very hard to keep track of the state using the
normal undo/redo machinery to restore a specific state by tracking the
branching naturranching nature.
The *undo-tree* package solves this by redefining the undo/redo bindings
and offering a visualization of the undo/redo state and allow
navigation with real-time updates of the state in the original buffer.
When undo-tree-mode is active the following bindings are available:
- C-_ : undo
- M-_: redo
- C-/ : undo
- C-? : redo
- C-x u : undo-tree-vizualizer
- C-x r u : store undo-tree state in the given register
- C-x r U : restore undo-tree state from the given register
#+BEGIN_SRC emacs-lisp
(use-package undo-tree
:ensure t
:init
(global-undo-tree-mode))
#+END_SRC
#+RESULTS:
: [nil 26433 42993 909143 nil elpaca-process-queues nil nil 187000 nil]
In the visualizer you can navigate the undo/redo state with:
- p : navigate to the previous node in the graph
- n : navigate to the next node in the graph
- q : quit window
- C-q : abort undo tree visualizer
- C-b : switch branch left
- C-f : switch branch right
- M-{ or C-<up> : undo to X where X is a stored register or a branch point
- M-} or C-<down> : redo to X where X is a stored register or a branch point
** Save history over sessions
Persist history over Emacs restarts. Vertico sorts by history
position.
#+BEGIN_SRC emacs-lisp
(use-package savehist
:init
(savehist-mode))
#+END_SRC
** Completion Configuration
*** Use Vertico for better selection lists
Vertico is a big package by minad. Well documented in the [[https://github.com/minad/vertico][vertico
github repo]].
#+BEGIN_SRC emacs-lisp
;; Enable vertico
(use-package vertico
:ensure t
:custom
(vertico-scroll-margin 0) ;; Different scroll margin
(vertico-count 12) ;; Show more candidates
(vertico-resize t) ;; Grow and shrink the Vertico minibuffer
(vertico-cycle t) ;; Enable cycling for `vertico-next/previous'
:init
(vertico-mode))
#+END_SRC
*** Orderless for better narrowing
#+BEGIN_SRC emacs-lisp
(use-package orderless
:ensure t
:custom
;; Configure a custom style dispatcher (see the Consult wiki)
;; (orderless-style-dispatchers '(+orderless-consult-dispatch orderless-affix-dispatch))
;; (orderless-component-separator #'orderless-escapable-split-on-space)
(completion-styles '(orderless basic))
;;(completion-category-defaults nil)
(completion-category-overrides '((file (styles partial-completion)))))
#+END_SRC
*** Marginalia for better context awareness
#+BEGIN_SRC emacs-lisp
;; Enable rich annotations using the Marginalia package
(use-package marginalia
:ensure t
;; Bind `marginalia-cycle' locally in the minibuffer. To make the binding
;; available in the *Completions* buffer, add it to the
;; `completion-list-mode-map'.
:bind (:map minibuffer-local-map ("M-A" . marginalia-cycle))
:init
(marginalia-mode))
#+END_SRC
#+RESULTS:
: marginalia-cycle
*** Add consult
See the excellent documentation on [[https://github.com/minad/consult][Minad's consult repo]].
#+BEGIN_SRC emacs-lisp
;; Example configuration for Consult
(use-package consult
:ensure t
;; Replace bindings. Lazily loaded by `use-package'.
:bind (;; C-c bindings in `mode-specific-map'
("C-c M-x" . consult-mode-command)
("C-c h" . consult-history)
("C-c k" . consult-kmacro)
("C-c m" . consult-man)
("C-c i" . consult-info)
([remap Info-search] . consult-info)
;; C-x bindings in `ctl-x-map'
("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command
("C-x b" . consult-buffer) ;; orig. switch-to-buffer
("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window
("C-x 5 b" . consult-buffer-other-frame) ;; orig. switch-to-buffer-other-frame
("C-x t b" . consult-buffer-other-tab) ;; orig. switch-to-buffer-other-tab
("C-x r b" . consult-bookmark) ;; orig. bookmark-jump
("C-x p b" . consult-project-buffer) ;; orig. project-switch-to-buffer
;; Custom M-# bindings for fast register access
("M-#" . consult-register-load)
("M-'" . consult-register-store) ;; orig. abbrev-prefix-mark (unrelated)
("C-M-#" . consult-register)
;; Other custom bindings
("M-y" . consult-yank-pop) ;; orig. yank-pop
;; M-g bindings in `goto-map'
("M-g e" . consult-compile-error)
("M-g f" . consult-flymake) ;; Alternative: consult-flycheck
("M-g g" . consult-goto-line) ;; orig. goto-line
("M-g M-g" . consult-goto-line) ;; orig. goto-line
("M-g o" . consult-outline) ;; Alternative: consult-org-heading
("M-g m" . consult-mark)
("M-g k" . consult-global-mark)
("M-g i" . consult-imenu)
("M-g I" . consult-imenu-multi)
;; M-s bindings in `search-map'
("M-s d" . consult-find) ;; Alternative: consult-fd
("M-s c" . consult-locate)
("M-s g" . consult-grep)
("M-s G" . consult-git-grep)
("M-s r" . consult-ripgrep)
("M-s l" . consult-line)
("M-s L" . consult-line-multi)
("M-s k" . consult-keep-lines)
("M-s u" . consult-focus-lines)
;; Isearch integration
("M-s e" . consult-isearch-history)
:map isearch-mode-map
("M-e" . consult-isearch-history) ;; orig. isearch-edit-string
("M-s e" . consult-isearch-history) ;; orig. isearch-edit-string
("M-s l" . consult-line) ;; needed by consult-line to detect isearch
("M-s L" . consult-line-multi) ;; needed by consult-line to detect isearch
;; Minibuffer history
:map minibuffer-local-map
("M-s" . consult-history) ;; orig. next-matching-history-element
("M-r" . consult-history)) ;; orig. previous-matching-history-element
;; Enable automatic preview at point in the *Completions* buffer. This is
;; relevant when you use the default completion UI.
:hook (completion-list-mode . consult-preview-at-point-mode)
;; The :init configuration is always executed (Not lazy)
:init
;; Optionally configure the register formatting. This improves the register
;; preview for `consult-register', `consult-register-load',
;; `consult-register-store' and the Emacs built-ins.
(setq register-preview-delay 0.5
register-preview-function #'consult-register-format)
;; Optionally tweak the register preview window.
;; This adds thin lines, sorting and hides the mode line of the window.
(advice-add #'register-preview :override #'consult-register-window)
;; Use Consult to select xref locations with preview
(setq xref-show-xrefs-function #'consult-xref
xref-show-definitions-function #'consult-xref)
;; Configure other variables and modes in the :config section,
;; after lazily loading the package.
:config
;; Optionally configure preview. The default value
;; is 'any, such that any key triggers the preview.
;; (setq consult-preview-key 'any)
;; (setq consult-preview-key "M-.")
;; (setq consult-preview-key '("S-<down>" "S-<up>"))
;; For some commands and buffer sources it is useful to configure the
;; :preview-key on a per-command basis using the `consult-customize' macro.
(consult-customize
consult-theme :preview-key '(:debounce 0.2 any)
consult-ripgrep consult-git-grep consult-grep
consult-bookmark consult-recent-file consult-xref
consult--source-bookmark consult--source-file-register
consult--source-recent-file consult--source-project-recent-file
;; :preview-key "M-."
:preview-key '(:debounce 0.4 any))
;; Optionally configure the narrowing key.
;; Both < and C-+ work reasonably well.
(setq consult-narrow-key "<") ;; "C-+"
;; Optionally make narrowing help available in the minibuffer.
;; You may want to use `embark-prefix-help-command' or which-key instead.
;; (keymap-set consult-narrow-map (concat consult-narrow-key " ?") #'consult-narrow-help)
)
#+END_SRC
#+RESULTS:
: [nil 26434 3705 536018 nil elpaca-process-queues nil nil 266000 nil]
** Evil Vim Keybindings
I configure all my apps to use vim keybindings if possible to maximise
muscle memory.
#+BEGIN_SRC emacs-lisp
;; some provided automations
(crafted-evil-discourage-arrow-keys)
(crafted-evil-vim-muscle-memory)
#+END_SRC
;; load evil
(use-package evil
:ensure t ;; install the evil package if not installed
:init ;; tweak evil's configuration before loading it
(setq evil-search-module 'evil-search)
(setq evil-ex-complete-emacs-commands nil)
(setq evil-vsplit-window-right t)
(setq evil-split-window-below t)
(setq evil-shift-round nil)
(setq evil-want-C-u-scroll nil)
:config
(evil-mode)
;; set leader keys
(evil-set-leader nil (kbd "C-SPC"))
(evil-set-leader 'normal (kbd "SPC"))
(evil-set-leader 'normal "," t) ;; set localleader
#+BEGIN_SRC emacs-lisp
;; set leader keys
(evil-set-leader nil (kbd "C-SPC"))
(evil-set-leader 'normal (kbd "SPC"))
(evil-set-leader 'normal "," t) ;; set localleader
#+END_SRC
#+BEGIN_SRC emacs-lisp
;; make vc commands available via leader key
(evil-define-key 'normal 'global
(kbd "<leader>v") vc-prefix-map)
(keymap-global-set "C-c v" vc-prefix-map)
#+END_SRC
#+RESULTS
#+BEGIN_SRC emacs-lisp
;; make vc commands available via leader key
(evil-define-key 'normal 'global
(kbd "<leader>v") vc-prefix-map)
(keymap-global-set "C-c v" vc-prefix-map)
;; make project commands available via leader key
(evil-define-key 'normal 'global
(kbd "<leader>p") project-prefix-map)
(keymap-global-set "C-c p" project-prefix-map)
#+END_SRC
#+RESULTS:
: (keymap (2 . project-list-buffers) (111 . project-any-command) (120 . project-execute-extended-command) (114 . project-query-replace-regexp) (71 . project-or-external-find-regexp) (103 . project-find-regexp) (112 . project-switch-project) (107 . project-kill-buffers) (101 . project-eshell) (99 . project-compile) (118 . magit-status) (68 . project-dired) (100 . project-find-dir) (115 . project-shell) (98 . project-switch-to-buffer) (70 . project-or-external-find-file) (102 . project-find-file) (38 . project-async-shell-command) (33 . project-shell-command))
#+RESULTS
#+BEGIN_SRC emacs-lisp
(evil-define-key 'normal 'global
(kbd "<leader>ff") #'find-file
(kbd "<leader>fo") #'recentf
@ -468,14 +771,24 @@ muscle memory.
(keymap-global-set "C-c f o" #'recentf)
(keymap-global-set "C-c f r" #'revert-buffer)
(keymap-global-set "C-c f d" #'diff-buffer-with-file)
)
#+END_SRC
#+BEGIN_SRC emacs-lisp
;; dired integration
(evil-collection-dired-setup)
#+END_SRC
** Load Evil Collection for comprehensive evil support
#+BEGIN_SRC emacs-lisp
(use-package evil-collection
:ensure t
:after evil
:init
(evil-collection-init))
#+END_SRC
** Harpoon configuration
#+BEGIN_SRC emacs-lisp :tangle no
(use-package harpoon
:ensure t
:init
@ -497,16 +810,9 @@ muscle memory.
#+RESULTS:
: [nil 26284 54919 318035 nil elpaca-process-queues nil nil 339000 nil]
** User Interface
*** Do not show default splash screen
#+BEGIN_SRC emacs-lisp
;; Show splash screen
(unless crafted-startup-inhibit-splash
(setq initial-buffer-choice #'crafted-startup-screen))
#+END_SRC
****
*** Display startup time
#+BEGIN_SRC emacs-lisp
;; Profile emacs startup
(add-hook 'emacs-startup-hook
@ -764,9 +1070,13 @@ Enables an alternative file navigation behavior in Dired, Emacs' directory edito
: t
** Replace normal Buffer Support with IBuffer
Configure ibuffer support with project contexts, courtesy of crafted
emacs
#+BEGIN_SRC emacs-lisp
;;; enhance ibuffer with ibuffer-project if it is available.
(defun crafted-ide-enhance-ibuffer-with-ibuffer-project ()
(defun snm-ide-enhance-ibuffer-with-ibuffer-project ()
"Set up integration for `ibuffer' with `ibuffer-project'."
(setq ibuffer-filter-groups (ibuffer-project-generate-filter-groups))
(unless (eq ibuffer-sorting-mode 'project-file-relative)
@ -775,7 +1085,7 @@ Enables an alternative file navigation behavior in Dired, Emacs' directory edito
(use-package ibuffer-project
:ensure t
:hook
(ibuffer-mode . crafted-ide-enhance-ibuffer-with-ibuffer-project)
(ibuffer-mode . snm-ide-enhance-ibuffer-with-ibuffer-project)
:bind (("C-x C-b" . #'ibuffer)))
#+END_SRC
** Enable EditorConfig Standard Support
@ -810,8 +1120,6 @@ This enables direnv globally.
** Configure Embark
Currently already loaded by crafted emacs
#+BEGIN_SRC emacs-lisp :tangle no
(use-package embark
:ensure t
@ -827,6 +1135,40 @@ Currently already loaded by crafted emacs
#+RESULTS:
: [nil 26384 64829 513923 nil elpaca-process-queues nil nil 691000 nil]
** Configure Helpful
#+BEGIN_SRC emacs-lisp
(use-package helpful
:ensure t
:bind (
( "<remap> <describe-command>" . #'helpful-command)
( "<remap> <describe-function>" . #'helpful-callable)
( "<remap> <describe-key>" . #'helpful-key)
( "<remap> <describe-symbol>" . #'helpful-symbol)
( "<remap> <describe-variable>" . #'helpful-variable)
( "C-h F" . #'helpful-function)))
#+END_SRC
#+RESULTS:
: [nil 26432 30485 62583 nil elpaca-process-queues nil nil 114000 nil]
** Enable breadcrumbs
Show breadcrumbs in the header line to keep context of the file being
worked on. See the [[https://github.com/joaotavora/breadcrumb][breadcrumb repo]] for more details.
#+BEGIN_SRC emacs-lisp
(use-package breadcrumb
:ensure t
:init
(breadcrumb-mode))
#+END_SRC
#+RESULTS:
: [nil 26432 31533 350342 nil elpaca-process-queues nil nil 899000 nil]
* Writing and Planning
#+BEGIN_SRC emacs-lisp
@ -860,39 +1202,62 @@ Currently already loaded by crafted emacs
: [nil 26279 36119 854408 nil elpaca-process-queues nil nil 376000 nil]
*** Org Configuration
#+BEGIN_SRC emacs-lisp
(use-package org
:ensure nil
:custom
(org-agenda-skip-scheduled-if-done t)
(org-agenda-skip-deadline-if-done t)
(org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "WAITING(w)" "SOMEDAY(s)" "PROJ(p)"
"|" "DONE(d)" "CANCELED(c)")))
(org-todo-keywords-for-agenda '((sequence "NEXT(n)" "TODO(t)" "WAITING(w)" "SOMEDAY(s)" "PROJ(p)" "|" "DONE(d)" "CANCELED(c)")))
(line-spacing 0.1)
(left-margin-width 2)
(right-margin-width 2)
(org-hide-emphasis-markers t)
(org-agenda-files (list "~/Nextcloud/org/" "~/org/snamellit/" "~/org/customer/" "~/org/personal/"))
(org-refile-targets '(
(org-agenda-files . (:level . 1))
("~/org/personal/bijen.org" . (:level . 1))
("~/org/personal/fitness.org" . (:level . 1))
))
:config
;; set files for agenda views
(setq +org-capture-todo-file "~/Nextcloud/org/inbox.org"
+org-capture-notes-file "~/Nextcloud/org/inbox.org"
+org-capture-journal-file "~/Nextcloud/org/journal.org"
+org-capture-projects-file "~/Nextcloud/org/projects.org")
:hook
(org-mode . pti-org-mode-config)
:bind (
("<leader> o a" . org-agenda)
("<leader> o s" . org-store-link)
))
(use-package org
:ensure nil
:custom
(org-return-follows-link t)
(org-mouse-1-follows-link t)
(org-link-descriptive t)
(org-agenda-skip-scheduled-if-done t)
(org-agenda-skip-deadline-if-done t)
(org-hide-emphasis-markers t)
(line-spacing 0.1)
(left-margin-width 2)
(right-margin-width 2)
(org-todo-keywords '((sequence "TODO(t)" "NEXT(n)" "WAITING(w)" "SOMEDAY(s)" "PROJ(p)"
"|" "DONE(d)" "CANCELED(c)")))
(org-todo-keywords-for-agenda '((sequence "NEXT(n)" "TODO(t)" "WAITING(w)" "SOMEDAY(s)" "PROJ(p)" "|" "DONE(d)" "CANCELED(c)")))
(org-agenda-files (list "~/Nextcloud/org/" "~/org/snamellit/" "~/org/customer/" "~/org/personal/"))
(org-refile-targets '(
(org-agenda-files . (:level . 1))
("~/org/personal/bijen.org" . (:level . 1))
("~/org/personal/fitness.org" . (:level . 1))
))
:config
;; set files for agenda views
(setq +org-capture-todo-file "~/Nextcloud/org/inbox.org"
+org-capture-notes-file "~/Nextcloud/org/inbox.org"
+org-capture-journal-file "~/Nextcloud/org/journal.org"
+org-capture-projects-file "~/Nextcloud/org/projects.org")
:hook (
(org-mode . pti-org-mode-config)
(org-mode . org-indent-mode)
)
:bind (
("<leader> o a" . org-agenda)
("<leader> o s" . org-store-link)
))
#+END_SRC
#+RESULTS:
*** Org Appear
Hide the org markers when point is not on the element being decorated.
#+BEGIN_SRC emacs-lisp
(use-package org-appear
:ensure t
:hook (org-mode . org-appear-mode))
#+END_SRC
#+RESULTS:
: [nil 26432 31427 677147 nil elpaca-process-queues nil nil 738000 nil]
*** Org Babel Support
@ -1153,7 +1518,6 @@ gicrisf has [[https://github.com/gicrisf/ox-zola][created a package]] to export
#+BEGIN_SRC emacs-lisp
(use-package ox-hugo
:ensure t
:pin melpa
:after ox)
(use-package ox-zola
:ensure (ox-zola :host github :repo "gicrisf/ox-zola" :files (:defaults "*.el" "backend" "stylesheets"))
@ -1601,8 +1965,7 @@ We can add a list of queries
(rust-ts-mode . eglot-ensure)
(java-ts-mode . eglot-ensure)
(python-ts-mode . eglot-ensure)
(zig-mode . eglot-ensure)
)
(zig-mode . eglot-ensure))
#+END_SRC
@ -1610,10 +1973,11 @@ We can add a list of queries
#+BEGIN_SRC emacs-lisp
(defun pti-flymake-evil-keybindings ()
"Map flymake error navigation to easier key sequences."
(evil-define-key 'normal flymake-mode-map
(kbd "]d") #'flymake-goto-next-error
(kbd "[d") #'flymake-goto-prev-error))
(add-hook 'flymake-mode-hook #'pti-flymake-evil-keybindings)
#+END_SRC
@ -1850,30 +2214,38 @@ see also [[https://www.masteringemacs.org/article/how-to-get-started-tree-sitter
#+END_SRC
*** Lisp and Scheme Support
**** Aggressive Indent for lisp modes
#+BEGIN_SRC emacs-lisp
(use-package aggressive-indent
:ensure t
:hook ((lisp-mode-hook scheme-mode-hook clojure-mode-hook)))
#+END_SRC
**** Enable ParEdit in lispy modes
#+BEGIN_SRC emacs-lisp
;; Lisp support
(use-package package-lint-flymake) ;; needed before activating lisp-interaction-mode-hook
(use-package paredit
:ensure nil
:after package-lint-flymake
:commands (enable-paredit-mode)
:init
(dolist (mode '(emacs-lisp-mode-hook
lisp-interaction-mode-hook
lisp-mode-hook
scheme-mode-hook))
(add-hook mode #'enable-paredit-mode)))
(use-package evil-paredit
:ensure t
:commands (evil-paredit-mode)
:init
;; Lisp support
(use-package package-lint-flymake
:ensure t) ;; needed before activating lisp-interaction-mode-hook
(use-package paredit
:ensure nil
:after package-lint-flymake
:commands (enable-paredit-mode)
:init
(dolist (mode '(emacs-lisp-mode-hook
lisp-interaction-mode-hook
lisp-mode-hook
scheme-mode-hook))
(add-hook mode #'evil-paredit-mode)))
lisp-interaction-mode-hook
lisp-mode-hook
scheme-mode-hook))
(add-hook mode #'enable-paredit-mode)))
(use-package evil-paredit
:ensure t
:commands (evil-paredit-mode)
:init
(dolist (mode '(emacs-lisp-mode-hook
lisp-interaction-mode-hook
lisp-mode-hook
scheme-mode-hook))
(add-hook mode #'evil-paredit-mode)))
#+END_SRC
@ -1907,6 +2279,31 @@ no arguments. In Emacs 23.2 and newer, it takes one argument."
#+RESULTS:
: [nil 26418 38138 672360 nil elpaca-process-queues nil nil 82000 nil]
**** Configure Sly for Common Lisp
#+BEGIN_SRC emacs-lisp
(use-package sly
:ensure t
:config
(require 'sly-autoloads)
:hook (lisp-mode-hook . #'sly-editing-mode))
(use-package sly-quicklisp
:ensure t
:after sly)
(use-package sly-repl-ansi-color
:ensure t
:after sly)
(use-package sly-asdf
:ensure t
:after sly)
#+END_SRC
#+RESULTS:
: [nil 26432 28005 611924 nil elpaca-process-queues nil nil 196000 nil]
**** Enable Geiser Mode in Scheme Mode
@ -1931,6 +2328,53 @@ Configure Geiser and Scheme
#+RESULTS:
| evil-paredit-mode | geiser-mode | enable-paredit-mode | aggressive-indent-mode | geiser-mode--maybe-activate |
**** Enable Cider for Clojure mode
#+BEGIN_SRC emacs-lisp
(use-package clojure-mode
:ensure t
:mode (("\\.clj\\'" . clojure-mode)
("\\.edn\\'" . clojure-mode))
:init
(add-hook 'clojure-mode-hook #'yas-minor-mode)
(add-hook 'clojure-mode-hook #'linum-mode)
(add-hook 'clojure-mode-hook #'subword-mode)
(add-hook 'clojure-mode-hook #'smartparens-mode)
(add-hook 'clojure-mode-hook #'rainbow-delimiters-mode)
(add-hook 'clojure-mode-hook #'eldoc-mode)
(add-hook 'clojure-mode-hook #'idle-highlight-mode))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(use-package cider
:ensure t
:defer t
:init (add-hook 'cider-mode-hook #'clj-refactor-mode)
:diminish subword-mode
:config
(setq nrepl-log-messages t
cider-repl-display-in-current-window t
cider-repl-use-clojure-font-lock t
cider-prompt-save-file-on-load 'always-save
cider-font-lock-dynamically '(macro core function var)
nrepl-hide-special-buffers t
cider-overlays-use-font-lock t)
(cider-repl-toggle-pretty-printing))
#+END_SRC
#+BEGIN_SRC emacs-lisp
(use-package clj-refactor
:defer t
:ensure t
:diminish clj-refactor-mode
:config (cljr-add-keybindings-with-prefix "C-c C-m"))
#+END_SRC
**** Allow saving of an SBCL images
When trying to call `(save-lisp-and-die #p"somefile")` , sbcl will
@ -2180,7 +2624,7 @@ the moment.
(report-time-since-load "Communication and Interwebs")
#+END_SRC
** ERC configuration
** ERC configuration :disabled:
Set up ERC, an IRC client for Emacs, to automatically join specific channels and log in:
#+BEGIN_SRC emacs-lisp :tangle no
(use-package erc
@ -2244,8 +2688,7 @@ fail. I dunno, there is something fishy here...
*** Integrate ERC with i3 Desktops
I like to have my IRC channels on workspace 5 in *i3*.
This is no longer useful : I seldom use i3, but it is useful for
o longer useful : I seldom use i3, but it is useful for
inspiration
#+BEGIN_SRC emacs-lisp :tangle no
@ -2275,19 +2718,36 @@ inspiration
(use-package rcirc
:config
(setopt rcirc-server-alist
(setopt
rcirc-server-alist
(let ((data (auth-source-pass-parse-entry "snamellit/znc")))
`((,(auth-source-pass--get-attr "server" data)
:port ,(auth-source-pass--get-attr "port" data)
:encryption tls
:server-alias "znc"
:nick ,(auth-source-pass--get-attr "nick" data)
:user-name ,(concat (auth-source-pass--get-attr "user" data) "@" (system-name))
:user-name ,(concat
(auth-source-pass--get-attr "user" data)
"@"
(system-name))
:password ,(auth-source-pass--get-attr 'secret data)
:channels '("#emacs" "#erc" "#spritely" "#guix" "#systemcrafters" "#systemcrafters-guix" "#systemcrafters-emacs")))))
:channels '("#emacs"
"#erc"
"#spritely"
"#guix"
"#systemcrafters"
"#systemcrafters-guix"
"#systemcrafters-emacs"
)))))
(setopt rcirc-reconnect-delay 15)
(setopt rcirc-dim-nicks '("Marvin2"))
(setopt rcirc-bright-nicks '("daviwil" "benoitj" "Fade" "trev" "shom" "alternateved" "dthompson"))
(setopt rcirc-bright-nicks '("daviwil"
"benoitj"
"Fade"
"trev"
"shom"
"alternateved"
"dthompson"))
(rcirc-track-minor-mode))
#+END_SRC