From 7ef2b082725245b29e270aa2e2cb5fd012417b8c Mon Sep 17 00:00:00 2001 From: Lucas Sta Maria Date: Wed, 15 Oct 2025 22:29:38 -0500 Subject: [PATCH 1/5] fix(emacs): add swift --- .emacs.d/include/priime-languages.el | 4 ++++ .emacs.d/include/priime-lsp.el | 5 +++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.emacs.d/include/priime-languages.el b/.emacs.d/include/priime-languages.el index fd6c818..800c68e 100644 --- a/.emacs.d/include/priime-languages.el +++ b/.emacs.d/include/priime-languages.el @@ -120,6 +120,10 @@ (use-package auctex :straight t) (use-package cdlatex :straight t) (use-package yaml-mode :straight t) +(use-package swift-mode :straight t + :custom-face (swift-mode:keyword-face ((t (:inherit nano-strong)))) + :hook ((swift-mode . electric-pair-local-mode) + (swift-mode . electric-indent-local-mode))) ;; From https://www.ovistoica.com/blog/2024-7-05-modern-emacs-typescript-web-tsx-config (use-package treesit diff --git a/.emacs.d/include/priime-lsp.el b/.emacs.d/include/priime-lsp.el index 8f6d87d..76018e7 100644 --- a/.emacs.d/include/priime-lsp.el +++ b/.emacs.d/include/priime-lsp.el @@ -7,7 +7,7 @@ :custom (eglot-events-buffer-config '(:size 0 :format full)) :custom-face (eglot-inlay-hint-face ((t (:height 1.0)))) - :hook ((racket-mode rust-mode irony-mode tuareg-mode python-mode tsx-ts-mode nix-mode) . eglot-ensure) + :hook ((racket-mode rust-mode irony-mode tuareg-mode python-mode tsx-ts-mode nix-mode swift-mode) . eglot-ensure) :bind (:map eglot-mode-map ("C-c l r" . eglot-rename) ("C-c l a" . eglot-code-actions) @@ -16,7 +16,8 @@ (fset #'jsonrpc--log-event #'ignore) :config (add-to-list 'eglot-server-programs '(nix-mode "nil")) - (add-to-list 'eglot-server-programs '(python-mode . ("basedpyright-langserver" "--stdio")))) + (add-to-list 'eglot-server-programs '(python-mode . ("basedpyright-langserver" "--stdio"))) + (add-to-list 'eglot-server-programs '(swift-mode "sourcekit-lsp"))) (use-package eglot-booster :straight (eglot-booster :type git :host github :repo "jdtsmith/eglot-booster") :after (eglot) From 512680499e50781d942539f2371dfbf709aa1215 Mon Sep 17 00:00:00 2001 From: Lucas Sta Maria Date: Wed, 15 Oct 2025 22:29:52 -0500 Subject: [PATCH 2/5] fix(emacs): change font config --- .emacs.d/include/priime-general.el | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.emacs.d/include/priime-general.el b/.emacs.d/include/priime-general.el index 8da2d74..41052f3 100644 --- a/.emacs.d/include/priime-general.el +++ b/.emacs.d/include/priime-general.el @@ -8,9 +8,8 @@ ;;; Font (defvar priime--font-config - (cond ((string= (system-name) "minji") '("JetBrains Mono Medium" "Roboto" 10 0.9)) - ((eq system-type 'gnu/linux) '("Roboto Mono Medium" "Roboto" 12 0.8)) - ((eq system-type 'darwin) '("Menlo" "Verdana" 12 1)) + (cond ((eq system-type 'gnu/linux) '("JetBrains Mono Medium" "Roboto" 12 0.8)) + ((eq system-type 'darwin) '("JetBrains Mono Medium" "Verdana" 12 1)) (t '("Roboto Mono" "Roboto" 10 0.8)))) (defvar priime-fixed-font (-first-item priime--font-config)) From 86ef74cba8e6d2a7ce4f00cdc6df587968f568f1 Mon Sep 17 00:00:00 2001 From: Lucas Sta Maria Date: Wed, 15 Oct 2025 22:30:01 -0500 Subject: [PATCH 3/5] feat(emacs): add `consult-ripgrep-file` --- .emacs.d/include/priime-completion.el | 31 ++++++++++++++++++++++++--- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/.emacs.d/include/priime-completion.el b/.emacs.d/include/priime-completion.el index bf4b277..ac9c1a3 100644 --- a/.emacs.d/include/priime-completion.el +++ b/.emacs.d/include/priime-completion.el @@ -36,13 +36,38 @@ (use-package orderless :straight t :custom (orderless-matching-styles '(orderless-literal-prefix orderless-literal orderless-regexp))) -(use-package consult :straight t - :bind (("C-c r r" . consult-ripgrep) - ("C-c r g" . consult-grep))) (use-package yasnippet :straight t :hook ((prog-mode . yas-minor-mode))) (use-package yasnippet-snippets :straight t) +(use-package consult :straight t + :bind (("C-c r r" . consult-ripgrep) + ("C-c r g" . consult-grep) + ("C-c r f" . consult-ripgrep-file))) + +(defun consult-ripgrep-file (&optional initial) + "Search with `rg' in the current file with INITIAL input." + (interactive) + (cond + ((buffer-file-name) + (let* ((file (buffer-file-name)) + (builder (consult--ripgrep-make-builder (list file)))) + (consult--read + (consult--process-collection builder + :transform (consult--grep-format builder) + :file-handler t) + :prompt "Ripgrep (current file): " + :lookup #'consult--lookup-member + :state (consult--grep-state) + :initial initial + :add-history (thing-at-point 'symbol) + :require-match t + :category 'consult-grep + :group #'consult--prefix-group + :history '(:input consult--grep-history) + :sort nil))) + (t (user-error "Buffer not visiting a file")))) + (provide 'priime-completion) ;;; priime-completion.el ends here From a553794083a167571e540dbb006b06fc60eea5c4 Mon Sep 17 00:00:00 2001 From: Lucas Sta Maria Date: Wed, 15 Oct 2025 22:37:20 -0500 Subject: [PATCH 4/5] feat(emacs): add `org-log` command --- .emacs.d/include/priime-org.el | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.emacs.d/include/priime-org.el b/.emacs.d/include/priime-org.el index 2fd93d3..858d5df 100644 --- a/.emacs.d/include/priime-org.el +++ b/.emacs.d/include/priime-org.el @@ -11,7 +11,8 @@ "i" #'org-roam-node-insert "t" #'org-roam-tag-add "s" #'org-save-all-org-buffers - "w" #'org-switch-workspace) + "w" #'org-switch-workspace + "l" #'org-log) (defun org-switch-workspace (&optional workspace-name) "Switch the current org-roam-directory to WORKSPACE-NAME." @@ -29,6 +30,17 @@ (setq org-roam-db-location (cddr (assoc workspace-name org-workspaces-alist))) (org-roam-db-sync nil))) +(defun org-log () + "Add a new entry to the log." + (interactive) + (let* ((log-file-id "77f70d99-0674-43fb-8d64-f04cfa6cb495") + (log-file (org-roam-node-from-id log-file-id))) + (org-roam-node-visit log-file) + (beginning-of-buffer) + (org-next-visible-heading 1) + (org-insert-heading) + (org-timestamp '(16)))) + (defun org-roam-migrate () "Migrate a regular org file into an org-roam file in my format." (interactive) From 29c0e79b8c60af8095710d93c93572c6802bbc66 Mon Sep 17 00:00:00 2001 From: Lucas Sta Maria Date: Wed, 15 Oct 2025 22:42:11 -0500 Subject: [PATCH 5/5] refactor(emacs): rewrite git link --- .emacs.d/include/priime-vc.el | 35 +++++++++++++++++++++++++++-------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/.emacs.d/include/priime-vc.el b/.emacs.d/include/priime-vc.el index ff39702..373858b 100644 --- a/.emacs.d/include/priime-vc.el +++ b/.emacs.d/include/priime-vc.el @@ -48,18 +48,37 @@ (kill-new target-link) target-link)) -(defun git-link-priime-dev (hostname dirname filename branch commit start end) +(defun git-link--format-line-prefix (filepath) + "Format the prefix for line spec using FILEPATH." + (concat + (when (git-link--should-render-plain filepath) + "?plain=1") + "#")) + +(defun git-link--format-line-range (start end) + "Format the line from START to END." + (format "L%s-L%s" start end)) + +(defun git-link--format-line-start (start) + "Format the line START." + (format "L%s" start)) + +(defun git-link--format-line-suffix (filepath start end) + "Common helper function for formatting the line suffix at the end of a URL." + (when start + (concat (git-link--format-line-prefix filepath) + (if end + (git-link--format-line-range start end) + (git-link--format-line-start start))))) + +(defun git-link-priime-dev (hostname projname filepath branch commit start end) "git-link configuration for my own forge." (format "%s/%s/src/commit/%s/%s" hostname - dirname + projname (or branch commit) - (concat filename - (when start - (concat (if (git-link--should-render-plain filename) "?plain=1#" "#") - (if end - (format "L%s-L%s" start end) - (format "L%s" start))))))) + (concat filepath + (git-link--format-line-suffix filepath start end)))) (add-to-list 'git-link-remote-alist '("git.priime.dev" git-link-priime-dev))