This thread contains a patchset. You're looking at the original emails,
but you may wish to use the patch review UI.
Review patch
12
2
[PATCH] feature: emacs-org-roam: Avoid loading org-roam-dailies if not used.
This commit:
- deletes the duplicate org-roam-dailies-directory declaration.
- assumes that if org-roam-dailies-directory is not set, then the user doesn't
use it and there's no need to load the extension.
- solves the conflict between org-roam and citar-org-roam packages is the user
enters an org-roam-package.
---
src/rde/features/emacs-xyz.scm | 78 ++++++++++++++++++++ --------------
1 file changed, 47 insertions(+), 31 deletions(-)
diff --git a/src/rde/features/emacs-xyz.scm b/src/rde/features/emacs-xyz.scm
index ed08e5d0..e38cd503 100644
--- a/src/rde/features/emacs-xyz.scm
+++ b/src/rde/features/emacs-xyz.scm
@@ -4471,6 +4471,14 @@ If NODE doesn't exist, create a new org-roam node with REF."
(define emacs-f-name 'org-roam)
(define f-name (symbol-append 'emacs- emacs-f-name))
+ (define emacs-org-roam-package
+ (if org-roam-dailies-directory
+ emacs-org-roam
+ (package/inherit emacs-org-roam
+ (source (origin (inherit (package-source emacs-org-roam))
+ (snippet
+ '(delete-file "extensions/org-roam-dailies.el")))))))
+
(define (get-home-services config)
(list
(rde-elisp-configuration-service
@@ -4547,16 +4555,25 @@ the node, relative to `org-roam-directory'."
(define-key map (kbd "C-c r a") 'org-roam-alias-add)
(define-key map (kbd "C-c r A") 'org-roam-alias-remove)
(define-key map (kbd "C-c r O") 'rde-org-roam-open-ref)
- (define-key map (kbd "C-c n N") 'org-roam-dailies-goto-next-note)
- (define-key map (kbd "C-c n P")
- 'org-roam-dailies-goto-previous-note)))
+ ,@(if org-roam-dailies-directory
+ `((define-key map (kbd "C-c n N")
+ 'org-roam-dailies-goto-next-note)
+ (define-key map (kbd "C-c n P")
+ 'org-roam-dailies-goto-previous-note))
+ '())))
,@(if org-roam-capture-templates
`((setq org-roam-capture-templates ',org-roam-capture-templates))
'())
,@(if org-roam-dailies-directory
- `((setq org-roam-dailies-directory ,org-roam-dailies-directory))
+ `((with-eval-after-load 'org-roam-dailies
+ ,@(if org-roam-dailies-capture-templates
+ `((setq org-roam-dailies-capture-templates
+ ',org-roam-dailies-capture-templates))
+ '())
+ (setq org-roam-dailies-directory
+ ,org-roam-dailies-directory)))
'()))
,@(if org-roam-todo?
(org-roam-todo config)
@@ -4580,25 +4597,19 @@ the node, relative to `org-roam-directory'."
'())))
'())
- (with-eval-after-load 'org-roam-dailies
- ,@(if org-roam-dailies-capture-templates
- `((setq org-roam-dailies-capture-templates
- ',org-roam-dailies-capture-templates))
- '())
- ,@(if org-roam-dailies-directory
- `((setq org-roam-dailies-directory
- ,org-roam-dailies-directory))
- '()))
-
(let ((map mode-specific-map))
- (define-key map (kbd "n t") 'org-roam-dailies-goto-today)
- (define-key map (kbd "n y") 'org-roam-dailies-goto-yesterday)
- (define-key map (kbd "n m") 'org-roam-dailies-goto-tomorrow)
- (define-key map (kbd "n d") 'org-roam-dailies-goto-date)
- (define-key map (kbd "n c t") 'org-roam-dailies-capture-today)
- (define-key map (kbd "n c y") 'org-roam-dailies-capture-yesterday)
- (define-key map (kbd "n c m") 'org-roam-dailies-capture-tomorrow)
- (define-key map (kbd "n c d") 'org-roam-dailies-capture-date)
+ ,@(if org-roam-dailies-directory
+ `((define-key map (kbd "n t") 'org-roam-dailies-goto-today)
+ (define-key map (kbd "n y") 'org-roam-dailies-goto-yesterday)
+ (define-key map (kbd "n m") 'org-roam-dailies-goto-tomorrow)
+ (define-key map (kbd "n d") 'org-roam-dailies-goto-date)
+ (define-key map (kbd "n c t") 'org-roam-dailies-capture-today)
+ (define-key map (kbd "n c y")
+ 'org-roam-dailies-capture-yesterday)
+ (define-key map (kbd "n c m")
+ 'org-roam-dailies-capture-tomorrow)
+ (define-key map (kbd "n c d") 'org-roam-dailies-capture-date))
+ '())
(define-key map (kbd "n n") 'org-roam-buffer-toggle)
(define-key map (kbd "n f") 'org-roam-node-find)
(define-key map (kbd "n i") 'org-roam-node-insert)
@@ -4611,17 +4622,17 @@ Knowlede base, note-taking set up and ready"
Set roam directory, basic keybindings, reasonable defaults and adjust
marginalia annotations."
#:keywords '(convenience org-mode roam knowledgebase)
- #:elisp-packages (append
- (list emacs-org-roam)
- (or (and=> (get-value 'emacs-embark config) list)
- '())
- (or (and=> (get-value 'emacs-org-recur config)
- list)
- '())))))
+ #:elisp-packages
+ (append (list emacs-org-roam-package)
+ (or (and=> (get-value 'emacs-embark config) list)
+ '())
+ (or (and=> (get-value 'emacs-org-recur config)
+ list)
+ '())))))
(feature
(name f-name)
- (values `((,f-name . #t)
+ (values `((,f-name . ,emacs-org-roam-package)
(org-roam-todo? . ,org-roam-todo?)))
(home-services-getter get-home-services)))
@@ -4715,7 +4726,12 @@ citar-org-roam-subdir if org-roam is enabled."
'(convenience org-mode org-cite citar references roam knowledgebase)
#:elisp-packages
(append
- (if (get-value 'emacs-org-roam config) (list emacs-citar-org-roam) '())
+ (if (get-value 'emacs-org-roam config)
+ (list
+ (package/inherit emacs-citar-org-roam
+ (propagated-inputs (list (get-value 'emacs-org-roam config)
+ emacs-citar))))
+ '())
(or (and=> emacs-all-the-icons list) '())
(list emacs-citar)))))
--
2.41.0
This needs more work, v2 incoming.
More context about these v2 patches : basically, I find that having
dailies inside org-roam clutters the database with no good reason, since
you rarely want to backlink to a daily note (and you can still forward
it like you want). I also want to keep my dailies directory in a
directory that's not under org-roam-directory.
So I decided to keep my dailies directory but outside org-roam. Also,
I liked the minimal org-roam-dailies, and didn't want to try org-journal
which seems too much for my needs, so I created an org-roam-less copy.
Hence the split with feature-org-dailies.
Since I keep most of my TODOs in the dailies, I also had to find a way
for them to work without org-roam-todo?, so I created org-dynamic-agenda
based on the exact same idea (remembering which files should be visited
when building the agenda). A version of it also profits for huge speed
improvements thanks to org-ql, hence feature-org-ql.
I think we could get the org-roam-todo code merged in
feature-org-dynamic-agenda, so that we can have a single feature for the
same idea.
In the end, that would make three feature much more clearly defined and
working one without the other : dailies, dynamic-agenda, roam ; instead
of one hard to grasp all-encompassing org-roam.
--
Best regards,
Nicolas Graves
On 2023-09-05 09:33, Nicolas Graves wrote:
> This needs more work, v2 incoming.
>
> More context about these v2 patches : basically, I find that having
> dailies inside org-roam clutters the database with no good reason, since
> you rarely want to backlink to a daily note (and you can still forward
> it like you want). I also want to keep my dailies directory in a
> directory that's not under org-roam-directory.
>
> So I decided to keep my dailies directory but outside org-roam. Also,
> I liked the minimal org-roam-dailies, and didn't want to try org-journal
> which seems too much for my needs, so I created an org-roam-less copy.
> Hence the split with feature-org-dailies.
>
> Since I keep most of my TODOs in the dailies, I also had to find a way
> for them to work without org-roam-todo?, so I created org-dynamic-agenda
> based on the exact same idea (remembering which files should be visited
> when building the agenda). A version of it also profits for huge speed
> improvements thanks to org-ql, hence feature-org-ql.
>
> I think we could get the org-roam-todo code merged in
> feature-org-dynamic-agenda, so that we can have a single feature for the
> same idea.
>
> In the end, that would make three feature much more clearly defined and
> working one without the other : dailies, dynamic-agenda, roam ; instead
> of one hard to grasp all-encompassing org-roam.
Sounds good to me.
--
Best regards,
Andrew Tropin
[PATCH v2 1/6] feature: emacs-org-roam: Avoid loading org-roam-dailies if not used.
This commit:
- deletes the duplicate org-roam-dailies-directory declaration.
- assumes that if org-roam-dailies-directory is not set, then the user doesn't
use it and there's no need to load the extension.
- solves the conflict between org-roam and citar-org-roam packages is the user
enters an org-roam-package.
---
src/rde/features/emacs-xyz.scm | 78 ++++++++++++++++++++ --------------
1 file changed, 47 insertions(+), 31 deletions(-)
diff --git a/src/rde/features/emacs-xyz.scm b/src/rde/features/emacs-xyz.scm
index b04879b3..02b9bc81 100644
--- a/src/rde/features/emacs-xyz.scm
+++ b/src/rde/features/emacs-xyz.scm
@@ -4473,6 +4473,14 @@ If NODE doesn't exist, create a new org-roam node with REF."
(define emacs-f-name 'org-roam)
(define f-name (symbol-append 'emacs- emacs-f-name))
+ (define emacs-org-roam-package
+ (if org-roam-dailies-directory
+ emacs-org-roam
+ (package/inherit emacs-org-roam
+ (source (origin (inherit (package-source emacs-org-roam))
+ (snippet
+ '(delete-file "extensions/org-roam-dailies.el")))))))
+
(define (get-home-services config)
(list
(rde-elisp-configuration-service
@@ -4549,16 +4557,25 @@ the node, relative to `org-roam-directory'."
(define-key map (kbd "C-c r a") 'org-roam-alias-add)
(define-key map (kbd "C-c r A") 'org-roam-alias-remove)
(define-key map (kbd "C-c r O") 'rde-org-roam-open-ref)
- (define-key map (kbd "C-c n N") 'org-roam-dailies-goto-next-note)
- (define-key map (kbd "C-c n P")
- 'org-roam-dailies-goto-previous-note)))
+ ,@(if org-roam-dailies-directory
+ `((define-key map (kbd "C-c n N")
+ 'org-roam-dailies-goto-next-note)
+ (define-key map (kbd "C-c n P")
+ 'org-roam-dailies-goto-previous-note))
+ '())))
,@(if org-roam-capture-templates
`((setq org-roam-capture-templates ',org-roam-capture-templates))
'())
,@(if org-roam-dailies-directory
- `((setq org-roam-dailies-directory ,org-roam-dailies-directory))
+ `((with-eval-after-load 'org-roam-dailies
+ ,@(if org-roam-dailies-capture-templates
+ `((setq org-roam-dailies-capture-templates
+ ',org-roam-dailies-capture-templates))
+ '())
+ (setq org-roam-dailies-directory
+ ,org-roam-dailies-directory)))
'()))
,@(if org-roam-file-exclude-regexp
@@ -4587,25 +4604,19 @@ the node, relative to `org-roam-directory'."
'())))
'())
- (with-eval-after-load 'org-roam-dailies
- ,@(if org-roam-dailies-capture-templates
- `((setq org-roam-dailies-capture-templates
- ',org-roam-dailies-capture-templates))
- '())
- ,@(if org-roam-dailies-directory
- `((setq org-roam-dailies-directory
- ,org-roam-dailies-directory))
- '()))
-
(let ((map mode-specific-map))
- (define-key map (kbd "n t") 'org-roam-dailies-goto-today)
- (define-key map (kbd "n y") 'org-roam-dailies-goto-yesterday)
- (define-key map (kbd "n m") 'org-roam-dailies-goto-tomorrow)
- (define-key map (kbd "n d") 'org-roam-dailies-goto-date)
- (define-key map (kbd "n c t") 'org-roam-dailies-capture-today)
- (define-key map (kbd "n c y") 'org-roam-dailies-capture-yesterday)
- (define-key map (kbd "n c m") 'org-roam-dailies-capture-tomorrow)
- (define-key map (kbd "n c d") 'org-roam-dailies-capture-date)
+ ,@(if org-roam-dailies-directory
+ `((define-key map (kbd "n t") 'org-roam-dailies-goto-today)
+ (define-key map (kbd "n y") 'org-roam-dailies-goto-yesterday)
+ (define-key map (kbd "n m") 'org-roam-dailies-goto-tomorrow)
+ (define-key map (kbd "n d") 'org-roam-dailies-goto-date)
+ (define-key map (kbd "n c t") 'org-roam-dailies-capture-today)
+ (define-key map (kbd "n c y")
+ 'org-roam-dailies-capture-yesterday)
+ (define-key map (kbd "n c m")
+ 'org-roam-dailies-capture-tomorrow)
+ (define-key map (kbd "n c d") 'org-roam-dailies-capture-date))
+ '())
(define-key map (kbd "n n") 'org-roam-buffer-toggle)
(define-key map (kbd "n f") 'org-roam-node-find)
(define-key map (kbd "n i") 'org-roam-node-insert)
@@ -4618,17 +4629,17 @@ Knowlede base, note-taking set up and ready"
Set roam directory, basic keybindings, reasonable defaults and adjust
marginalia annotations."
#:keywords '(convenience org-mode roam knowledgebase)
- #:elisp-packages (append
- (list emacs-org-roam)
- (or (and=> (get-value 'emacs-embark config) list)
- '())
- (or (and=> (get-value 'emacs-org-recur config)
- list)
- '())))))
+ #:elisp-packages
+ (append (list emacs-org-roam-package)
+ (or (and=> (get-value 'emacs-embark config) list)
+ '())
+ (or (and=> (get-value 'emacs-org-recur config)
+ list)
+ '())))))
(feature
(name f-name)
- (values `((,f-name . #t)
+ (values `((,f-name . ,emacs-org-roam-package)
(org-roam-todo? . ,org-roam-todo?)))
(home-services-getter get-home-services)))
@@ -4722,7 +4733,12 @@ citar-org-roam-subdir if org-roam is enabled."
'(convenience org-mode org-cite citar references roam knowledgebase)
#:elisp-packages
(append
- (if (get-value 'emacs-org-roam config) (list emacs-citar-org-roam) '())
+ (if (get-value 'emacs-org-roam config)
+ (list
+ (package/inherit emacs-citar-org-roam
+ (propagated-inputs (list (get-value 'emacs-org-roam config)
+ emacs-citar))))
+ '())
(or (and=> emacs-all-the-icons list) '())
(list emacs-citar)))))
--
2.41.0
[PATCH v2 2/6] rde: Add feature-emacs-org-dynamic-agenda.
---
src/rde/features/emacs-xyz.scm | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)
diff --git a/src/rde/features/emacs-xyz.scm b/src/rde/features/emacs-xyz.scm
index 02b9bc81..9c5e8ecc 100644
--- a/src/rde/features/emacs-xyz.scm
+++ b/src/rde/features/emacs-xyz.scm
@@ -111,6 +111,7 @@
feature-emacs-org
feature-emacs-org-roam
feature-emacs-org-agenda
+ feature-emacs-org-dynamic-agenda
feature-emacs-citar
feature-emacs-org-protocol
feature-emacs-spelling
@@ -4448,6 +4449,32 @@ If NODE doesn't exist, create a new org-roam node with REF."
(add-hook 'before-save-hook 'rde-org-roam-update-todo-tag)
(advice-add 'org-agenda :before 'rde-org-roam-update-todo-files)))
+ (define* (feature-emacs-org-dynamic-agenda
+ #:key
+ (emacs-org-dynamic-agenda emacs-org-dynamic-agenda))
+ "Configure org-dynamic-agenda for GNU Emacs."
+ (ensure-pred file-like? emacs-org-dynamic-agenda)
+
+ (define emacs-f-name 'org-dynamic-agenda)
+ (define f-name (symbol-append 'emacs- emacs-f-name))
+
+ (define (get-home-services config)
+ (list
+ (rde-elisp-configuration-service
+ emacs-f-name
+ config
+ `((require 'org-dynamic-agenda))
+ #:summary "\
+ Org dynamic agenda"
+ #:commentary ""
+ #:keywords '(convenience)
+ #:elisp-packages (list emacs-org-dynamic-agenda))))
+
+ (feature
+ (name f-name)
+ (values `((,f-name . #t)))
+ (home-services-getter get-home-services)))
+
;; TODO: rewrite to states
(define* (feature-emacs-org-roam
#:key
--
2.41.0
[PATCH v2 3/6] feature: emacs-org-agenda: maybe-path-or-list? for org-agenda-files.
---
src/rde/features/emacs-xyz.scm | 4 +++ -
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/rde/features/emacs-xyz.scm b/src/rde/features/emacs-xyz.scm
index 9c5e8ecc..6c978980 100644
--- a/src/rde/features/emacs-xyz.scm
+++ b/src/rde/features/emacs-xyz.scm
@@ -4255,7 +4255,9 @@ Indentation and refile configurations, visual adjustment."
(org-agenda-prefix-format '())
(org-agenda-appt? #f))
"Configure org-agenda for GNU Emacs."
- (ensure-pred maybe-list? org-agenda-files)
+ (define (maybe-path-or-list? elt)
+ (or (maybe-path? elt) (maybe-list? elt)))
+ (ensure-pred maybe-path-or-list? org-agenda-files)
(ensure-pred list? org-agenda-custom-commands)
(ensure-pred maybe-list? org-agenda-prefix-format)
(ensure-pred boolean? org-agenda-appt?)
--
2.41.0
[PATCH v2 4/6] rde: Add feature-emacs-org-ql.
---
src/rde/features/emacs-xyz.scm | 30 ++++++++++++++++++++++++++++++
1 file changed, 30 insertions(+)
diff --git a/src/rde/features/emacs-xyz.scm b/src/rde/features/emacs-xyz.scm
index 6c978980..0463a98a 100644
--- a/src/rde/features/emacs-xyz.scm
+++ b/src/rde/features/emacs-xyz.scm
@@ -111,6 +111,7 @@
feature-emacs-org
feature-emacs-org-roam
feature-emacs-org-agenda
+ feature-emacs-org-ql
feature-emacs-org-dynamic-agenda
feature-emacs-citar
feature-emacs-org-protocol
@@ -4451,6 +4452,35 @@ If NODE doesn't exist, create a new org-roam node with REF."
(add-hook 'before-save-hook 'rde-org-roam-update-todo-tag)
(advice-add 'org-agenda :before 'rde-org-roam-update-todo-files)))
+ (define* (feature-emacs-org-ql
+ #:key
+ (emacs-org-ql emacs-org-ql))
+ "Configure org-ql for GNU Emacs."
+ (ensure-pred file-like? emacs-org-ql)
+
+ (define emacs-f-name 'org-ql)
+ (define f-name (symbol-append 'emacs- emacs-f-name))
+
+ (define (get-home-services config)
+ (list
+ (rde-elisp-configuration-service
+ emacs-f-name
+ config
+ `()
+ #:summary "\
+ An Org-mode query language, including search commands and saved views"
+ #:commentary "\
+ This package provides a query language for Org files. It offers two syntax
+ styles: Lisp-like sexps and search engine-like keywords. Currently this
+ package is unconfigured but it plays along with emacs-org-dynamic-agenda."
+ #:keywords '(convenience)
+ #:elisp-packages (list emacs-org-ql))))
+
+ (feature
+ (name f-name)
+ (values `((,f-name . #t)))
+ (home-services-getter get-home-services)))
+
(define* (feature-emacs-org-dynamic-agenda
#:key
(emacs-org-dynamic-agenda emacs-org-dynamic-agenda))
--
2.41.0
[PATCH v2 5/6] feature: emacs-org-dynamic-agenda: Properly integrate with org-ql.
---
src/rde/features/emacs-xyz.scm | 19 ++++++++++++++ -----
1 file changed, 14 insertions(+), 5 deletions(-)
diff --git a/src/rde/features/emacs-xyz.scm b/src/rde/features/emacs-xyz.scm
index 0463a98a..74bbdf7a 100644
--- a/src/rde/features/emacs-xyz.scm
+++ b/src/rde/features/emacs-xyz.scm
@@ -4483,9 +4483,11 @@ package is unconfigured but it plays along with emacs-org-dynamic-agenda."
(define* (feature-emacs-org-dynamic-agenda
#:key
- (emacs-org-dynamic-agenda emacs-org-dynamic-agenda))
- "Configure org-dynamic-agenda for GNU Emacs."
+ (emacs-org-dynamic-agenda emacs-org-dynamic-agenda)
+ (emacs-org-ql-dynamic-agenda emacs-org-ql-dynamic-agenda))
+ "Configure org-dynamic-agenda or org-ql-dynamic-agenda for GNU Emacs."
(ensure-pred file-like? emacs-org-dynamic-agenda)
+ (ensure-pred file-like? emacs-org-ql-dynamic-agenda)
(define emacs-f-name 'org-dynamic-agenda)
(define f-name (symbol-append 'emacs- emacs-f-name))
@@ -4495,12 +4497,19 @@ package is unconfigured but it plays along with emacs-org-dynamic-agenda."
(rde-elisp-configuration-service
emacs-f-name
config
- `((require 'org-dynamic-agenda))
+ `(,@(if (get-value 'emacs-org-ql config)
+ '((require 'org-ql-dynamic-agenda)
+ (setq org-agenda-include-diary nil))
+ '((require 'org-dynamic-agenda))))
#:summary "\
Org dynamic agenda"
- #:commentary ""
+ #:commentary "\
+ This hook records files that should be saved as agenda-files, making the refreshing
+ and loading of org-agenda faster (and even faster with org-ql cache)."
#:keywords '(convenience)
- #:elisp-packages (list emacs-org-dynamic-agenda))))
+ #:elisp-packages (list (if (get-value 'emacs-org-ql config)
+ emacs-org-ql-dynamic-agenda
+ emacs-org-dynamic-agenda)))))
(feature
(name f-name)
--
2.41.0
[PATCH v2 6/6] rde: Add feature emacs-org-dailies.
---
src/rde/features/emacs-xyz.scm | 68 ++++++++++++++++++++++++++++ ------
1 file changed, 57 insertions(+), 11 deletions(-)
diff --git a/src/rde/features/emacs-xyz.scm b/src/rde/features/emacs-xyz.scm
index 74bbdf7a..140b981c 100644
--- a/src/rde/features/emacs-xyz.scm
+++ b/src/rde/features/emacs-xyz.scm
@@ -113,6 +113,7 @@
feature-emacs-org-agenda
feature-emacs-org-ql
feature-emacs-org-dynamic-agenda
+ feature-emacs-org-dailies
feature-emacs-citar
feature-emacs-org-protocol
feature-emacs-spelling
@@ -4516,33 +4517,74 @@ and loading of org-agenda faster (and even faster with org-ql cache)."
(values `((,f-name . #t)))
(home-services-getter get-home-services)))
+ (define* (feature-emacs-org-dailies
+ #:key
+ (emacs-org-dailies emacs-org-dailies)
+ (org-dailies-directory "daily/")
+ (org-dailies-capture-templates #f))
+ "Configure org-dailies for GNU Emacs."
+ (ensure-pred file-like? emacs-org-dailies)
+ (ensure-pred maybe-path? org-dailies-directory)
+ (ensure-pred maybe-list? org-dailies-capture-templates)
+
+ (define emacs-f-name 'org-dailies)
+ (define f-name (symbol-append 'emacs- emacs-f-name))
+
+ (define (get-home-services config)
+ (when (and (not (get-value 'org-roam-dailies? config))
+ org-dailies-capture-templates)
+ (raise
+ (formatted-message
+ (G_ "org-dailies package does't handle capture templates for now."))))
+ (list
+ (rde-elisp-configuration-service
+ emacs-f-name
+ config
+ `(,@(if (get-value 'org-roam-dailies? config)
+ '()
+ `((require 'org-dailies)
+ (setq org-dailies-directory ,org-dailies-directory))))
+ #:summary "Daily journaling functionality for Emacs"
+ #:commentary "\
+ This feature configure daily journaling functionality, either with org-roam-dailies,
+ or with a org-roam-less copy of the package."
+ #:keywords '(convenience)
+ #:elisp-packages (if (get-value 'org-roam-dailies? config)
+ '()
+ (list emacs-org-dailies)))))
+
+ (feature
+ (name f-name)
+ (values `((,f-name . #t)
+ (org-dailies-directory . ,org-dailies-directory)
+ (org-dailies-capture-templates . ,org-dailies-capture-templates)))
+ (home-services-getter get-home-services)))
+
;; TODO: rewrite to states
(define* (feature-emacs-org-roam
#:key
(emacs-org-roam emacs-org-roam)
(org-roam-directory #f)
- (org-roam-dailies-directory #f)
(org-roam-capture-templates #f)
- (org-roam-dailies-capture-templates #f)
(org-roam-file-exclude-regexp #f)
(org-roam-todo? #f)
+ (org-roam-dailies? #f)
(use-node-types? #t))
"Configure org-roam for GNU Emacs."
(ensure-pred file-like? emacs-org-roam)
(define (not-boolean? x) (not (boolean? x)))
(ensure-pred not-boolean? org-roam-directory)
- (ensure-pred maybe-path? org-roam-dailies-directory)
(ensure-pred maybe-list? org-roam-capture-templates)
(ensure-pred boolean? use-node-types?)
- (ensure-pred maybe-list? org-roam-dailies-capture-templates)
(ensure-pred maybe-list? org-roam-file-exclude-regexp)
(ensure-pred boolean? org-roam-todo?)
+ (ensure-pred boolean? org-roam-dailies?)
(define emacs-f-name 'org-roam)
(define f-name (symbol-append 'emacs- emacs-f-name))
(define emacs-org-roam-package
- (if org-roam-dailies-directory
+ (if org-roam-dailies?
emacs-org-roam
(package/inherit emacs-org-roam
(source (origin (inherit (package-source emacs-org-roam))
@@ -4550,6 +4592,7 @@ and loading of org-agenda faster (and even faster with org-ql cache)."
'(delete-file "extensions/org-roam-dailies.el")))))))
(define (get-home-services config)
+ (if org-roam-dailies? (require-value 'org-dailies-directory config))
(list
(rde-elisp-configuration-service
emacs-f-name
@@ -4625,7 +4668,7 @@ the node, relative to `org-roam-directory'."
(define-key map (kbd "C-c r a") 'org-roam-alias-add)
(define-key map (kbd "C-c r A") 'org-roam-alias-remove)
(define-key map (kbd "C-c r O") 'rde-org-roam-open-ref)
- ,@(if org-roam-dailies-directory
+ ,@(if org-roam-dailies?
`((define-key map (kbd "C-c n N")
'org-roam-dailies-goto-next-note)
(define-key map (kbd "C-c n P")
@@ -4636,14 +4679,16 @@ the node, relative to `org-roam-directory'."
`((setq org-roam-capture-templates ',org-roam-capture-templates))
'())
- ,@(if org-roam-dailies-directory
+ ,@(if org-roam-dailies?
`((with-eval-after-load 'org-roam-dailies
- ,@(if org-roam-dailies-capture-templates
+ ,@(if org-dailies-capture-templates
`((setq org-roam-dailies-capture-templates
- ',org-roam-dailies-capture-templates))
+ ',(get-value
+ 'org-dailies-capture-templates
+ config)))
'())
(setq org-roam-dailies-directory
- ,org-roam-dailies-directory)))
+ ,(get-value 'org-dailies-directory config))))
'()))
,@(if org-roam-file-exclude-regexp
@@ -4673,7 +4718,7 @@ the node, relative to `org-roam-directory'."
'())
(let ((map mode-specific-map))
- ,@(if org-roam-dailies-directory
+ ,@(if org-roam-dailies?
`((define-key map (kbd "n t") 'org-roam-dailies-goto-today)
(define-key map (kbd "n y") 'org-roam-dailies-goto-yesterday)
(define-key map (kbd "n m") 'org-roam-dailies-goto-tomorrow)
@@ -4708,6 +4753,7 @@ marginalia annotations."
(feature
(name f-name)
(values `((,f-name . ,emacs-org-roam-package)
+ (org-roam-dailies? . ,org-roam-dailies?)
(org-roam-todo? . ,org-roam-todo?)))
(home-services-getter get-home-services)))
--
2.41.0
Re: [PATCH v2 1/6] feature: emacs-org-roam: Avoid loading org-roam-dailies if not used.
On 2023-09-05 12:08, Nicolas Graves wrote:
> This commit:
> - deletes the duplicate org-roam-dailies-directory declaration.
> - assumes that if org-roam-dailies-directory is not set, then the user doesn't
> use it and there's no need to load the extension.
> - solves the conflict between org-roam and citar-org-roam packages is the user
> enters an org-roam-package.
It's better to send independent patches separately (the chance of review
and merge is much higher).
> ---
> src/rde/features/emacs-xyz.scm | 78 ++++++++++++++++++++--------------
> 1 file changed, 47 insertions(+), 31 deletions(-)
>
> diff --git a/src/rde/features/emacs-xyz.scm b/src/rde/features/emacs-xyz.scm
> index b04879b3..02b9bc81 100644
> --- a/src/rde/features/emacs-xyz.scm
> +++ b/src/rde/features/emacs-xyz.scm
> @@ -4473,6 +4473,14 @@ If NODE doesn't exist, create a new org-roam node with REF."
> (define emacs-f-name 'org-roam)
> (define f-name (symbol-append 'emacs- emacs-f-name))
>
> + (define emacs-org-roam-package
> + (if org-roam-dailies-directory
> + emacs-org-roam
> + (package/inherit emacs-org-roam
> + (source (origin (inherit (package-source emacs-org-roam))
> + (snippet
> + '(delete-file "extensions/org-roam-dailies.el")))))))
> +
> (define (get-home-services config)
> (list
> (rde-elisp-configuration-service
> @@ -4549,16 +4557,25 @@ the node, relative to `org-roam-directory'."
> (define-key map (kbd "C-c r a") 'org-roam-alias-add)
> (define-key map (kbd "C-c r A") 'org-roam-alias-remove)
> (define-key map (kbd "C-c r O") 'rde-org-roam-open-ref)
> - (define-key map (kbd "C-c n N") 'org-roam-dailies-goto-next-note)
> - (define-key map (kbd "C-c n P")
> - 'org-roam-dailies-goto-previous-note)))
> + ,@(if org-roam-dailies-directory
> + `((define-key map (kbd "C-c n N")
> + 'org-roam-dailies-goto-next-note)
> + (define-key map (kbd "C-c n P")
> + 'org-roam-dailies-goto-previous-note))
> + '())))
>
> ,@(if org-roam-capture-templates
> `((setq org-roam-capture-templates ',org-roam-capture-templates))
> '())
>
> ,@(if org-roam-dailies-directory
> - `((setq org-roam-dailies-directory ,org-roam-dailies-directory))
> + `((with-eval-after-load 'org-roam-dailies
> + ,@(if org-roam-dailies-capture-templates
> + `((setq org-roam-dailies-capture-templates
> + ',org-roam-dailies-capture-templates))
> + '())
> + (setq org-roam-dailies-directory
> + ,org-roam-dailies-directory)))
> '()))
>
> ,@(if org-roam-file-exclude-regexp
> @@ -4587,25 +4604,19 @@ the node, relative to `org-roam-directory'."
> '())))
> '())
>
> - (with-eval-after-load 'org-roam-dailies
> - ,@(if org-roam-dailies-capture-templates
> - `((setq org-roam-dailies-capture-templates
> - ',org-roam-dailies-capture-templates))
> - '())
> - ,@(if org-roam-dailies-directory
> - `((setq org-roam-dailies-directory
> - ,org-roam-dailies-directory))
> - '()))
> -
> (let ((map mode-specific-map))
> - (define-key map (kbd "n t") 'org-roam-dailies-goto-today)
> - (define-key map (kbd "n y") 'org-roam-dailies-goto-yesterday)
> - (define-key map (kbd "n m") 'org-roam-dailies-goto-tomorrow)
> - (define-key map (kbd "n d") 'org-roam-dailies-goto-date)
> - (define-key map (kbd "n c t") 'org-roam-dailies-capture-today)
> - (define-key map (kbd "n c y") 'org-roam-dailies-capture-yesterday)
> - (define-key map (kbd "n c m") 'org-roam-dailies-capture-tomorrow)
> - (define-key map (kbd "n c d") 'org-roam-dailies-capture-date)
> + ,@(if org-roam-dailies-directory
> + `((define-key map (kbd "n t") 'org-roam-dailies-goto-today)
> + (define-key map (kbd "n y") 'org-roam-dailies-goto-yesterday)
> + (define-key map (kbd "n m") 'org-roam-dailies-goto-tomorrow)
> + (define-key map (kbd "n d") 'org-roam-dailies-goto-date)
> + (define-key map (kbd "n c t") 'org-roam-dailies-capture-today)
> + (define-key map (kbd "n c y")
> + 'org-roam-dailies-capture-yesterday)
> + (define-key map (kbd "n c m")
> + 'org-roam-dailies-capture-tomorrow)
> + (define-key map (kbd "n c d") 'org-roam-dailies-capture-date))
> + '())
> (define-key map (kbd "n n") 'org-roam-buffer-toggle)
> (define-key map (kbd "n f") 'org-roam-node-find)
> (define-key map (kbd "n i") 'org-roam-node-insert)
> @@ -4618,17 +4629,17 @@ Knowlede base, note-taking set up and ready"
> Set roam directory, basic keybindings, reasonable defaults and adjust
> marginalia annotations."
> #:keywords '(convenience org-mode roam knowledgebase)
> - #:elisp-packages (append
> - (list emacs-org-roam)
> - (or (and=> (get-value 'emacs-embark config) list)
> - '())
> - (or (and=> (get-value 'emacs-org-recur config)
> - list)
> - '())))))
> + #:elisp-packages
> + (append (list emacs-org-roam-package)
> + (or (and=> (get-value 'emacs-embark config) list)
> + '())
> + (or (and=> (get-value 'emacs-org-recur config)
> + list)
> + '())))))
>
> (feature
> (name f-name)
> - (values `((,f-name . #t)
> + (values `((,f-name . ,emacs-org-roam-package)
> (org-roam-todo? . ,org-roam-todo?)))
> (home-services-getter get-home-services)))
>
> @@ -4722,7 +4733,12 @@ citar-org-roam-subdir if org-roam is enabled."
> '(convenience org-mode org-cite citar references roam knowledgebase)
> #:elisp-packages
> (append
> - (if (get-value 'emacs-org-roam config) (list emacs-citar-org-roam) '())
> + (if (get-value 'emacs-org-roam config)
> + (list
> + (package/inherit emacs-citar-org-roam
> + (propagated-inputs (list (get-value 'emacs-org-roam config)
> + emacs-citar))))
> + '())
> (or (and=> emacs-all-the-icons list) '())
> (list emacs-citar)))))
--
Best regards,
Andrew Tropin
Re: [PATCH v2 1/6] feature: emacs-org-roam: Avoid loading org-roam-dailies if not used.
On 2023-09-05 12:08, Nicolas Graves wrote:
> This commit:
> - deletes the duplicate org-roam-dailies-directory declaration.
> - assumes that if org-roam-dailies-directory is not set, then the user doesn't
> use it and there's no need to load the extension.
> - solves the conflict between org-roam and citar-org-roam packages is the user
> enters an org-roam-package.
> ---
> src/rde/features/emacs-xyz.scm | 78 ++++++++++++++++++++--------------
> 1 file changed, 47 insertions(+), 31 deletions(-)
>
> diff --git a/src/rde/features/emacs-xyz.scm b/src/rde/features/emacs-xyz.scm
> index b04879b3..02b9bc81 100644
> --- a/src/rde/features/emacs-xyz.scm
> +++ b/src/rde/features/emacs-xyz.scm
> @@ -4473,6 +4473,14 @@ If NODE doesn't exist, create a new org-roam node with REF."
> (define emacs-f-name 'org-roam)
> (define f-name (symbol-append 'emacs- emacs-f-name))
>
> + (define emacs-org-roam-package
> + (if org-roam-dailies-directory
> + emacs-org-roam
> + (package/inherit emacs-org-roam
> + (source (origin (inherit (package-source emacs-org-roam))
> + (snippet
> + '(delete-file "extensions/org-roam-dailies.el")))))))
> +
> (define (get-home-services config)
> (list
> (rde-elisp-configuration-service
> @@ -4549,16 +4557,25 @@ the node, relative to `org-roam-directory'."
> (define-key map (kbd "C-c r a") 'org-roam-alias-add)
> (define-key map (kbd "C-c r A") 'org-roam-alias-remove)
> (define-key map (kbd "C-c r O") 'rde-org-roam-open-ref)
> - (define-key map (kbd "C-c n N") 'org-roam-dailies-goto-next-note)
> - (define-key map (kbd "C-c n P")
> - 'org-roam-dailies-goto-previous-note)))
> + ,@(if org-roam-dailies-directory
> + `((define-key map (kbd "C-c n N")
> + 'org-roam-dailies-goto-next-note)
> + (define-key map (kbd "C-c n P")
> + 'org-roam-dailies-goto-previous-note))
> + '())))
>
> ,@(if org-roam-capture-templates
> `((setq org-roam-capture-templates ',org-roam-capture-templates))
> '())
>
> ,@(if org-roam-dailies-directory
> - `((setq org-roam-dailies-directory ,org-roam-dailies-directory))
> + `((with-eval-after-load 'org-roam-dailies
> + ,@(if org-roam-dailies-capture-templates
> + `((setq org-roam-dailies-capture-templates
> + ',org-roam-dailies-capture-templates))
> + '())
> + (setq org-roam-dailies-directory
> + ,org-roam-dailies-directory)))
> '()))
>
> ,@(if org-roam-file-exclude-regexp
> @@ -4587,25 +4604,19 @@ the node, relative to `org-roam-directory'."
> '())))
> '())
>
> - (with-eval-after-load 'org-roam-dailies
> - ,@(if org-roam-dailies-capture-templates
> - `((setq org-roam-dailies-capture-templates
> - ',org-roam-dailies-capture-templates))
> - '())
> - ,@(if org-roam-dailies-directory
> - `((setq org-roam-dailies-directory
> - ,org-roam-dailies-directory))
> - '()))
> -
> (let ((map mode-specific-map))
> - (define-key map (kbd "n t") 'org-roam-dailies-goto-today)
> - (define-key map (kbd "n y") 'org-roam-dailies-goto-yesterday)
> - (define-key map (kbd "n m") 'org-roam-dailies-goto-tomorrow)
> - (define-key map (kbd "n d") 'org-roam-dailies-goto-date)
> - (define-key map (kbd "n c t") 'org-roam-dailies-capture-today)
> - (define-key map (kbd "n c y") 'org-roam-dailies-capture-yesterday)
> - (define-key map (kbd "n c m") 'org-roam-dailies-capture-tomorrow)
> - (define-key map (kbd "n c d") 'org-roam-dailies-capture-date)
> + ,@(if org-roam-dailies-directory
> + `((define-key map (kbd "n t") 'org-roam-dailies-goto-today)
> + (define-key map (kbd "n y") 'org-roam-dailies-goto-yesterday)
> + (define-key map (kbd "n m") 'org-roam-dailies-goto-tomorrow)
> + (define-key map (kbd "n d") 'org-roam-dailies-goto-date)
> + (define-key map (kbd "n c t") 'org-roam-dailies-capture-today)
> + (define-key map (kbd "n c y")
> + 'org-roam-dailies-capture-yesterday)
> + (define-key map (kbd "n c m")
> + 'org-roam-dailies-capture-tomorrow)
> + (define-key map (kbd "n c d") 'org-roam-dailies-capture-date))
> + '())
> (define-key map (kbd "n n") 'org-roam-buffer-toggle)
> (define-key map (kbd "n f") 'org-roam-node-find)
> (define-key map (kbd "n i") 'org-roam-node-insert)
> @@ -4618,17 +4629,17 @@ Knowlede base, note-taking set up and ready"
> Set roam directory, basic keybindings, reasonable defaults and adjust
> marginalia annotations."
> #:keywords '(convenience org-mode roam knowledgebase)
> - #:elisp-packages (append
> - (list emacs-org-roam)
> - (or (and=> (get-value 'emacs-embark config) list)
> - '())
> - (or (and=> (get-value 'emacs-org-recur config)
> - list)
> - '())))))
> + #:elisp-packages
> + (append (list emacs-org-roam-package)
> + (or (and=> (get-value 'emacs-embark config) list)
> + '())
> + (or (and=> (get-value 'emacs-org-recur config)
> + list)
> + '())))))
>
> (feature
> (name f-name)
> - (values `((,f-name . #t)
> + (values `((,f-name . ,emacs-org-roam-package)
> (org-roam-todo? . ,org-roam-todo?)))
> (home-services-getter get-home-services)))
>
> @@ -4722,7 +4733,12 @@ citar-org-roam-subdir if org-roam is enabled."
> '(convenience org-mode org-cite citar references roam knowledgebase)
> #:elisp-packages
> (append
> - (if (get-value 'emacs-org-roam config) (list emacs-citar-org-roam) '())
> + (if (get-value 'emacs-org-roam config)
> + (list
> + (package/inherit emacs-citar-org-roam
> + (propagated-inputs (list (get-value 'emacs-org-roam config)
> + emacs-citar))))
> + '())
> (or (and=> emacs-all-the-icons list) '())
> (list emacs-citar)))))
Hi Nicolas!
This patch doesn't apply on the latest master.
Also, split out citar fixes into separate commit please, it's unrelated
to commit message.
--
Best regards,
Andrew Tropin
Re: [PATCH v2 1/6] feature: emacs-org-roam: Avoid loading org-roam-dailies if not used.
On 2023-09-07 15:51, Andrew Tropin wrote:
> On 2023-09-05 12:08, Nicolas Graves wrote:
>
>> This commit:
>> - deletes the duplicate org-roam-dailies-directory declaration.
>> - assumes that if org-roam-dailies-directory is not set, then the user doesn't
>> use it and there's no need to load the extension.
>> - solves the conflict between org-roam and citar-org-roam packages is the user
>> enters an org-roam-package.
>
> It's better to send independent patches separately (the chance of review
> and merge is much higher).
I've SUPERSEDED the original patch series and split them into two
distinct reworked series and one patch, it should be clearer to review
now.
>
>> ---
>> src/rde/features/emacs-xyz.scm | 78 ++++++++++++++++++++--------------
>> 1 file changed, 47 insertions(+), 31 deletions(-)
>>
>> diff --git a/src/rde/features/emacs-xyz.scm b/src/rde/features/emacs-xyz.scm
>> index b04879b3..02b9bc81 100644
>> --- a/src/rde/features/emacs-xyz.scm
>> +++ b/src/rde/features/emacs-xyz.scm
>> @@ -4473,6 +4473,14 @@ If NODE doesn't exist, create a new org-roam node with REF."
>> (define emacs-f-name 'org-roam)
>> (define f-name (symbol-append 'emacs- emacs-f-name))
>>
>> + (define emacs-org-roam-package
>> + (if org-roam-dailies-directory
>> + emacs-org-roam
>> + (package/inherit emacs-org-roam
>> + (source (origin (inherit (package-source emacs-org-roam))
>> + (snippet
>> + '(delete-file "extensions/org-roam-dailies.el")))))))
>> +
>> (define (get-home-services config)
>> (list
>> (rde-elisp-configuration-service
>> @@ -4549,16 +4557,25 @@ the node, relative to `org-roam-directory'."
>> (define-key map (kbd "C-c r a") 'org-roam-alias-add)
>> (define-key map (kbd "C-c r A") 'org-roam-alias-remove)
>> (define-key map (kbd "C-c r O") 'rde-org-roam-open-ref)
>> - (define-key map (kbd "C-c n N") 'org-roam-dailies-goto-next-note)
>> - (define-key map (kbd "C-c n P")
>> - 'org-roam-dailies-goto-previous-note)))
>> + ,@(if org-roam-dailies-directory
>> + `((define-key map (kbd "C-c n N")
>> + 'org-roam-dailies-goto-next-note)
>> + (define-key map (kbd "C-c n P")
>> + 'org-roam-dailies-goto-previous-note))
>> + '())))
>>
>> ,@(if org-roam-capture-templates
>> `((setq org-roam-capture-templates ',org-roam-capture-templates))
>> '())
>>
>> ,@(if org-roam-dailies-directory
>> - `((setq org-roam-dailies-directory ,org-roam-dailies-directory))
>> + `((with-eval-after-load 'org-roam-dailies
>> + ,@(if org-roam-dailies-capture-templates
>> + `((setq org-roam-dailies-capture-templates
>> + ',org-roam-dailies-capture-templates))
>> + '())
>> + (setq org-roam-dailies-directory
>> + ,org-roam-dailies-directory)))
>> '()))
>>
>> ,@(if org-roam-file-exclude-regexp
>> @@ -4587,25 +4604,19 @@ the node, relative to `org-roam-directory'."
>> '())))
>> '())
>>
>> - (with-eval-after-load 'org-roam-dailies
>> - ,@(if org-roam-dailies-capture-templates
>> - `((setq org-roam-dailies-capture-templates
>> - ',org-roam-dailies-capture-templates))
>> - '())
>> - ,@(if org-roam-dailies-directory
>> - `((setq org-roam-dailies-directory
>> - ,org-roam-dailies-directory))
>> - '()))
>> -
>> (let ((map mode-specific-map))
>> - (define-key map (kbd "n t") 'org-roam-dailies-goto-today)
>> - (define-key map (kbd "n y") 'org-roam-dailies-goto-yesterday)
>> - (define-key map (kbd "n m") 'org-roam-dailies-goto-tomorrow)
>> - (define-key map (kbd "n d") 'org-roam-dailies-goto-date)
>> - (define-key map (kbd "n c t") 'org-roam-dailies-capture-today)
>> - (define-key map (kbd "n c y") 'org-roam-dailies-capture-yesterday)
>> - (define-key map (kbd "n c m") 'org-roam-dailies-capture-tomorrow)
>> - (define-key map (kbd "n c d") 'org-roam-dailies-capture-date)
>> + ,@(if org-roam-dailies-directory
>> + `((define-key map (kbd "n t") 'org-roam-dailies-goto-today)
>> + (define-key map (kbd "n y") 'org-roam-dailies-goto-yesterday)
>> + (define-key map (kbd "n m") 'org-roam-dailies-goto-tomorrow)
>> + (define-key map (kbd "n d") 'org-roam-dailies-goto-date)
>> + (define-key map (kbd "n c t") 'org-roam-dailies-capture-today)
>> + (define-key map (kbd "n c y")
>> + 'org-roam-dailies-capture-yesterday)
>> + (define-key map (kbd "n c m")
>> + 'org-roam-dailies-capture-tomorrow)
>> + (define-key map (kbd "n c d") 'org-roam-dailies-capture-date))
>> + '())
>> (define-key map (kbd "n n") 'org-roam-buffer-toggle)
>> (define-key map (kbd "n f") 'org-roam-node-find)
>> (define-key map (kbd "n i") 'org-roam-node-insert)
>> @@ -4618,17 +4629,17 @@ Knowlede base, note-taking set up and ready"
>> Set roam directory, basic keybindings, reasonable defaults and adjust
>> marginalia annotations."
>> #:keywords '(convenience org-mode roam knowledgebase)
>> - #:elisp-packages (append
>> - (list emacs-org-roam)
>> - (or (and=> (get-value 'emacs-embark config) list)
>> - '())
>> - (or (and=> (get-value 'emacs-org-recur config)
>> - list)
>> - '())))))
>> + #:elisp-packages
>> + (append (list emacs-org-roam-package)
>> + (or (and=> (get-value 'emacs-embark config) list)
>> + '())
>> + (or (and=> (get-value 'emacs-org-recur config)
>> + list)
>> + '())))))
>>
>> (feature
>> (name f-name)
>> - (values `((,f-name . #t)
>> + (values `((,f-name . ,emacs-org-roam-package)
>> (org-roam-todo? . ,org-roam-todo?)))
>> (home-services-getter get-home-services)))
>>
>> @@ -4722,7 +4733,12 @@ citar-org-roam-subdir if org-roam is enabled."
>> '(convenience org-mode org-cite citar references roam knowledgebase)
>> #:elisp-packages
>> (append
>> - (if (get-value 'emacs-org-roam config) (list emacs-citar-org-roam) '())
>> + (if (get-value 'emacs-org-roam config)
>> + (list
>> + (package/inherit emacs-citar-org-roam
>> + (propagated-inputs (list (get-value 'emacs-org-roam config)
>> + emacs-citar))))
>> + '())
>> (or (and=> emacs-all-the-icons list) '())
>> (list emacs-citar)))))
--
Best regards,
Nicolas Graves
Re: [PATCH v2 1/6] feature: emacs-org-roam: Avoid loading org-roam-dailies if not used.
On 2023-09-20 15:05, Nicolas Graves wrote:
> On 2023-09-07 15:51, Andrew Tropin wrote:
>
>> On 2023-09-05 12:08, Nicolas Graves wrote:
>>
>>> This commit:
>>> - deletes the duplicate org-roam-dailies-directory declaration.
>>> - assumes that if org-roam-dailies-directory is not set, then the user doesn't
>>> use it and there's no need to load the extension.
>>> - solves the conflict between org-roam and citar-org-roam packages is the user
>>> enters an org-roam-package.
>>
>> It's better to send independent patches separately (the chance of review
>> and merge is much higher).
>
> I've SUPERSEDED the original patch series and split them into two
> distinct reworked series and one patch, it should be clearer to review
> now.
>
Thank you very much! It's much easier, indeed!
>>
>>> ---
>>> src/rde/features/emacs-xyz.scm | 78 ++++++++++++++++++++--------------
>>> 1 file changed, 47 insertions(+), 31 deletions(-)
>>>
>>> diff --git a/src/rde/features/emacs-xyz.scm b/src/rde/features/emacs-xyz.scm
>>> index b04879b3..02b9bc81 100644
>>> --- a/src/rde/features/emacs-xyz.scm
>>> +++ b/src/rde/features/emacs-xyz.scm
>>> @@ -4473,6 +4473,14 @@ If NODE doesn't exist, create a new org-roam node with REF."
>>> (define emacs-f-name 'org-roam)
>>> (define f-name (symbol-append 'emacs- emacs-f-name))
>>>
>>> + (define emacs-org-roam-package
>>> + (if org-roam-dailies-directory
>>> + emacs-org-roam
>>> + (package/inherit emacs-org-roam
>>> + (source (origin (inherit (package-source emacs-org-roam))
>>> + (snippet
>>> + '(delete-file "extensions/org-roam-dailies.el")))))))
>>> +
>>> (define (get-home-services config)
>>> (list
>>> (rde-elisp-configuration-service
>>> @@ -4549,16 +4557,25 @@ the node, relative to `org-roam-directory'."
>>> (define-key map (kbd "C-c r a") 'org-roam-alias-add)
>>> (define-key map (kbd "C-c r A") 'org-roam-alias-remove)
>>> (define-key map (kbd "C-c r O") 'rde-org-roam-open-ref)
>>> - (define-key map (kbd "C-c n N") 'org-roam-dailies-goto-next-note)
>>> - (define-key map (kbd "C-c n P")
>>> - 'org-roam-dailies-goto-previous-note)))
>>> + ,@(if org-roam-dailies-directory
>>> + `((define-key map (kbd "C-c n N")
>>> + 'org-roam-dailies-goto-next-note)
>>> + (define-key map (kbd "C-c n P")
>>> + 'org-roam-dailies-goto-previous-note))
>>> + '())))
>>>
>>> ,@(if org-roam-capture-templates
>>> `((setq org-roam-capture-templates ',org-roam-capture-templates))
>>> '())
>>>
>>> ,@(if org-roam-dailies-directory
>>> - `((setq org-roam-dailies-directory ,org-roam-dailies-directory))
>>> + `((with-eval-after-load 'org-roam-dailies
>>> + ,@(if org-roam-dailies-capture-templates
>>> + `((setq org-roam-dailies-capture-templates
>>> + ',org-roam-dailies-capture-templates))
>>> + '())
>>> + (setq org-roam-dailies-directory
>>> + ,org-roam-dailies-directory)))
>>> '()))
>>>
>>> ,@(if org-roam-file-exclude-regexp
>>> @@ -4587,25 +4604,19 @@ the node, relative to `org-roam-directory'."
>>> '())))
>>> '())
>>>
>>> - (with-eval-after-load 'org-roam-dailies
>>> - ,@(if org-roam-dailies-capture-templates
>>> - `((setq org-roam-dailies-capture-templates
>>> - ',org-roam-dailies-capture-templates))
>>> - '())
>>> - ,@(if org-roam-dailies-directory
>>> - `((setq org-roam-dailies-directory
>>> - ,org-roam-dailies-directory))
>>> - '()))
>>> -
>>> (let ((map mode-specific-map))
>>> - (define-key map (kbd "n t") 'org-roam-dailies-goto-today)
>>> - (define-key map (kbd "n y") 'org-roam-dailies-goto-yesterday)
>>> - (define-key map (kbd "n m") 'org-roam-dailies-goto-tomorrow)
>>> - (define-key map (kbd "n d") 'org-roam-dailies-goto-date)
>>> - (define-key map (kbd "n c t") 'org-roam-dailies-capture-today)
>>> - (define-key map (kbd "n c y") 'org-roam-dailies-capture-yesterday)
>>> - (define-key map (kbd "n c m") 'org-roam-dailies-capture-tomorrow)
>>> - (define-key map (kbd "n c d") 'org-roam-dailies-capture-date)
>>> + ,@(if org-roam-dailies-directory
>>> + `((define-key map (kbd "n t") 'org-roam-dailies-goto-today)
>>> + (define-key map (kbd "n y") 'org-roam-dailies-goto-yesterday)
>>> + (define-key map (kbd "n m") 'org-roam-dailies-goto-tomorrow)
>>> + (define-key map (kbd "n d") 'org-roam-dailies-goto-date)
>>> + (define-key map (kbd "n c t") 'org-roam-dailies-capture-today)
>>> + (define-key map (kbd "n c y")
>>> + 'org-roam-dailies-capture-yesterday)
>>> + (define-key map (kbd "n c m")
>>> + 'org-roam-dailies-capture-tomorrow)
>>> + (define-key map (kbd "n c d") 'org-roam-dailies-capture-date))
>>> + '())
>>> (define-key map (kbd "n n") 'org-roam-buffer-toggle)
>>> (define-key map (kbd "n f") 'org-roam-node-find)
>>> (define-key map (kbd "n i") 'org-roam-node-insert)
>>> @@ -4618,17 +4629,17 @@ Knowlede base, note-taking set up and ready"
>>> Set roam directory, basic keybindings, reasonable defaults and adjust
>>> marginalia annotations."
>>> #:keywords '(convenience org-mode roam knowledgebase)
>>> - #:elisp-packages (append
>>> - (list emacs-org-roam)
>>> - (or (and=> (get-value 'emacs-embark config) list)
>>> - '())
>>> - (or (and=> (get-value 'emacs-org-recur config)
>>> - list)
>>> - '())))))
>>> + #:elisp-packages
>>> + (append (list emacs-org-roam-package)
>>> + (or (and=> (get-value 'emacs-embark config) list)
>>> + '())
>>> + (or (and=> (get-value 'emacs-org-recur config)
>>> + list)
>>> + '())))))
>>>
>>> (feature
>>> (name f-name)
>>> - (values `((,f-name . #t)
>>> + (values `((,f-name . ,emacs-org-roam-package)
>>> (org-roam-todo? . ,org-roam-todo?)))
>>> (home-services-getter get-home-services)))
>>>
>>> @@ -4722,7 +4733,12 @@ citar-org-roam-subdir if org-roam is enabled."
>>> '(convenience org-mode org-cite citar references roam knowledgebase)
>>> #:elisp-packages
>>> (append
>>> - (if (get-value 'emacs-org-roam config) (list emacs-citar-org-roam) '())
>>> + (if (get-value 'emacs-org-roam config)
>>> + (list
>>> + (package/inherit emacs-citar-org-roam
>>> + (propagated-inputs (list (get-value 'emacs-org-roam config)
>>> + emacs-citar))))
>>> + '())
>>> (or (and=> emacs-all-the-icons list) '())
>>> (list emacs-citar)))))
--
Best regards,
Andrew Tropin