Compare commits

...

12 commits

Author SHA1 Message Date
Henrik Lissner
c27621a777
fix(evil): evil-respect-visual-line-mode: up/down/end/home keys
Fix: #7249
Ref: emacs-evil/evil#1971
2025-09-20 16:05:12 -04:00
Henrik Lissner
bdacdfa67c
fix(format): register more ts-modes
While not strictly necessary (because apheleia uses
`provided-mode-derived-p` for its major mode tests), many *-ts-modes
didn't declare themselves children of their base modes until 30.1+.
2025-09-20 14:52:01 -04:00
Henrik Lissner
c48aa1851c
fix(org): load +roam.el for +roam2
Was meant to be part of d92883b, for backwards compatibility with folks
still using the +roam2 flag.

Amend: d92883bff8
2025-09-20 14:39:02 -04:00
Henrik Lissner
fffefc3118
fix(format): consolidate save-without-formatting keybind
It's too much hassle to claim either 'SPC b s' or 'SPC f s' for the
saving-without-formatting command (and to justify why one over the
other), so porque no los dos? Plus, I now leave 'C-x C-s' (save-buffer)
alone; principle of least surprise and what not.

Fix: #8460
Ref: https://xkcd.com/1172
2025-09-20 14:22:15 -04:00
Henrik Lissner
3436b2c3ba
fix: nerd-icons: overeager gopher icon
Ref: rainstormstudio/nerd-icons.el#120
Fix: doomemacs/doomemacs#8517
2025-09-20 14:03:27 -04:00
Henrik Lissner
eacd1a030e
fix(biblio): helm + org-cite-insert interop
Fix: #8462
2025-09-20 13:56:40 -04:00
Henrik Lissner
b43d748d67
fix(default): corfu-indexed-mode & RET interop
This whole RET/TAB/DEL system needs rethinking, but it'll have to wait.

Fix: #8120
2025-09-20 13:34:48 -04:00
Henrik Lissner
2a65250743
refactor(org): +roam: remove org-roam-v2-ack
Was removed upstream.

Ref: org-roam/org-roam@2c5f429b24
2025-09-20 13:04:52 -04:00
Henrik Lissner
055788047c
fix(sml): mirror sml-mode config to sml-ts-mode 2025-09-20 12:37:24 -04:00
Henrik Lissner
3c10db6824
fix(sml): company-mlton support in sml-ts-mode 2025-09-20 12:36:19 -04:00
Henrik Lissner
3f964df041
fix(org): +roam: revert org-roam-db-gc-threshold to default
It's high enough, increasing it this high may make it spiral in the
worst cases.

Fix: #7009
2025-09-20 02:57:54 -04:00
Henrik Lissner
d92883bff8
refactor!(org): remove org-roam v1
BREAKING CHANGE: This finally removes org-roam v1, which has been
deprecated for nearly 5 years (since 5ef733b). Most users should already
be on it. v2 has a migration wizard for anyone still on v1, which will
kick in if it detects a v1 roam db.
2025-09-20 02:51:30 -04:00
17 changed files with 241 additions and 394 deletions

View file

