Forgot to tangle last change
This commit is contained in:
parent
ea83dccc15
commit
5806f9d003
|
@ -13,7 +13,6 @@
|
||||||
with epkgs; [
|
with epkgs; [
|
||||||
# themes
|
# themes
|
||||||
modus-themes
|
modus-themes
|
||||||
doom-themes
|
|
||||||
tron-legacy-theme
|
tron-legacy-theme
|
||||||
|
|
||||||
# completion-packages
|
# completion-packages
|
||||||
|
|
|
@ -74,6 +74,13 @@
|
||||||
;; Bind extra `describe-*' commands
|
;; Bind extra `describe-*' commands
|
||||||
(keymap-global-set "C-h K" #'describe-keymap)
|
(keymap-global-set "C-h K" #'describe-keymap)
|
||||||
|
|
||||||
|
(use-package link-hint
|
||||||
|
:ensure t
|
||||||
|
:bind (("C-c l o" . link-hint-open-link)
|
||||||
|
("C-c l c" . link-hint-copy-link)
|
||||||
|
("C-c l C-o" . link-hint-open-all-link)
|
||||||
|
("C-c l C-c" . link-hint-copy-all-link)))
|
||||||
|
|
||||||
(setq use-dialog-box nil
|
(setq use-dialog-box nil
|
||||||
fill-column 80
|
fill-column 80
|
||||||
truncate-lines nil
|
truncate-lines nil
|
||||||
|
@ -121,14 +128,16 @@
|
||||||
:ensure t
|
:ensure t
|
||||||
:config (nerd-icons-set-font "Symbols Nerd Font Mono"))
|
:config (nerd-icons-set-font "Symbols Nerd Font Mono"))
|
||||||
|
|
||||||
|
(use-package nerd-icons-dired
|
||||||
|
:ensure t
|
||||||
|
:hook (dired-mode))
|
||||||
|
|
||||||
(use-package nerd-icons-ibuffer
|
(use-package nerd-icons-ibuffer
|
||||||
:ensure t
|
:ensure t
|
||||||
:hook dired-mode)
|
:hook (ibuffer-mode))
|
||||||
|
|
||||||
(use-package nerd-icons-completion
|
(use-package nerd-icons-completion
|
||||||
:ensure t
|
:ensure t
|
||||||
:requires marginalia
|
|
||||||
:hook marginalia-mode
|
|
||||||
:config (nerd-icons-completion-mode +1))
|
:config (nerd-icons-completion-mode +1))
|
||||||
|
|
||||||
(use-package ligature
|
(use-package ligature
|
||||||
|
@ -256,6 +265,7 @@
|
||||||
org-refile-targets '((nil :maxlevel . 3)
|
org-refile-targets '((nil :maxlevel . 3)
|
||||||
(org-agenda-files :maxlevel . 3)))
|
(org-agenda-files :maxlevel . 3)))
|
||||||
|
|
||||||
|
(keymap-global-set "C-c o e" #'org-edit-src-code)
|
||||||
(keymap-global-set "C-c o a" #'org-agenda)
|
(keymap-global-set "C-c o a" #'org-agenda)
|
||||||
(keymap-global-set "C-c o n" #'org-capture)
|
(keymap-global-set "C-c o n" #'org-capture)
|
||||||
(keymap-global-set "C-c o l" #'org-capture-goto-last-stored)
|
(keymap-global-set "C-c o l" #'org-capture-goto-last-stored)
|
||||||
|
@ -316,6 +326,61 @@
|
||||||
(add-hook 'org-agenda-mode-hook #'khalel-import-events)
|
(add-hook 'org-agenda-mode-hook #'khalel-import-events)
|
||||||
(khalel-add-capture-template "e"))
|
(khalel-add-capture-template "e"))
|
||||||
|
|
||||||
|
(use-package rainbow-delimiters
|
||||||
|
:ensure t
|
||||||
|
:hook (prog-mode))
|
||||||
|
|
||||||
|
(setq apheleia-remote-algorithm 'local)
|
||||||
|
(use-package apheleia
|
||||||
|
:ensure t
|
||||||
|
:defer nil
|
||||||
|
:bind (("C-c c f" . apheleia-format-buffer))
|
||||||
|
:config (apheleia-global-mode +1))
|
||||||
|
|
||||||
|
(use-package ibuffer-project
|
||||||
|
:ensure t
|
||||||
|
:hook ((ibuffer . (lambda ()
|
||||||
|
(setq ibuffer-filter-groups (ibuffer-project-generate-filter-groups))
|
||||||
|
(unless (eq ibuffer-sorting-mode 'project-file-relative)
|
||||||
|
(ibuffer-do-sort-by-project-file-relative))))))
|
||||||
|
|
||||||
|
(use-package treesit-auto
|
||||||
|
:config (global-treesit-auto-mode +1))
|
||||||
|
|
||||||
|
(setq direnv-always-show-summary nil)
|
||||||
|
(use-package direnv
|
||||||
|
:config (direnv-mode +1))
|
||||||
|
|
||||||
|
;;; Eglot
|
||||||
|
(defun crafted-ide--add-eglot-hooks (mode-list)
|
||||||
|
"Add `eglot-ensure' to modes in MODE-LIST.
|
||||||
|
|
||||||
|
The mode must be loaded, i.e. found with `fboundp'. A mode which
|
||||||
|
is not loaded will not have a hook added, in which case add it
|
||||||
|
manually with something like this:
|
||||||
|
|
||||||
|
`(add-hook 'some-mode-hook #'eglot-ensure)'"
|
||||||
|
(dolist (mode-def mode-list)
|
||||||
|
(let ((mode (if (listp mode-def) (car mode-def) mode-def)))
|
||||||
|
(cond
|
||||||
|
((listp mode) (crafted-ide--add-eglot-hooks mode))
|
||||||
|
(t
|
||||||
|
(when (and (fboundp mode)
|
||||||
|
(not (eq 'clojure-mode mode)) ; prefer cider
|
||||||
|
(not (eq 'lisp-mode mode)) ; prefer sly/slime
|
||||||
|
(not (eq 'scheme-mode mode)) ; prefer geiser
|
||||||
|
)
|
||||||
|
(let ((hook-name (format "%s-hook" (symbol-name mode))))
|
||||||
|
(message "adding eglot to %s" hook-name)
|
||||||
|
(add-hook (intern hook-name) #'eglot-ensure))))))))
|
||||||
|
|
||||||
|
;; add eglot to existing programming modes when eglot is loaded.
|
||||||
|
(with-eval-after-load "eglot"
|
||||||
|
(crafted-ide--add-eglot-hooks eglot-server-programs))
|
||||||
|
|
||||||
|
;; Shutdown server when last managed buffer is killed
|
||||||
|
(customize-set-variable 'eglot-autoshutdown t)
|
||||||
|
|
||||||
(setq sendmail-program (executable-find "msmtp")
|
(setq sendmail-program (executable-find "msmtp")
|
||||||
send-mail-function #'smtpmail-send-it
|
send-mail-function #'smtpmail-send-it
|
||||||
message-sendmail-f-is-evil t
|
message-sendmail-f-is-evil t
|
||||||
|
@ -415,88 +480,6 @@
|
||||||
(when (require 'elfeed-tube nil :noerror)
|
(when (require 'elfeed-tube nil :noerror)
|
||||||
(elfeed-tube-setup)))
|
(elfeed-tube-setup)))
|
||||||
|
|
||||||
(when (require 'rainbow-delimiters nil :noerror)
|
|
||||||
(add-hook 'prog-mode-hook #'rainbow-delimiters-mode))
|
|
||||||
|
|
||||||
(when (require 'treesit-aut nil :noerror)
|
|
||||||
(global-treesit-auto-mode +1))
|
|
||||||
|
|
||||||
(setq apheleia-remote-algorithm 'local)
|
|
||||||
(when (require 'apheleia nil :noerror)
|
|
||||||
(keymap-global-set "C-c c f" #'apheleia-format-buffer)
|
|
||||||
(apheleia-global-mode +1))
|
|
||||||
|
|
||||||
(when (require 'eglot nil :noerror)
|
|
||||||
(eglot-ensure))
|
|
||||||
|
|
||||||
(setq direnv-always-show-summary nil)
|
|
||||||
(when (require 'direnv nil :noerror)
|
|
||||||
(direnv-mode +1))
|
|
||||||
|
|
||||||
(when (require 'yasnippet nil :noerror)
|
|
||||||
(require 'yasnippet-snippets nil :noerror)
|
|
||||||
(yas-reload-all)
|
|
||||||
(add-hook 'prog-mode-hook #'yas-minor-mode))
|
|
||||||
|
|
||||||
(defun fira-code-mode--make-alist (list)
|
|
||||||
"Generate prettify-symbols alist from LIST."
|
|
||||||
(let ((idx -1))
|
|
||||||
(mapcar
|
|
||||||
(lambda (s)
|
|
||||||
(setq idx (1+ idx))
|
|
||||||
(let* ((code (+ #Xe100 idx))
|
|
||||||
(width (string-width s))
|
|
||||||
(prefix ())
|
|
||||||
(suffix '(?\s (Br . Br)))
|
|
||||||
(n 1))
|
|
||||||
(while (< n width)
|
|
||||||
(setq prefix (append prefix '(?\s (Br . Bl))))
|
|
||||||
(setq n (1+ n)))
|
|
||||||
(cons s (append prefix suffix (list (decode-char 'ucs code))))))
|
|
||||||
list)))
|
|
||||||
|
|
||||||
(defconst fira-code-mode--ligatures
|
|
||||||
'("www" "**" "***" "**/" "*>" "*/" "\\\\" "\\\\\\"
|
|
||||||
"{-" "[]" "::" ":::" ":=" "!!" "!=" "!==" "-}"
|
|
||||||
"--" "---" "-->" "->" "->>" "-<" "-<<" "-~"
|
|
||||||
"#{" "#[" "##" "###" "####" "#(" "#?" "#_" "#_("
|
|
||||||
".-" ".=" ".." "..<" "..." "?=" "??" ";;" "/*"
|
|
||||||
"/**" "/=" "/==" "/>" "//" "///" "&&" "||" "||="
|
|
||||||
"|=" "|>" "^=" "$>" "++" "+++" "+>" "=:=" "=="
|
|
||||||
"===" "==>" "=>" "=>>" "<=" "=<<" "=/=" ">-" ">="
|
|
||||||
">=>" ">>" ">>-" ">>=" ">>>" "<*" "<*>" "<|" "<|>"
|
|
||||||
"<$" "<$>" "<!--" "<-" "<--" "<->" "<+" "<+>" "<="
|
|
||||||
"<==" "<=>" "<=<" "<>" "<<" "<<-" "<<=" "<<<" "<~"
|
|
||||||
"<~~" "</" "</>" "~@" "~-" "~=" "~>" "~~" "~~>" "%%"
|
|
||||||
"x" ":" "+" "+" "*"))
|
|
||||||
|
|
||||||
(defvar fira-code-mode--old-prettify-alist)
|
|
||||||
|
|
||||||
(defun fira-code-mode--enable ()
|
|
||||||
"Enable Fira Code ligatures in current buffer."
|
|
||||||
(setq-local fira-code-mode--old-prettify-alist prettify-symbols-alist)
|
|
||||||
(setq-local prettify-symbols-alist (append (fira-code-mode--make-alist fira-code-mode--ligatures) fira-code-mode--old-prettify-alist))
|
|
||||||
(prettify-symbols-mode t))
|
|
||||||
|
|
||||||
(defun fira-code-mode--disable ()
|
|
||||||
"Disable Fira Code ligatures in current buffer."
|
|
||||||
(setq-local prettify-symbols-alist fira-code-mode--old-prettify-alist)
|
|
||||||
(prettify-symbols-mode -1))
|
|
||||||
|
|
||||||
(define-minor-mode fira-code-mode
|
|
||||||
"Fira Code ligatures minor mode"
|
|
||||||
:lighter " Fira Code"
|
|
||||||
(setq-local prettify-symbols-unprettify-at-point 'right-edge)
|
|
||||||
(if fira-code-mode
|
|
||||||
(fira-code-mode--enable)
|
|
||||||
(fira-code-mode--disable)))
|
|
||||||
|
|
||||||
(defun fira-code-mode--setup ()
|
|
||||||
"Setup Fira Code Symbols"
|
|
||||||
(set-fontset-font t '(#Xe100 . #Xe16f) "Fira Code Symbol"))
|
|
||||||
|
|
||||||
(fira-code-mode)
|
|
||||||
|
|
||||||
(when (require 'emms-setup nil :noerror)
|
(when (require 'emms-setup nil :noerror)
|
||||||
(setq emms-player-list '(emms-player-mpv)
|
(setq emms-player-list '(emms-player-mpv)
|
||||||
emms-info-functions '(emms-info-native)
|
emms-info-functions '(emms-info-native)
|
||||||
|
@ -638,98 +621,6 @@
|
||||||
(corfu-mode))
|
(corfu-mode))
|
||||||
(add-hook 'eshell-mode-hook #'crafted-completion-corfu-eshell))
|
(add-hook 'eshell-mode-hook #'crafted-completion-corfu-eshell))
|
||||||
|
|
||||||
;;; Eglot
|
|
||||||
(defun crafted-ide--add-eglot-hooks (mode-list)
|
|
||||||
"Add `eglot-ensure' to modes in MODE-LIST.
|
|
||||||
|
|
||||||
The mode must be loaded, i.e. found with `fboundp'. A mode which
|
|
||||||
is not loaded will not have a hook added, in which case add it
|
|
||||||
manually with something like this:
|
|
||||||
|
|
||||||
`(add-hook 'some-mode-hook #'eglot-ensure)'"
|
|
||||||
(dolist (mode-def mode-list)
|
|
||||||
(let ((mode (if (listp mode-def) (car mode-def) mode-def)))
|
|
||||||
(cond
|
|
||||||
((listp mode) (crafted-ide--add-eglot-hooks mode))
|
|
||||||
(t
|
|
||||||
(when (and (fboundp mode)
|
|
||||||
(not (eq 'clojure-mode mode)) ; prefer cider
|
|
||||||
(not (eq 'lisp-mode mode)) ; prefer sly/slime
|
|
||||||
(not (eq 'scheme-mode mode)) ; prefer geiser
|
|
||||||
)
|
|
||||||
(let ((hook-name (format "%s-hook" (symbol-name mode))))
|
|
||||||
(message "adding eglot to %s" hook-name)
|
|
||||||
(add-hook (intern hook-name) #'eglot-ensure))))))))
|
|
||||||
|
|
||||||
;; add eglot to existing programming modes when eglot is loaded.
|
|
||||||
(with-eval-after-load "eglot"
|
|
||||||
(crafted-ide--add-eglot-hooks eglot-server-programs))
|
|
||||||
|
|
||||||
;; Shutdown server when last managed buffer is killed
|
|
||||||
(customize-set-variable 'eglot-autoshutdown t)
|
|
||||||
|
|
||||||
;;; tree-sitter
|
|
||||||
(defun crafted-ide--configure-tree-sitter-pre-29 ()
|
|
||||||
"Configure tree-sitter for Emacs 28 or earlier."
|
|
||||||
|
|
||||||
(defun crafted-tree-sitter-load (lang-symbol)
|
|
||||||
"Setup tree-sitter for a language.
|
|
||||||
|
|
||||||
This must be called in the user's configuration to configure
|
|
||||||
tree-sitter for LANG-SYMBOL.
|
|
||||||
|
|
||||||
Example: `(crafted-tree-sitter-load 'python)'"
|
|
||||||
(tree-sitter-require lang-symbol)
|
|
||||||
(let ((mode-hook-name
|
|
||||||
(intern (format "%s-mode-hook" (symbol-name lang-symbol)))))
|
|
||||||
(add-hook mode-hook-name #'tree-sitter-mode))))
|
|
||||||
|
|
||||||
(defun crafted-ide--configure-tree-sitter (opt-out)
|
|
||||||
"Configure tree-sitter for Emacs 29 or later.
|
|
||||||
OPT-OUT is a list of symbols of language grammars to opt out before auto-install."
|
|
||||||
;; only attempt to use tree-sitter when Emacs was built with it.
|
|
||||||
(when (member "TREE_SITTER" (split-string system-configuration-features))
|
|
||||||
(when (require 'treesit-auto nil :noerror)
|
|
||||||
;; add all items of opt-out to the `treesit-auto-opt-out-list'.
|
|
||||||
(when opt-out
|
|
||||||
(mapc (lambda (e) (add-to-list 'treesit-auto-opt-out-list e)) opt-out))
|
|
||||||
;; prefer tree-sitter modes
|
|
||||||
(global-treesit-auto-mode)
|
|
||||||
;; install all the tree-sitter grammars
|
|
||||||
(treesit-auto-install-all)
|
|
||||||
;; configure `auto-mode-alist' for tree-sitter modes relying on
|
|
||||||
;; `fundamental-mode'
|
|
||||||
(treesit-auto-add-to-auto-mode-alist))
|
|
||||||
(when (locate-library "combobulate")
|
|
||||||
;; perhaps too gross of an application, but the *-ts-modes
|
|
||||||
;; eventually derive from this mode.
|
|
||||||
(add-hook 'prog-mode-hook #'combobulate-mode))))
|
|
||||||
|
|
||||||
(defun crafted-ide-configure-tree-sitter (&optional opt-out)
|
|
||||||
"Configure tree-sitter.
|
|
||||||
Requires a C compiler (gcc, cc, c99) installed on the system.
|
|
||||||
Note that OPT-OUT only affects setups with Emacs 29 or later.
|
|
||||||
|
|
||||||
For Emacs 29 or later:
|
|
||||||
Requires Emacs to be built using \"--with-tree-sitter\".
|
|
||||||
All language grammars are auto-installed unless they are a member of OPT-OUT."
|
|
||||||
(if (version< emacs-version "29")
|
|
||||||
(crafted-ide--configure-tree-sitter-pre-29)
|
|
||||||
(crafted-ide--configure-tree-sitter opt-out)))
|
|
||||||
|
|
||||||
;; turn on editorconfig if it is available
|
|
||||||
(when (require 'editorconfig nil :noerror)
|
|
||||||
(add-hook 'prog-mode-hook #'editorconfig-mode))
|
|
||||||
|
|
||||||
;; enhance ibuffer with ibuffer-project if it is available.
|
|
||||||
(when (require 'ibuffer-project nil :noerror)
|
|
||||||
(defun crafted-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)
|
|
||||||
(ibuffer-do-sort-by-project-file-relative)))
|
|
||||||
(add-hook 'ibuffer-hook #'crafted-ide-enhance-ibuffer-with-ibuffer-project))
|
|
||||||
|
|
||||||
;; Return or left-click with mouse follows link
|
;; Return or left-click with mouse follows link
|
||||||
(customize-set-variable 'org-return-follows-link t)
|
(customize-set-variable 'org-return-follows-link t)
|
||||||
(customize-set-variable 'org-mouse-1-follows-link t)
|
(customize-set-variable 'org-mouse-1-follows-link t)
|
||||||
|
|
Loading…
Reference in a new issue