about summary refs log tree commit diff
path: root/users/aspen/emacs
diff options
context:
space:
mode:
authorAspen Smith <root@gws.fyi>2024-03-31T17·40-0400
committerclbot <clbot@tvl.fyi>2024-03-31T17·49+0000
commit5b43bd705aa75ea4b9877176056eaa6bafa49303 (patch)
tree31c285e899fe33ca4caff7afd7dba348e7147426 /users/aspen/emacs
parent8bccc9dca99bbd4d0f02d591fd11e425bf3aecc4 (diff)
feat(aspen/emacs): Update from lusca r/7807
whatever dude

Change-Id: Ie0e01ccc49e82125d77dbf05fce5b1c53f630783
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11296
Reviewed-by: aspen <root@gws.fyi>
Autosubmit: aspen <root@gws.fyi>
Tested-by: BuildkiteCI
Diffstat (limited to 'users/aspen/emacs')
-rw-r--r--users/aspen/emacs/config.org154
-rw-r--r--users/aspen/emacs/init.el12
-rw-r--r--users/aspen/emacs/org-config.el2
-rw-r--r--users/aspen/emacs/packages.el1
4 files changed, 146 insertions, 23 deletions
diff --git a/users/aspen/emacs/config.org b/users/aspen/emacs/config.org
index 9eaf1c4561fe..e96d9cd7b9fd 100644
--- a/users/aspen/emacs/config.org
+++ b/users/aspen/emacs/config.org
@@ -1,4 +1,5 @@
 # Local variables:
+# lexical-binding: t
 # eval: (paxedit-mode 1)
 # eval: (display-line-numbers-mode 1)
 # eval: (flyspell-mode -1)
@@ -7,6 +8,10 @@
 
 #+title: Emacs Config
 
+#+begin_src emacs-lisp :tangle yes
+;; -*- lexical-binding: t; -*-
+#+end_src
+
 * Utils
 #+begin_src elisp :tangle yes
 (use-package! dash)
