~abcdw/rde-devel

Moving from feature-emacs-citar to feature-emacs-citation v1 APPLIED

More general name seems to serve the purpose of the feature better.

I tried out zotra with docker baked version of zotero translation
server and it works well, I guess it's the most extensive way for
converting urls to bibliographic entries at the moment, so I will try
to package zotra-cli and translation server in next couple of weeks.

Also, there are a couple more improvements for the feature in latest
commits:
https://git.sr.ht/~abcdw/rde/commit/4707685d1556f5dfd52d6732e0216f05621239bf
https://git.sr.ht/~abcdw/rde/commit/2107a570c47da02341e8387a4f06f73844afee38

Andrew Tropin (3):
  rde: emacs-xyz: Rename emacs-citar to emacs-citation
  rde: emacs-citation: Add emacs-zotra
  rde: emacs-citation: Set citar-notes-paths to #f by default

 src/rde/features/emacs-xyz.scm | 32 ++++++++++++++++++++++++++------
 1 file changed, 26 insertions(+), 6 deletions(-)

-- 
2.41.0
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~abcdw/rde-devel/patches/44745/mbox | git am -3
Learn more about email & git

[PATCH 1/3] rde: emacs-xyz: Rename emacs-citar to emacs-citation Export this patch

The feature configures not only citar, so it make sense to use more generic
name.
---
 src/rde/features/emacs-xyz.scm | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/rde/features/emacs-xyz.scm b/src/rde/features/emacs-xyz.scm
index 5ca0967e..5d19dd46 100644
--- a/src/rde/features/emacs-xyz.scm
+++ b/src/rde/features/emacs-xyz.scm
@@ -40,6 +40,7 @@
  #:use-module (rde serializers elisp)

  #:use-module (guix gexp)
  #:use-module (guix deprecation)
  #:use-module (rde gexp)
  #:use-module (guix packages)
  #:use-module (guix diagnostics)
@@ -107,6 +108,7 @@
            feature-emacs-org
            feature-emacs-org-roam
            feature-emacs-org-agenda
            feature-emacs-citation
            feature-emacs-citar
            feature-emacs-org-protocol
            feature-emacs-spelling
@@ -4528,7 +4530,7 @@ marginalia annotations."
             (org-roam-todo? . ,org-roam-todo?)))
   (home-services-getter get-home-services)))