@ -526,7 +526,12 @@ windows, switch to `doom-fallback-buffer'. Otherwise, delegate to original
nerd-icons-devicon
nerd-icons-ipsicon
nerd-icons-pomicon
nerd-icons-powerline))
nerd-icons-powerline)
:config
;; REVIEW: Remove when rainstormstudio/nerd-icons#120 is merged.
(cl-callf2 assoc-delete-all "go" nerd-icons-dir-icon-alist)
(setf (alist-get "^go$" nerd-icons-dir-icon-alist nil nil #'equal)
'(nerd-icons-devicon "nf-dev-go")))
;; Hide the mode line in completion popups and MAN pages because they serve
;; little purpose there, and is better hidden.

View file

@ -193,23 +193,8 @@
:desc "New Entry" "j" #'org-journal-new-entry
:desc "New Scheduled Entry" "J" #'org-journal-new-scheduled-entry
:desc "Search Forever" "s" #'org-journal-search-forever))
(:when (modulep! :lang org +roam)
(:prefix ("r" . "roam")
:desc "Switch to buffer" "b" #'org-roam-switch-to-buffer
:desc "Org Roam Capture" "c" #'org-roam-capture
:desc "Find file" "f" #'org-roam-find-file
:desc "Show graph" "g" #'org-roam-graph
:desc "Insert" "i" #'org-roam-insert
:desc "Insert (skipping org-capture)" "I" #'org-roam-insert-immediate
:desc "Org Roam" "r" #'org-roam
:desc "Tag" "t" #'org-roam-tag-add
:desc "Un-tag" "T" #'org-roam-tag-delete
(:prefix ("d" . "by date")
:desc "Arbitrary date" "d" #'org-roam-dailies-find-date
:desc "Today" "t" #'org-roam-dailies-find-today
:desc "Tomorrow" "m" #'org-roam-dailies-find-tomorrow
:desc "Yesterday" "y" #'org-roam-dailies-find-yesterday)))
(:when (modulep! :lang org +roam2)
(:when (or (modulep! :lang org +roam)
(modulep! :lang org +roam2))
(:prefix ("r" . "roam")
:desc "Open random node" "a" #'org-roam-node-random
:desc "Find node" "f" #'org-roam-node-find

View file

@ -417,7 +417,7 @@
:desc "Previous buffer" "p" #'previous-buffer
:desc "Revert buffer" "r" #'revert-buffer
:desc "Rename buffer" "R" #'rename-buffer
:desc "Save buffer" "s" #'save-buffer
:desc "Save buffer" "s" #'basic-save-buffer
:desc "Save all buffers" "S" #'evil-write-all
:desc "Save buffer as root" "u" #'doom/sudo-save-buffer
:desc "Pop up scratch buffer" "x" #'doom/open-scratch-buffer
@ -647,22 +647,8 @@
:desc "Org export to clipboard" "y" #'+org/export-to-clipboard
:desc "Org export to clipboard as RTF" "Y" #'+org/export-to-clipboard-as-rich-text
(:when (modulep! :lang org +roam)
(:prefix ("r" . "roam")
:desc "Switch to buffer" "b" #'org-roam-switch-to-buffer
:desc "Org Roam Capture" "c" #'org-roam-capture
:desc "Find file" "f" #'org-roam-find-file
:desc "Show graph" "g" #'org-roam-graph
:desc "Insert" "i" #'org-roam-insert
:desc "Insert (skipping org-capture)" "I" #'org-roam-insert-immediate
:desc "Org Roam" "r" #'org-roam
(:prefix ("d" . "by date")
:desc "Arbitrary date" "d" #'org-roam-dailies-find-date
:desc "Today" "t" #'org-roam-dailies-find-today
:desc "Tomorrow" "m" #'org-roam-dailies-find-tomorrow
:desc "Yesterday" "y" #'org-roam-dailies-find-yesterday)))
(:when (modulep! :lang org +roam2)
(:when (or (modulep! :lang org +roam)
(modulep! :lang org +roam2))
(:prefix ("r" . "roam")
:desc "Open random node" "a" #'org-roam-node-random
:desc "Find node" "f" #'org-roam-node-find

View file

@ -520,7 +520,9 @@ Continues comments if executed from a commented line."
:filter ,(lambda (cmd)
(pcase +corfu-want-ret-to-confirm
('nil (corfu-quit) nil)
('t (if (>= corfu--index 0) cmd))
('t (if (or (>= corfu--index 0)
(and prefix-arg (bound-and-true-p corfu-indexed-mode)))
cmd))
('both (funcall-interactively cmd) nil)
('minibuffer
(if (minibufferp nil t)

View file

@ -122,6 +122,14 @@ directives. By default, this only recognizes C directives.")
(evil-ex-nohighlight)
t)))
;; REVIEW: Remove if emacs-evil/evil#1971 is addressed.
(when evil-respect-visual-line-mode
(evil-define-minor-mode-key 'motion 'visual-line-mode
[up] #'evil-previous-visual-line
[down] #'evil-next-visual-line
[home] #'evil-beginning-of-visual-line
[end] #'evil-end-of-visual-line))
;; --- evil hacks -------------------------
(after! eldoc

View file

@ -47,8 +47,7 @@ This is controlled by `+format-on-save-disabled-modes'."
;; UX: Use prefix-arg on `save-buffer' or `basic-save-buffer' to inhibit
;; format-on-save behavior.
(define-key apheleia-mode-map [remap basic-save-buffer] #'+format/save-buffer-no-reformat)
(define-key apheleia-mode-map [remap save-buffer] #'+format/save-buffer)
(define-key apheleia-mode-map [remap basic-save-buffer] #'+format/save-buffer)
;; HACK: Apheleia suppresses notifications that the current buffer has
;; changed, so plugins that listen for them need to be manually informed:
@ -80,8 +79,11 @@ This is controlled by `+format-on-save-disabled-modes'."
;; Use clang-format for cuda and protobuf files.
(add-to-list 'apheleia-mode-alist '(cuda-mode . clang-format))
(add-to-list 'apheleia-mode-alist '(cuda-ts-mode . clang-format))
(add-to-list 'apheleia-mode-alist '(protobuf-mode . clang-format))
(add-to-list 'apheleia-formatters-mode-extension-assoc '(cuda-mode . ".cu"))
(add-to-list 'apheleia-formatters-mode-extension-assoc '(cuda-ts-mode . ".cu"))
(add-to-list 'apheleia-formatters-mode-extension-assoc '(glsl-ts-mode . ".glsl"))
(add-to-list 'apheleia-formatters-mode-extension-assoc '(protobuf-mode . ".proto"))
;; Apheleia's default clang-format config doesn't respect `c-basic-offset', so

View file

@ -79,11 +79,7 @@ https://www.mfoot.com/blog/2015/11/22/literate-emacs-configuration-with-org-mode
highlighting for latex. Keep in mind: this can be expensive. If org becomes
too slow, it'd be wise to disable this flag.
- +roam ::
Enable integration with [[https://github.com/org-roam/org-roam-v1][org-roam v1]]. This requires ~sqlite3~ to be installed
on your system. /Incompatible with [[doom-module:+roam2]]./
- +roam2 ::
Enable integration with [[https://github.com/org-roam/org-roam][org-roam v2]]. This requires ~sqlite3~ to be installed
on your system. /Incompatible with [[doom-module:+roam]]./
Enable integration with [[https://github.com/org-roam/org-roam][org-roam v2]].
** Packages
- [[doom-package:htmlize]]
@ -122,9 +118,7 @@ https://www.mfoot.com/blog/2015/11/22/literate-emacs-configuration-with-org-mode
- [[doom-package:org-appear]]
- [[doom-package:org-modern]]
- [[doom-module:+roam]]
- [[doom-package:org-roam]] (v1)
- [[doom-module:+roam2]]
- [[doom-package:org-roam]] (v2)
- [[doom-package:org-roam]]
*** From Modules
- [[doom-module::editor evil]]
@ -203,7 +197,8 @@ use Org's more esoteric features:
dependencies are met, e.g. install the [[doom-executable:ruby]] executable for ruby support. To
use ~jupyter kernels~ you need the [[doom-module:+jupyter]] flag, the associated kernel as
well as the [[doom-executable:jupyter]] program.
- [[doom-package:org-roam]] (with [[doom-module:+roam]] or [[doom-module:+roam2]] flag) requires [[doom-executable:sqlite3]] to be installed.
- [[doom-package:org-roam]] (with the [[doom-module:+roam]] flag) requires Emacs to be
built with sqlite support.
** MacOS
#+begin_src sh
@ -293,44 +288,7 @@ For =evil-mode= users, an overview of org-mode keybindings is provided [[https:/
#+end_src
* Troubleshooting
[[doom-report:][Report an issue?]]
** =org-roam=
*** Should I go with =+roam= (v1) or =+roam2= (v2)?
Long story short: if you're new to [[doom-package:org-roam]] and haven't used it, then you should
go with [[doom-module:+roam2]]; if you already have an ~org-roam-directory~ with the v1 files in
it, then you can keep use [[doom-module:+roam]] for the time being, but it will eventually be
removed, so you should [[https://www.orgroam.com/manual.html#How-to-migrate-from-Org_002droam-v1_003f][migrate]] at your earliest convenience.
V1 isn't actively maintained anymore and is now basically EOL. This means that
the feature disparity between the both will continue to grow, while its existing
bugs and problems won't be addressed, at least by the main maintainers. V2 can
be considered as a complete rewrite of the package so it comes with a lot of
breaking changes.
To learn more about v2 you can use the next resources:
- [[https://github.com/org-roam/org-roam/blob/master/doc/org-roam.org][Org-roam v2 Official Manual]]
- [[https://github.com/org-roam/org-roam/wiki/Hitchhiker's-Rough-Guide-to-Org-roam-V2][Hitchhiker's Rough Guide to Org roam V2]]
- [[https://blog.jethro.dev/posts/org_roam_v2/][Releasing Org-roam v2 - Jethro Kuan's blog]]
- [[https://org-roam.discourse.group/t/org-roam-major-redesign/1198][Thread about the redesign from Org-Roam Discourse]]
*** Migrating your existing files from v1 (=+roam=) to v2 (=+roam2=)
V2 comes with a migration wizard for v1 users. It's new, which means issues can
appear during the migration process. Because of that, *don't forget to backup*
your ~org-roam-directory~ before attempting to migrate.
In order to migrate from v1 to v2 using Doom follow the next steps:
1. Enable [[doom-module:+roam2]] flag (and disable [[doom-module:+roam]] if it was previously enabled) in your
=init.el=.
2. Ensure your ~org-roam-directory~ points to a directory with your v1 files.
3. Run ~$ doom sync -u~ in your shell.
4. Restart Emacs (if it was previously opened) and run ~org-roam-migrate-wizard~
command (~M-x org-roam-migrate-wizard RET~). The wizard will automatically
attempt to backup your previous ~org-roam-directory~ to =org-roam.bak=, but
just in case backup it yourself too.
4. After the wizard is done you should be good to go. Verify the integrity of
your data and whether it did everything as expected. In case of failure
[[https://github.com/org-roam/org-roam/issues][report]] your issue.
/There are no known problems with this module./ [[doom-report:][Report one?]]
* Frequently asked questions
/This module has no FAQs yet./ [[doom-suggest-faq:][Ask one?]]

View file

@ -1,8 +1,8 @@
;;; lang/org/autoload/contrib-roam2.el -*- lexical-binding: t; -*-
;;;###if (modulep! +roam2)
;;; lang/org/autoload/contrib-roam.el -*- lexical-binding: t; -*-
;;;###if (or (modulep! +roam) (modulep! +roam2))
;;; Custom node accessors
;;;###autoload (autoload 'org-roam-node-doom-filetitle "lang/org/autoload/contrib-roam2" nil t)
;;;###autoload (autoload 'org-roam-node-doom-filetitle "lang/org/autoload/contrib-roam" nil t)
(cl-defmethod org-roam-node-doom-filetitle ((node org-roam-node))
"Return the value of \"#+title:\" (if any) from file that NODE resides in.
If there's no file-level title in the file, return empty string."
@ -11,7 +11,7 @@ If there's no file-level title in the file, return empty string."
(org-roam-node-file-title node))
""))
;;;###autoload (autoload 'org-roam-node-doom-hierarchy "lang/org/autoload/contrib-roam2" nil t)
;;;###autoload (autoload 'org-roam-node-doom-hierarchy "lang/org/autoload/contrib-roam" nil t)
(cl-defmethod org-roam-node-doom-hierarchy ((node org-roam-node))
"Return hierarchy for NODE, constructed of its file title, OLP and direct title.
If some elements are missing, they will be stripped out."
@ -31,7 +31,7 @@ If some elements are missing, they will be stripped out."
separator (propertize (string-join olp separator) 'face '(shadow italic))
separator title)))))
;;;###autoload (autoload 'org-roam-node-doom-subdirs "lang/org/autoload/contrib-roam2" nil t)
;;;###autoload (autoload 'org-roam-node-doom-subdirs "lang/org/autoload/contrib-roam" nil t)
(cl-defmethod org-roam-node-doom-subdirs ((node org-roam-node))
"Return subdirectories of `org-roam-directory' in which NODE resides in.
If there's none, return an empty string."
@ -41,7 +41,7 @@ If there's none, return an empty string."
(file-relative-name org-roam-directory)
(file-name-directory)))
;;;###autoload (autoload 'org-roam-node-doom-tags "lang/org/autoload/contrib-roam2" nil t)
;;;###autoload (autoload 'org-roam-node-doom-tags "lang/org/autoload/contrib-roam" nil t)
(cl-defmethod org-roam-node-doom-tags ((node org-roam-node))
"Return tags formatted in the same way how they appear in org files."
(cl-remove-if (doom-rpartial
@ -52,7 +52,7 @@ If there's none, return an empty string."
(bound-and-true-p org-num-skip-tags))))
(org-roam-node-tags node)))
;;;###autoload (autoload 'org-roam-node-doom-type "lang/org/autoload/contrib-roam2" nil t)
;;;###autoload (autoload 'org-roam-node-doom-type "lang/org/autoload/contrib-roam" nil t)
(cl-defmethod org-roam-node-doom-type ((node org-roam-node))
"Return the directory relative to `org-roam-directory' as a note's \"type\"."
(when-let (dir (thread-first

View file

@ -1229,6 +1229,8 @@ between the two."
;;; Custom org modules
(dolist (flag (doom-module :lang 'org :flags))
(when (eq flag '+roam2) ; REVIEW: remove in v3
(setq flag '+roam))
(load! (concat "contrib/" (substring (symbol-name flag) 1)) nil t))
;; Add our general hooks after the submodules, so that any hooks the

View file

@ -1,93 +1,192 @@
;;; lang/org/contrib/roam.el -*- lexical-binding: t; -*-
;;;###if (modulep! +roam)
;;;###if (or (modulep! +roam) (modulep! +roam2))
(defvar +org-roam-open-buffer-on-find-file t
"If non-nil, open the org-roam buffer when opening an org roam file.")
(defvar +org-roam-auto-backlinks-buffer nil
"If non-nil, open and close the org-roam backlinks buffer automatically.
This ensures the backlinks buffer is always present so long as an org roam file
is visible. Once they are all closed or killed, the backlinks buffer will be
closed.")
(defvar +org-roam-link-to-org-use-id 'create-if-interactive
"`org-roam-directory' local value for `org-id-link-to-org-use-id'.
It's not recommended to set this to nil in order for other parts
of org-mode to properly utilize ID links.")
;;
;;; Packages
(use-package! org-roam
:hook (org-load . +org-init-roam-maybe-h)
:hook (org-roam-backlinks-mode . turn-on-visual-line-mode)
:commands (org-roam-buffer-toggle-display
org-roam-dailies-find-date
org-roam-dailies-find-today
org-roam-dailies-find-tomorrow
org-roam-dailies-find-yesterday)
:hook (org-load . +org-init-roam-h)
:preface
;; Set this to nil so we can later detect if the user has set custom values
;; for these variables. If not, default values will be set in the :config
;; section.
(defvar org-roam-directory nil)
(defvar org-roam-db-location nil)
:init
(map! :after org
:map org-mode-map
:localleader
:prefix ("m" . "org-roam")
"b" #'org-roam-switch-to-buffer
"f" #'org-roam-find-file
"g" #'org-roam-graph
"i" #'org-roam-insert
"I" #'org-roam-insert-immediate
"m" #'org-roam
"t" #'org-roam-tag-add
"T" #'org-roam-tag-delete
(:prefix ("d" . "by date")
:desc "Find previous note" "b" #'org-roam-dailies-find-previous-note
:desc "Find date" "d" #'org-roam-dailies-find-date
:desc "Find next note" "f" #'org-roam-dailies-find-next-note
:desc "Find tomorrow" "m" #'org-roam-dailies-find-tomorrow
:desc "Capture today" "n" #'org-roam-dailies-capture-today
:desc "Find today" "t" #'org-roam-dailies-find-today
:desc "Capture Date" "v" #'org-roam-dailies-capture-date
:desc "Find yesterday" "y" #'org-roam-dailies-find-yesterday
:desc "Find directory" "." #'org-roam-dailies-find-directory))
(doom-load-packages-incrementally
'(ansi-color dash f rx seq magit-section emacsql))
:config
(defun +org-init-roam-maybe-h ()
"Activate `org-roam-mode'. If it fails, fail gracefully."
(unless (with-demoted-errors "ORG ROAM ERROR: %s"
(org-roam-mode +1)
t)
(message "To try reinitializing org-roam, run 'M-x org-roam-mode'")
(org-roam-mode -1)))
(defun +org-init-roam-h ()
"Setup `org-roam' but don't immediately initialize its database.
Instead, initialize it when it will be actually needed."
(letf! ((#'org-roam-db-sync #'ignore))
(org-roam-db-autosync-enable)))
(defadvice! +org-roam-try-init-db-a (&rest _)
"Try to initialize org-roam database at the last possible safe moment.
In case of failure, fail gracefully."
:before #'org-roam-db-query
(message "Initializing org-roam database...")
(advice-remove 'org-roam-db-query #'+org-roam-try-init-db-a)
(org-roam-db-sync))
(defadvice! +org-roam-node-insert-after-point-a (fn &rest args)
"If in evil normal mode and cursor is on a whitespace character, insert the
link after the whitespace rather than before. If at EOL, add a space before
inserting the link."
:around #'org-roam-node-insert
(if (and (bound-and-true-p evil-local-mode)
(not (evil-insert-state-p))
(or (looking-at-p "[[:blank:]]")
(evil-eolp)))
(evil-with-state 'insert
(unless (eolp) (forward-char))
(if (evil-eolp) (insert " "))
(apply fn args))
(apply fn args)))
(setq org-roam-directory
(file-name-as-directory
(file-truename
(expand-file-name (or org-roam-directory "roam")
org-directory)))
org-roam-db-location (or org-roam-db-location
(concat doom-data-dir "org-roam.db"))
;; Make org-roam buffer sticky; i.e. don't replace it when opening a
;; file with an *-other-window command.
org-roam-buffer-window-parameters '((no-delete-other-windows . t))
org-roam-link-use-custom-faces 'everywhere
(thread-first (or org-roam-directory "roam")
(expand-file-name org-directory)
(file-truename)
(file-name-as-directory))
org-roam-node-display-template
(format "${doom-hierarchy:*} %s %s"
(propertize "${doom-type:12}" 'face 'font-lock-keyword-face)
(propertize "${doom-tags:42}" 'face '(:inherit org-tag :box nil)))
org-roam-completion-everywhere t
org-roam-completion-system
(cond ((modulep! :completion helm) 'helm)
((modulep! :completion ivy) 'ivy)
((modulep! :completion ido) 'ido)
('default)))
;; Reverse the default to favor faster searchers over slower ones.
org-roam-list-files-commands '(fd fdfind rg find))
;; Normally, the org-roam buffer doesn't open until you explicitly call
;; `org-roam'. If `+org-roam-open-buffer-on-find-file' is non-nil, the
;; org-roam buffer will be opened for you when you use `org-roam-find-file'
;; (but not `find-file', to limit the scope of this behavior).
(add-hook! 'find-file-hook
(defun +org-roam-open-buffer-maybe-h ()
(and +org-roam-open-buffer-on-find-file
(memq 'org-roam-buffer--update-maybe post-command-hook)
(not (window-parameter nil 'window-side)) ; don't proc for popups
(not (eq 'visible (org-roam-buffer--visibility)))
(with-current-buffer (window-buffer)
(org-roam-buffer--get-create)))))
(add-to-list 'org-roam-node-template-prefixes '("doom-tags" . "#"))
(add-to-list 'org-roam-node-template-prefixes '("doom-type" . "@"))
;; Hide the mode line in the org-roam buffer, since it serves no purpose. This
;; makes it easier to distinguish from other org buffers.
(add-hook 'org-roam-buffer-prepare-hook #'hide-mode-line-mode))
;; REVIEW Remove when addressed upstream. See org-roam/org-roam#2066.
(defadvice! +org--roam-fix-completion-width-for-vertico-a (fn &rest args)
"Fixes completion candidate width for vertico users."
:around #'org-roam-node-read--to-candidate
(letf! (defun org-roam-node--format-entry (template node &optional width)
(funcall org-roam-node--format-entry template node
(if (bound-and-true-p vertico-mode)
(if (minibufferp)
(window-width)
(1- (frame-width)))
width)))
(apply fn args)))
(setq-hook! 'org-roam-find-file-hook
org-id-link-to-org-use-id +org-roam-link-to-org-use-id)
;; Normally, the org-roam buffer won't open until `org-roam-buffer-toggle' is
;; explicitly called. If `+org-roam-open-buffer-on-find-file' is non-nil, the
;; org-roam buffer will automatically open whenever a file in
;; `org-roam-directory' is visited and closed when no org-roam buffers remain.
(add-hook! 'org-roam-find-file-hook :append
(defun +org-roam-enable-auto-backlinks-buffer-h ()
(add-hook 'doom-switch-buffer-hook #'+org-roam-manage-backlinks-buffer-h)))
(set-popup-rules!
`((,(regexp-quote org-roam-buffer) ; persistent org-roam buffer
:side right :width 0.33 :height 0.5 :ttl nil :modeline nil :quit nil :slot 1)
("^\\*org-roam: " ; node dedicated org-roam buffer
:side right :width 0.33 :height 0.5 :ttl nil :modeline nil :quit nil :slot 2)))
;; Soft-wrap lines in the backlinks buffer
(add-hook 'org-roam-mode-hook #'turn-on-visual-line-mode)
;; Use a 'roam:X' link's description if X is empty.
;; TODO PR this upstream?
(advice-add #'org-roam-link-follow-link :filter-args #'org-roam-link-follow-link-with-description-a)
(advice-add #'org-roam-link-replace-at-point :override #'org-roam-link-replace-at-point-a)
(map! :map org-mode-map
:localleader
:prefix ("m" . "org-roam")
"D" #'org-roam-demote-entire-buffer
"f" #'org-roam-node-find
"F" #'org-roam-ref-find
"g" #'org-roam-graph
"i" #'org-roam-node-insert
"I" #'org-id-get-create
"m" #'org-roam-buffer-toggle
"M" #'org-roam-buffer-display-dedicated
"n" #'org-roam-capture
"r" #'org-roam-refile
"R" #'org-roam-link-replace-all
(:prefix ("d" . "by date")
:desc "Goto previous note" "b" #'org-roam-dailies-goto-previous-note
:desc "Goto date" "d" #'org-roam-dailies-goto-date
:desc "Capture date" "D" #'org-roam-dailies-capture-date
:desc "Goto next note" "f" #'org-roam-dailies-goto-next-note
:desc "Goto tomorrow" "m" #'org-roam-dailies-goto-tomorrow
:desc "Capture tomorrow" "M" #'org-roam-dailies-capture-tomorrow
:desc "Capture today" "n" #'org-roam-dailies-capture-today
:desc "Goto today" "t" #'org-roam-dailies-goto-today
:desc "Capture today" "T" #'org-roam-dailies-capture-today
:desc "Goto yesterday" "y" #'org-roam-dailies-goto-yesterday
:desc "Capture yesterday" "Y" #'org-roam-dailies-capture-yesterday
:desc "Find directory" "-" #'org-roam-dailies-find-directory)
(:prefix ("o" . "node properties")
"a" #'org-roam-alias-add
"A" #'org-roam-alias-remove
"t" #'org-roam-tag-add
"T" #'org-roam-tag-remove
"r" #'org-roam-ref-add
"R" #'org-roam-ref-remove))
(when (modulep! :editor evil +everywhere)
(add-hook! 'org-roam-mode-hook
(defun +org-roam-detach-magit-section-mode-map-h ()
"Detach `magit-section-mode-map' from `org-roam-mode-map'.
Inheriting its keymaps introduces a lot of conflicts in
`org-roam-mode' based buffers, where Evil and leader keybindings
will become completely overridden. This is because `magit-section'
uses 'keymap text-property to attach section-unique keymaps, which
has a higher level of precedence than `emulation-mode-map-alists'.
Note: We do this each time through the hook, because otherwise
sections seems to ignore the detachment."
(set-keymap-parent org-roam-mode-map nil)))
(map! :map org-roam-mode-map
:nv "]" #'magit-section-forward-sibling
:nv "[" #'magit-section-backward-sibling
:nv "gj" #'magit-section-forward-sibling
:nv "gk" #'magit-section-backward-sibling
:nv "gr" #'revert-buffer
:nv "gR" #'revert-buffer
:nv "z1" #'magit-section-show-level-1
:nv "z2" #'magit-section-show-level-2
:nv "z3" #'magit-section-show-level-3
:nv "z4" #'magit-section-show-level-4
:nv "za" #'magit-section-toggle
:nv "zc" #'magit-section-hide
:nv "zC" #'magit-section-hide-children
:nv "zo" #'magit-section-show
:nv "zO" #'magit-section-show-children
:nv "zm" #'magit-section-show-level-2-all
:nv "zr" #'magit-section-show-level-4-all
:nv "C-j" #'magit-section-forward
:nv "C-k" #'magit-section-backward
:g "M-p" #'magit-section-backward-sibling
:g "M-n" #'magit-section-forward-sibling
:g [tab] #'magit-section-toggle
:g [C-tab] #'magit-section-cycle
:g [backtab] #'magit-section-cycle-global)))
;; Since the org module lazy loads org-protocol (waits until an org URL is

View file

@ -1,199 +0,0 @@
;;; lang/org/contrib/roam2.el -*- lexical-binding: t; -*-
;;;###if (modulep! +roam2)
(defvar +org-roam-auto-backlinks-buffer nil
"If non-nil, open and close the org-roam backlinks buffer automatically.
This ensures the backlinks buffer is always present so long as an org roam file
is visible. Once they are all closed or killed, the backlinks buffer will be
closed.")
(defvar +org-roam-link-to-org-use-id 'create-if-interactive
"`org-roam-directory' local value for `org-id-link-to-org-use-id'.
It's not recommended to set this to nil in order for other parts
of org-mode to properly utilize ID links.")
;;
;;; Packages
(use-package! org-roam
:hook (org-load . +org-init-roam-h)
:preface
;; Set this to nil so we can later detect if the user has set custom values
;; for these variables. If not, default values will be set in the :config
;; section.
(defvar org-roam-directory nil)
:init
(doom-load-packages-incrementally
'(ansi-color dash f rx seq magit-section emacsql))
;; Don't display warning message dedicated for v1 users. Need to be set early.
(setq org-roam-v2-ack t)
:config
(defun +org-init-roam-h ()
"Setup `org-roam' but don't immediately initialize its database.
Instead, initialize it when it will be actually needed."
(letf! ((#'org-roam-db-sync #'ignore))
(org-roam-db-autosync-enable)))
(defadvice! +org-roam-try-init-db-a (&rest _)
"Try to initialize org-roam database at the last possible safe moment.
In case of failure, fail gracefully."
:before #'org-roam-db-query
(message "Initializing org-roam database...")
(advice-remove 'org-roam-db-query #'+org-roam-try-init-db-a)
(org-roam-db-sync))
(defadvice! +org-roam-node-insert-after-point-a (fn &rest args)
"If in evil normal mode and cursor is on a whitespace character, insert the
link after the whitespace rather than before. If at EOL, add a space before
inserting the link."
:around #'org-roam-node-insert
(if (and (bound-and-true-p evil-local-mode)
(not (evil-insert-state-p))
(or (looking-at-p "[[:blank:]]")
(evil-eolp)))
(evil-with-state 'insert
(unless (eolp) (forward-char))
(if (evil-eolp) (insert " "))
(apply fn args))
(apply fn args)))
(setq org-roam-directory
(thread-first (or org-roam-directory "roam")
(expand-file-name org-directory)
(file-truename)
(file-name-as-directory))
org-roam-node-display-template
(format "${doom-hierarchy:*} %s %s"
(propertize "${doom-type:12}" 'face 'font-lock-keyword-face)
(propertize "${doom-tags:42}" 'face '(:inherit org-tag :box nil)))
org-roam-completion-everywhere t
org-roam-db-gc-threshold most-positive-fixnum
;; Reverse the default to favor faster searchers over slower ones.
org-roam-list-files-commands '(fd fdfind rg find))
(add-to-list 'org-roam-node-template-prefixes '("doom-tags" . "#"))
(add-to-list 'org-roam-node-template-prefixes '("doom-type" . "@"))
;; REVIEW Remove when addressed upstream. See org-roam/org-roam#2066.
(defadvice! +org--roam-fix-completion-width-for-vertico-a (fn &rest args)
"Fixes completion candidate width for vertico users."
:around #'org-roam-node-read--to-candidate
(letf! (defun org-roam-node--format-entry (template node &optional width)
(funcall org-roam-node--format-entry template node
(if (bound-and-true-p vertico-mode)
(if (minibufferp)
(window-width)
(1- (frame-width)))
width)))
(apply fn args)))
(setq-hook! 'org-roam-find-file-hook
org-id-link-to-org-use-id +org-roam-link-to-org-use-id)
;; Normally, the org-roam buffer won't open until `org-roam-buffer-toggle' is
;; explicitly called. If `+org-roam-open-buffer-on-find-file' is non-nil, the
;; org-roam buffer will automatically open whenever a file in
;; `org-roam-directory' is visited and closed when no org-roam buffers remain.
(add-hook! 'org-roam-find-file-hook :append
(defun +org-roam-enable-auto-backlinks-buffer-h ()
(add-hook 'doom-switch-buffer-hook #'+org-roam-manage-backlinks-buffer-h)))
(set-popup-rules!
`((,(regexp-quote org-roam-buffer) ; persistent org-roam buffer
:side right :width 0.33 :height 0.5 :ttl nil :modeline nil :quit nil :slot 1)
("^\\*org-roam: " ; node dedicated org-roam buffer
:side right :width 0.33 :height 0.5 :ttl nil :modeline nil :quit nil :slot 2)))
;; Soft-wrap lines in the backlinks buffer
(add-hook 'org-roam-mode-hook #'turn-on-visual-line-mode)
;; Use a 'roam:X' link's description if X is empty.
;; TODO PR this upstream?
(advice-add #'org-roam-link-follow-link :filter-args #'org-roam-link-follow-link-with-description-a)
(advice-add #'org-roam-link-replace-at-point :override #'org-roam-link-replace-at-point-a)
(map! :map org-mode-map
:localleader
:prefix ("m" . "org-roam")
"D" #'org-roam-demote-entire-buffer
"f" #'org-roam-node-find
"F" #'org-roam-ref-find
"g" #'org-roam-graph
"i" #'org-roam-node-insert
"I" #'org-id-get-create
"m" #'org-roam-buffer-toggle
"M" #'org-roam-buffer-display-dedicated
"n" #'org-roam-capture
"r" #'org-roam-refile
"R" #'org-roam-link-replace-all
(:prefix ("d" . "by date")
:desc "Goto previous note" "b" #'org-roam-dailies-goto-previous-note
:desc "Goto date" "d" #'org-roam-dailies-goto-date
:desc "Capture date" "D" #'org-roam-dailies-capture-date
:desc "Goto next note" "f" #'org-roam-dailies-goto-next-note
:desc "Goto tomorrow" "m" #'org-roam-dailies-goto-tomorrow
:desc "Capture tomorrow" "M" #'org-roam-dailies-capture-tomorrow
:desc "Capture today" "n" #'org-roam-dailies-capture-today
:desc "Goto today" "t" #'org-roam-dailies-goto-today
:desc "Capture today" "T" #'org-roam-dailies-capture-today
:desc "Goto yesterday" "y" #'org-roam-dailies-goto-yesterday
:desc "Capture yesterday" "Y" #'org-roam-dailies-capture-yesterday
:desc "Find directory" "-" #'org-roam-dailies-find-directory)
(:prefix ("o" . "node properties")
"a" #'org-roam-alias-add
"A" #'org-roam-alias-remove
"t" #'org-roam-tag-add
"T" #'org-roam-tag-remove
"r" #'org-roam-ref-add
"R" #'org-roam-ref-remove))
(when (modulep! :editor evil +everywhere)
(add-hook! 'org-roam-mode-hook
(defun +org-roam-detach-magit-section-mode-map-h ()
"Detach `magit-section-mode-map' from `org-roam-mode-map'.
Inheriting its keymaps introduces a lot of conflicts in
`org-roam-mode' based buffers, where Evil and leader keybindings
will become completely overridden. This is because `magit-section'
uses 'keymap text-property to attach section-unique keymaps, which
has a higher level of precedence than `emulation-mode-map-alists'.
Note: We do this each time through the hook, because otherwise
sections seems to ignore the detachment."
(set-keymap-parent org-roam-mode-map nil)))
(map! :map org-roam-mode-map
:nv "]" #'magit-section-forward-sibling
:nv "[" #'magit-section-backward-sibling
:nv "gj" #'magit-section-forward-sibling
:nv "gk" #'magit-section-backward-sibling
:nv "gr" #'revert-buffer
:nv "gR" #'revert-buffer
:nv "z1" #'magit-section-show-level-1
:nv "z2" #'magit-section-show-level-2
:nv "z3" #'magit-section-show-level-3
:nv "z4" #'magit-section-show-level-4
:nv "za" #'magit-section-toggle
:nv "zc" #'magit-section-hide
:nv "zC" #'magit-section-hide-children
:nv "zo" #'magit-section-show
:nv "zO" #'magit-section-show-children
:nv "zm" #'magit-section-show-level-2-all
:nv "zr" #'magit-section-show-level-4-all
:nv "C-j" #'magit-section-forward
:nv "C-k" #'magit-section-backward
:g "M-p" #'magit-section-backward-sibling
:g "M-n" #'magit-section-forward-sibling
:g [tab] #'magit-section-toggle
:g [C-tab] #'magit-section-cycle
:g [backtab] #'magit-section-cycle-global)))
;; Since the org module lazy loads org-protocol (waits until an org URL is
;; detected), we can safely chain `org-roam-protocol' to it.
(use-package! org-roam-protocol
:after org-protocol)

View file

@ -5,11 +5,8 @@
(unless (executable-find "gnuplot")
(warn! "Couldn't find gnuplot. org-plot/gnuplot will not work")))
(when (modulep! +roam)
(warn! "You are using org-roam-v1. This version is unmaintained Doom support for it will eventually be removed.\
Migrate your notes to org-roam-v2 and switch to the +roam2 flag (see the module readme).")
(unless (executable-find "sqlite3")
(warn! "Couldn't find the sqlite3 executable. org-roam will not work.")))
(when (modulep! +roam2)
(warn! "+roam2 is deprecated; use +roam instead (they install the same version)"))
(when (or (modulep! +roam)
(modulep! +roam2))
(unless (executable-find "dot")

View file

@ -97,20 +97,9 @@
:recipe (:host github :repo "hakimel/reveal.js"
:files ("css" "dist" "js" "plugin"))
:pin "4cf184924d59e3d2b6552190c740ea5c7ab07981"))
(cond
((modulep! +roam)
(package! org-roam
:recipe (:host github :repo "org-roam/org-roam-v1")
:pin "946a879a4a18756a0508afba1e0b0fe070c6a8b4"))
((modulep! +roam2)
(package! org-roam
;; FIXME A :recipe isn't strictly necessary, but without it, our package
;; bumper fails to distinguish between org-roam v1 and v2.
:recipe (:host github :repo "org-roam/org-roam")
:pin "89dfaef38b6caa3027f20f96a551dc8f194ac533")
(when (< emacs-major-version 29)
;; HACK: Needed until org-roam/org-roam#2485 is resolved.
(package! emacsql :pin "491105a01f58bf0b346cbc0254766c6800b229a2"))))
(when (or (modulep! +roam)
(modulep! +roam2))
(package! org-roam :pin "89dfaef38b6caa3027f20f96a551dc8f194ac533"))
;;; Babel
(package! ob-async :pin "9aac486073f5c356ada20e716571be33a350a982")

View file

@ -1,20 +1,19 @@
;;; lang/sml/config.el -*- lexical-binding: t; -*-
(use-package! sml-mode
:mode "\\.s\\(?:ml\\|ig\\)\\'"
:config
(set-repl-handler! '(sml-mode sml-ts-mode) #'run-sml)
(set-formatter! 'smlformat '("smlformat") :modes '(sml-mode sml-ts-mode))
(defun +sml-common-config (mode)
(set-repl-handler! mode #'run-sml)
(set-formatter! 'smlformat '("smlformat") :modes mode)
(when (modulep! +lsp)
(add-hook 'sml-mode-local-vars-hook #'lsp! 'append))
(add-hook (intern (format "%s-local-vars-hook" mode)) #'lsp! 'append))
;; don't auto-close apostrophes (type 'a = foo) and backticks (`Foo)
(sp-with-modes '(sml-mode sml-ts-mode)
(sp-with-modes mode
(sp-local-pair "'" nil :actions nil)
(sp-local-pair "`" nil :actions nil))
(map! :map sml-mode-map
(map! :map ,(intern (format "%s-map" mode))
:i "RET" #'reindent-then-newline-and-indent
:i "S-SPC" #'sml-electric-space
:i "|" #'sml-electric-pipe
@ -26,7 +25,12 @@
:desc "Run region" "r" #'sml-prog-proc-send-region))
;; TODO: Mirror sml-mode keybinds to ts-mode
(use-package! sml-mode
:mode "\\.s\\(?:ml\\|ig\\)\\'"
:config
(+sml-common-config 'sml-mode))
(use-package! sml-ts-mode
:when (modulep! +tree-sitter)
:defer t
@ -34,12 +38,12 @@
(set-tree-sitter! 'sml-mode 'sml-ts-mode
'((sml :url "https://github.com/MatthewFluet/tree-sitter-sml")))
:config
(when (modulep! +lsp)
(add-hook 'sml-ts-mode-local-vars-hook #'lsp! 'append)))
(+sml-common-config 'sml-ts-mode))
(use-package! company-mlton
:when (modulep! :completion company)
:hook (sml-mode . company-mlton-init)
:hook (sml-ts-mode . company-mlton-init)
:config
(set-company-backend! 'sml-mode company-mlton-grouped-backend))
(set-company-backend! '(sml-mode sml-ts-mode) company-mlton-grouped-backend))

View file

@ -23,7 +23,7 @@ selected so it should be possible to use without modifications.
- [[doom-package:parsebib]] if [[doom-module::completion ivy]] or [[doom-module::completion helm]] or [[doom-module::completion vertico]]
- [[doom-package:citar]] if [[doom-module::completion vertico]]
- [[doom-package:citar-embark]] if [[doom-module::completion vertico]]
- [[doom-package:citar-org-roam]] if [[doom-module::completion vertico]] and [[doom-module::lang org +roam2]]
- [[doom-package:citar-org-roam]] if [[doom-module::completion vertico]] and [[doom-module::lang org +roam]]
- [[doom-package:helm-bibtex]] if [[doom-module::completion helm]]
- [[doom-package:ivy-bibtex]] if [[doom-module::completion ivy]]

View file

@ -105,3 +105,11 @@
:defer t
:config
(add-to-list 'ivy-re-builders-alist '(ivy-bibtex . ivy--regex-plus)))
(use-package! helm-bibtex
:when (modulep! :completion helm)
:defer t
:config
;; helm and org-cite don't get along (#8462)
(add-to-list 'helm-completing-read-handlers-alist '(org-cite-insert)))

View file

@ -10,7 +10,8 @@
(when (modulep! :completion vertico)
(package! citar :pin "75a85d8d8612ec2097248524eecff3d096fc5dd5")
(package! citar-embark :pin "75a85d8d8612ec2097248524eecff3d096fc5dd5")
(when (modulep! :lang org +roam2)
(when (or (modulep! :lang org +roam)
(modulep! :lang org +roam2))
(package! citar-org-roam :pin "9750cfbbf330ab3d5b15066b65bd0a0fe7c296fb")))
(package! parsebib :pin "7bfde4e4679413424a9a9af099203d5c23e32cd2")