@@ -191,7 +196,7 @@ Returns nil if the regex did not match, non-nil otherwise"
 (let ((font-family (pcase system-type
                      ('darwin "MesloLGSDZ NF")
                      ('gnu/linux "Meslo LGSDZ Nerd Font"))))
-  (setq doom-font (font-spec :family font-family :size 14)
+  (setq doom-font (font-spec :family font-family :height 113)
         doom-big-font (font-spec :family font-family :size 24)
         doom-big-font-increment 5
         doom-variable-pitch-font (font-spec :family font-family)
@@ -340,6 +345,16 @@ Get the hell out of here, snipe!
 (remove-hook 'doom-first-input-hook #'evil-snipe-mode)
 #+end_src
 
+#+begin_src emacs-lisp :tangle yes
+(map!
+ (:leader
+  "b" #'consult-buffer
+  "r" #'consult-recent-file))
+#+end_src
+
+#+RESULTS:
+: consult-recent-file
+
 ** Flycheck
 #+begin_src elisp :tangle yes
 (evil-set-command-property 'flycheck-next-error :repeat nil)
@@ -681,7 +696,8 @@ fireplace-esque eval binding
 ** org-mode
 #+begin_src elisp :tangle yes
 (after! org
-  (load! "org-config"))
+  (load! "org-config")
+  (load! "org-query"))
 #+end_src
 
 #+RESULTS:
@@ -763,11 +779,16 @@ fireplace-esque eval binding
 (map!
  (:after org
   :n "C-c C-x C-o" #'org-clock-out
+  (:leader
+   "n k" #'org-archive-subtree-default)
 
   (:map org-capture-mode-map
    :n "g RET" #'org-capture-finalize
    :n "g \\"  #'org-captue-refile)))
 #+end_src
+
+#+RESULTS:
+
 ** magit
 #+begin_src elisp :tangle yes
 (after! magit
@@ -1058,11 +1079,7 @@ nil
   (interactive)
   (+evil-embrace-angle-bracket-modes-hook-h)
   (setq-local whitespace-line-column 100
-              fill-column 100)
-  (setq lsp-rust-analyzer-cargo-watch-command "clippy"
-        lsp-rust-analyzer-cargo-watch-args ["--target-dir" "/home/grfn/code/readyset/readyset/target/rust-analyzer"]
-        rustic-format-trigger 'on-save
-        lsp-ui-doc-enable t))
+              fill-column 100))
 
 (add-hook 'rust-mode-hook #'aspen/rust-setup)
 #+end_src
@@ -1094,11 +1111,91 @@ nil
 #+RESULTS:
 | doom--customize-themes-h-30 | doom--customize-themes-h-31 | doom--customize-themes-h-32 | doom--customize-themes-h-33 | doom--customize-themes-h-54 |
 
-* Fuzzy search
+** common-lisp
+*** Commands
+#+begin_src emacs-lisp :tangle yes
+(defun aspen/sly-panettone ()
+  (interactive)
+  (sly
+   (concat
+    (s-trim
+     (shell-command-to-string
+      "nix-build -o sbcl -E 'with import ~/code/depot {}; nix.buildLisp.sbclWith [web.panettone]'"))
+    "/bin/sbcl")))
+
+(defun aspen/setup-lisp ()
+  (interactive)
+  (rainbow-delimiters-mode)
+  (paxedit-mode 1)
+  (flycheck-mode -1))
+
+(add-hook 'common-lisp-mode-hook #'aspen/setup-lisp)
+
+(defun sly-run-tests ()
+  (interactive)
+  ;; TODO: handle other test frameworks
+  (let ((orig-window (get-buffer-window)))
+    (sly-eval '(fiveam:run!))
+    (funcall-interactively #'sly-mrepl-sync)
+    (select-window orig-window)))
+#+end_src
+
+#+RESULTS:
+: sly-run-tests
+
+*** Bindings
+
+#+begin_src emacs-lisp :tangle yes
+(map!
+ (:map sly-mode-map
+  :n "g \\" #'sly-mrepl-sync
+  :n "g d" #'sly-edit-definition
+  :n "K" #'sly-documentation
+  :n "g SPC" #'sly-compile-and-load-file
+  :n "g RET" #'sly-run-tests)
+
+ (:map sly-mrepl-mode-map
+  "C-k" #'sly-mrepl-previous-prompt
+  "C-r" #'isearch-backward))
+#+end_src
+
+#+RESULTS:
+
+* Completion
+** Corfu
+#+begin_src emacs-lisp :tangle yes
+(setopt +corfu-want-ret-to-confirm nil)
+
+(use-package! corfu
+  :demand t
+  :bind (:map corfu-map
+              ("TAB" . corfu-next)
+              ([tab] . corfu-next)
+              ("S-TAB" . corfu-previous)
+              ([backtab] . corfu-previous))
+  :init (setopt corfu-on-exact-match 'insert
+                corfu-preselect 'prompt
+                completion-cycle-threshold 1
+                corfu-quit-no-match t
+                corfu-quit-at-boundary t)
+  :config
+  (map! :map corfu-map
+        :i "TAB" #'corfu-next
+        :i [tab] #'corfu-next
+        :i "S-TAB" #'corfu-previous
+        :i [backtab] #'corfu-previous))
+#+end_src
+
+#+RESULTS:
+: t
+
+** Fuzzy search
 #+begin_src emacs-lisp :tangle yes
 (use-package! hotfuzz
+  :after (orderless corfu)
   :config
-  (setopt completion-styles '(hotfuzz)))
+  (setopt completion-styles '(hotfuzz basic)
+          completion-ignore-case t))
 #+end_src
 
 #+RESULTS:
@@ -1121,10 +1218,40 @@ nil
         message-sendmail-f-is-evil 't
         message-sendmail-envelope-from 'header
         message-sendmail-extra-arguments '("--read-envelope-from")))
+
+(defun aspen/notmuch-sync ()
+  (interactive)
+  (let* ((search-buffer (current-buffer))
+         (proc (start-process-shell-command
+                "notmuch-sync"
+                "*notmuch-sync*"
+                "cd ~/mail/personal/ && gmi sync"))
+         (buf (process-buffer proc)))
+
+    (set-process-sentinel
+     proc
+     (lambda (proc msg)
+       (internal-default-process-sentinel proc msg)
+       (when (and (string= msg "finished\n"))
+         (kill-buffer buf)
+         (with-current-buffer search-buffer
+           (when (eq major-mode 'notmuch-search-mode)
+             (notmuch-refresh-this-buffer))))))
+
+    (with-current-buffer buf
+      (+popup-buffer-mode))
+    (display-buffer buf '(display-buffer-at-bottom . ()))))
+
+(set-popup-rule!
+  "^\\*notmuch-sync\\*$"
+  :select nil
+  :quit 'other)
+
+(map! :map notmuch-search-mode-map
+      :n "g SPC" #'aspen/notmuch-sync)
 #+end_src
 
 #+RESULTS:
-| --read-envelope-from |
 
 ** Bindings
 #+begin_src emacs-lisp :tangle yes
@@ -1150,13 +1277,6 @@ nil
 | doom--customize-themes-h-91 | doom--customize-themes-h-92 | doom--customize-themes-h-93 | doom--customize-themes-h-94 | doom--customize-themes-h-95 | doom--customize-themes-h-96 | doom--customize-themes-h-97 | doom--customize-themes-h-98 | doom--customize-themes-h-99 | doom--customize-themes-h-100 |
 
 * Misc
-** Make underscores word chars
-#+begin_src elisp :tangle yes
-(modify-syntax-entry ?_ "w")
-#+end_src
-
-#+RESULTS:
-
 ** Matchit
 #+begin_src elisp :tangle yes
 (use-package! evil-matchit)
diff --git a/users/aspen/emacs/init.el b/users/aspen/emacs/init.el
index 2fe2316753d1..7674d088b5ab 100644
--- a/users/aspen/emacs/init.el
+++ b/users/aspen/emacs/init.el
@@ -21,7 +21,8 @@
        ;;layout            ; auie,ctsrnm is the superior home row
 
        :completion
-       company             ; the ultimate code completion backend
+       ;; company             ; the ultimate code completion backend
+       corfu
        ;;helm              ; the *other* search engine for love and life
        ;;ido               ; the other *other* search engine...
        ;;ivy               ; a search engine for love and life
@@ -30,7 +31,7 @@
        :ui
        ;;deft              ; notational velocity for Emacs
        doom              ; what makes DOOM look the way it does
-       ;; doom-dashboard    ; a nifty splash screen for Emacs
+       doom-dashboard    ; a nifty splash screen for Emacs
        ;;doom-quit         ; DOOM quit-message prompts when you quit Emacs
        (emoji +unicode)  ; 🙂
        hl-todo           ; highlight TODO/FIXME/NOTE/DEPRECATED/HACK/REVIEW
@@ -95,7 +96,7 @@
        (eval +overlay)     ; run code, run (also, repls)
        ;;gist              ; interacting with github gists
        lookup              ; navigate your code and its documentation
-       (lsp +eglot)               ; M-x vscode
+       lsp               ; M-x vscode
        magit             ; a git porcelain for Emacs
        ;;make              ; run make tasks from Emacs
        pass              ; password manager for nerds
@@ -142,7 +143,7 @@
        ;;idris             ; a language you can depend on
        json              ; At least it ain't XML
        ;;(java +lsp)       ; the poster child for carpal tunnel syndrome
-       ;;javascript        ; all(hope(abandon(ye(who(enter(here))))))
+       (javascript +lsp)        ; all(hope(abandon(ye(who(enter(here))))))
        ;;julia             ; a better, faster MATLAB
        ;;kotlin            ; a better, slicker Java(Script)
        ;;latex             ; writing papers in Emacs has never been so fun
@@ -156,7 +157,8 @@
        (org               ; organize your plain life in plain text
         +gnuplot
         +present
-        +pretty)
+        +pretty
+        )
        ;;php               ; perl's insecure younger brother
        ;;plantuml          ; diagrams for confusing people more
        ;;purescript        ; javascript, but functional
diff --git a/users/aspen/emacs/org-config.el b/users/aspen/emacs/org-config.el
index df93142b0f26..89cf7486fb90 100644
--- a/users/aspen/emacs/org-config.el
+++ b/users/aspen/emacs/org-config.el
@@ -128,7 +128,7 @@
    ("nw" "Next @Work" tags-todo "@work&next")
    ("nt" "Next tooling" tags-todo "tooling")
 
-   ("p" . "Project...")
+   ;; ("p" . "Project...")
    ;; ,@(aspen/org-projects->agenda-commands (aspen/org-projects))
    )
 
diff --git a/users/aspen/emacs/packages.el b/users/aspen/emacs/packages.el
index b72fb45a9fce..0bcc345d8847 100644
--- a/users/aspen/emacs/packages.el
+++ b/users/aspen/emacs/packages.el
@@ -5,6 +5,7 @@
 (package! paxedit)
 (package! predd
   :recipe (:host github :repo "skeeto/predd"))
+(package! direnv)
 (package! alert)
 (package! flycheck-clojure)
 (package! evil-matchit)