(define* (feature-emacs-citar
(define* (feature-emacs-citation
          #:key
          (emacs-citar emacs-citar)
          (emacs-citar-org-roam emacs-citar-org-roam)
@@ -4536,7 +4538,8 @@ marginalia annotations."
          (citar-library-paths (list "~/docs/library"))
          (citar-notes-paths (list "~/docs/bib/notes"))
          (global-bibliography (list "~/docs/bib/biblio.bib")))
  "Configure org-cite and citar for GNU Emacs."
  "Configure org-cite, citar, and other packages related to bibliography and
citation management for GNU Emacs."
  (define (bibtex-dialect? x)
    (member x '(bibtex biblatex)))
  (ensure-pred file-like? emacs-citar)
@@ -4633,6 +4636,8 @@ defaults."
   (values `((,f-name . ,emacs-citar)))
   (home-services-getter get-home-services)))

(define-deprecated/alias feature-emacs-citar feature-emacs-citation)

(define* (feature-emacs-org-protocol)
  "Setup and configure Org-Protocol for Emacs."

-- 
2.41.0

[PATCH 2/3] rde: emacs-citation: Add emacs-zotra Export this patch

---
 src/rde/features/emacs-xyz.scm | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/src/rde/features/emacs-xyz.scm b/src/rde/features/emacs-xyz.scm
index 5d19dd46..816b72e6 100644
--- a/src/rde/features/emacs-xyz.scm
+++ b/src/rde/features/emacs-xyz.scm
@@ -4534,6 +4534,7 @@ marginalia annotations."
          #:key
          (emacs-citar emacs-citar)
          (emacs-citar-org-roam emacs-citar-org-roam)
          (emacs-zotra emacs-zotra)
          (bibtex-dialect 'biblatex)
          (citar-library-paths (list "~/docs/library"))
          (citar-notes-paths (list "~/docs/bib/notes"))
@@ -4544,6 +4545,7 @@ citation management for GNU Emacs."
    (member x '(bibtex biblatex)))
  (ensure-pred file-like? emacs-citar)
  (ensure-pred file-like? emacs-citar-org-roam)
  (ensure-pred file-like? emacs-zotra)
  (ensure-pred list? citar-library-paths)
  (ensure-pred list? citar-notes-paths)
  (ensure-pred list? global-bibliography)
@@ -4566,6 +4568,18 @@ citation management for GNU Emacs."

        (with-eval-after-load 'bibtex
          (setq bibtex-dialect ',bibtex-dialect))
        (autoload 'zotra-add-entry-from-url "zotra" "" t)
        (autoload 'zotra-add-entry-from-search "zotra" "" t)
        (with-eval-after-load 'zotra
          ;;  This is not a self-contained solution.

          ;; TODO: [Andrew Tropin, 2023-09-14] Need to package
          ;; translation-server and zotra-cli
          (setq zotra-url-retrieve-timeout 10)
          (setq zotra-backend 'curl_translation-server)
          (setq zotra-default-entry-format ,(symbol->string bibtex-dialect))
          (setq zotra-default-bibliography ,(car global-bibliography)))

        (with-eval-after-load 'oc
          (require 'oc-csl)
          (setq org-cite-global-bibliography (list ,@global-bibliography))
@@ -4629,7 +4643,7 @@ defaults."
      (append
       (if (get-value 'emacs-org-roam config) (list emacs-citar-org-roam) '())
       (or (and=> emacs-all-the-icons list) '())
       (list emacs-citar)))))
       (list emacs-citar emacs-zotra)))))

  (feature
   (name f-name)
-- 
2.41.0

[PATCH 3/3] rde: emacs-citation: Set citar-notes-paths to #f by default Export this patch

---
 src/rde/features/emacs-xyz.scm | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/src/rde/features/emacs-xyz.scm b/src/rde/features/emacs-xyz.scm
index 816b72e6..555eb37f 100644
--- a/src/rde/features/emacs-xyz.scm
+++ b/src/rde/features/emacs-xyz.scm
@@ -4537,7 +4537,7 @@ marginalia annotations."
          (emacs-zotra emacs-zotra)
          (bibtex-dialect 'biblatex)
          (citar-library-paths (list "~/docs/library"))
          (citar-notes-paths (list "~/docs/bib/notes"))
          (citar-notes-paths #f)
          (global-bibliography (list "~/docs/bib/biblio.bib")))
  "Configure org-cite, citar, and other packages related to bibliography and
citation management for GNU Emacs."
@@ -4547,7 +4547,7 @@ citation management for GNU Emacs."
  (ensure-pred file-like? emacs-citar-org-roam)
  (ensure-pred file-like? emacs-zotra)
  (ensure-pred list? citar-library-paths)
  (ensure-pred list? citar-notes-paths)
  (ensure-pred maybe-list? citar-notes-paths)
  (ensure-pred list? global-bibliography)
  (ensure-pred bibtex-dialect? bibtex-dialect)

@@ -4609,7 +4609,8 @@ citation management for GNU Emacs."
                                  :v-adjust 0.01) . " "))))
                '())
          (setq citar-library-paths (list ,@citar-library-paths))
          (setq citar-notes-paths (list ,@citar-notes-paths))
          (setq citar-notes-paths
                ,(if citar-notes-paths `(list ,@citar-notes-paths) 'nil))
          (setq citar-bibliography org-cite-global-bibliography))

        (autoload 'citar-embark-mode "citar-embark")
-- 
2.41.0