[bug#76699,3/5] Remove dash dependency, introduce llama library

Message ID 20250303020932.4194-3-ngraves@ngraves.fr
State New
Headers
Series None |

Commit Message

Nicolas Graves March 3, 2025, 2:09 a.m. UTC
  ---
 configure.ac                | 16 ++++++++--------
 doc/emacs-guix.texi         |  8 ++++----
 elisp/guix-help.el          |  1 -
 elisp/guix-repl.el          |  6 +++---
 elisp/guix-ui-generation.el |  1 -
 elisp/guix-ui-package.el    | 12 ++++++------
 elisp/guix-ui-profile.el    | 28 +++++++++++++++-------------
 elisp/guix-ui-store-item.el |  2 --
 elisp/guix-utils.el         |  1 -
 elisp/guix.el               |  2 +-
 elisp/local.mk              |  4 ++--
 11 files changed, 39 insertions(+), 42 deletions(-)
  

Patch

diff --git a/configure.ac b/configure.ac
index 3461bb3..31c7328 100644
--- a/configure.ac
+++ b/configure.ac
@@ -109,12 +109,12 @@  AC_ARG_WITH([geiser-lispdir],
   [geiserlispdir="no"])
 AC_SUBST([geiserlispdir])
 
-AC_ARG_WITH([dash-lispdir],
-  [AS_HELP_STRING([--with-dash-lispdir],
-    [directory with dash.el file])],
-  [dashlispdir="$withval"],
-  [dashlispdir="no"])
-AC_SUBST([dashlispdir])
+AC_ARG_WITH([llama-lispdir],
+  [AS_HELP_STRING([--with-llama-lispdir],
+    [directory with llama.el file])],
+  [llamalispdir="$withval"],
+  [llamalispdir="no"])
+AC_SUBST([llamalispdir])
 
 AC_ARG_WITH([bui-lispdir],
   [AS_HELP_STRING([--with-bui-lispdir],
@@ -138,7 +138,7 @@  AC_ARG_WITH([transient-lispdir],
 AC_SUBST([transientlispdir])
 
 AM_CONDITIONAL([GEISER_DIR], [test "x$geiserlispdir" != "xno"])
-AM_CONDITIONAL([DASH_DIR], [test "x$dashlispdir" != "xno"])
+AM_CONDITIONAL([LLAMA_DIR], [test "x$llamalispdir" != "xno"])
 AM_CONDITIONAL([BUI_DIR], [test "x$builispdir" != "xno"])
 AM_CONDITIONAL([EDITINDIRECT_DIR], [test "x$editindirectlispdir" != "xno"])
 AM_CONDITIONAL([TRANSIENT_DIR], [test "x$transientlispdir" != "xno"])
@@ -148,7 +148,7 @@  dnl byte-compilation.  Otherwise, "emacs" will be used, and it will
 dnl hopefully find these packages in its 'load-path'.
 AM_CONDITIONAL([EMACS_Q],
   [test "x$geiserlispdir" != "xno" -a \
-        "x$dashlispdir" != "xno" -a \
+        "x$llamalispdir" != "xno" -a \
         "x$builispdir" != "xno" -a \
         "x$editindirectlispdir" != "xno" -a \
         "x$transientlispdir" != "xno"])
diff --git a/doc/emacs-guix.texi b/doc/emacs-guix.texi
index 6bb3810..1953b09 100644
--- a/doc/emacs-guix.texi
+++ b/doc/emacs-guix.texi
@@ -176,8 +176,8 @@  from the Guix Guile code.  So without Geiser, you can use the same
 features as without Guix.
 
 @item
-@uref{https://github.com/magnars/dash.el, dash library}, version
-2.11.0 or later.
+@uref{https://github.com/tarsius/llama, llama library}, version
+0.6.1 or later.
 
 @item
 @uref{https://gitlab.com/alezost-emacs/bui, BUI library}, version
@@ -1091,8 +1091,8 @@  easy accessible key combination, for example, to @kbd{@key{super}-g}:
 (global-set-key (kbd "s-g") 'guix)
 @end example
 
-@node Guix Keyboard-driven Menu
-@section Guix Keyboard-driven Menu
+@node Keyboard-driven Menu
+@section Keyboard-driven Menu
 
 @findex guix-command
 There is one rather special transient suffix in @kbd{M-x@tie{}guix}.  It
diff --git a/elisp/guix-help.el b/elisp/guix-help.el
index 53ccd3a..f8be213 100644
--- a/elisp/guix-help.el
+++ b/elisp/guix-help.el
@@ -23,7 +23,6 @@ 
 
 ;;; Code:
 
-(require 'dash)
 (require 'bui)
 (require 'guix nil t)
 (require 'guix-utils)
diff --git a/elisp/guix-repl.el b/elisp/guix-repl.el
index 846db60..0ebf603 100644
--- a/elisp/guix-repl.el
+++ b/elisp/guix-repl.el
@@ -48,7 +48,6 @@ 
 
 ;;; Code:
 
-(require 'dash)
 (require 'geiser-mode)
 (require 'geiser-guile)
 (require 'guix nil t)
@@ -57,6 +56,7 @@ 
 (require 'guix-external)
 (require 'guix-profiles)
 (require 'guix-utils)
+(require 'llama)
 
 (defvar guix-load-path nil
   "Directory or a list of directories prepended to Guile's `%load-path'.
@@ -209,8 +209,8 @@  After setting this variable, you need to kill
                   (lcp (if guix-load-compiled-path
                            (guix-list-maybe guix-load-compiled-path)
                          lp)))
-             (append (--mapcat (list "-L" (guix-file-name it)) lp)
-                     (--mapcat (list "-C" (guix-file-name it)) lcp))))
+             (append (apply #'append (list "-L" (##guix-file-name %1)) lp)
+                     (apply #'append (list "-C" (##guix-file-name %1)) lcp))))
     "-L" ,guix-scheme-directory
     ,@(and guix-config-scheme-compiled-directory
            (list "-C" guix-config-scheme-compiled-directory))
diff --git a/elisp/guix-ui-generation.el b/elisp/guix-ui-generation.el
index 7d10d90..ba28814 100644
--- a/elisp/guix-ui-generation.el
+++ b/elisp/guix-ui-generation.el
@@ -25,7 +25,6 @@ 
 ;;; Code:
 
 (require 'cl-lib)
-(require 'dash)
 (require 'bui)
 (require 'guix nil t)
 (require 'guix-ui)
diff --git a/elisp/guix-ui-package.el b/elisp/guix-ui-package.el
index f861820..293e597 100644
--- a/elisp/guix-ui-package.el
+++ b/elisp/guix-ui-package.el
@@ -25,7 +25,6 @@ 
 ;;; Code:
 
 (require 'cl-lib)
-(require 'dash)
 (require 'bui)
 (require 'guix nil t)
 (require 'guix-ui)
@@ -39,6 +38,7 @@ 
 (require 'guix-location)
 (require 'guix-package)
 (require 'guix-profiles)
+(require 'llama)
 
 (guix-ui-define-entry-type package)
 (guix-ui-define-entry-type output)
@@ -102,14 +102,14 @@  is found and `guix-package-list-show-single' is nil."
 
 (defun guix-package-entry-installed-outputs (entry)
   "Return a list of installed outputs for the package ENTRY."
-  (--map (bui-entry-non-void-value it 'output)
-         (bui-entry-non-void-value entry 'installed)))
+  (mapcar (##bui-entry-non-void-value %1 'output)
+          (bui-entry-non-void-value entry 'installed)))
 
 (defun guix-read-package-name-from-entries (entries)
   "Prompt for a package name and return it.
 Names are completed from package ENTRIES."
   (completing-read "Package: "
-                   (--map (bui-entry-value it 'name) entries)))
+                   (mapcar (##bui-entry-value %1 'name) entries)))
 
 (defun guix-read-package-entry-by-name (&optional entries)
   "Return an entry from package ENTRIES (current entries by default).
@@ -1165,8 +1165,8 @@  Colorize it with an appropriate face if needed."
 (defun guix-package-list-get-installed-outputs (installed &optional _)
   "Return string with outputs from INSTALLED entries."
   (bui-get-string
-   (--map (bui-entry-non-void-value it 'output)
-          installed)))
+   (mapcar (##bui-entry-non-void-value %1 'output)
+           installed)))
 
 (defun guix-package-list-marking-check ()
   "Signal an error if marking is disabled for the current buffer."
diff --git a/elisp/guix-ui-profile.el b/elisp/guix-ui-profile.el
index 2f17b38..0923ba5 100644
--- a/elisp/guix-ui-profile.el
+++ b/elisp/guix-ui-profile.el
@@ -26,13 +26,13 @@ 
 
 ;;; Code:
 
-(require 'dash)
 (require 'bui)
 (require 'guix nil t)
 (require 'guix-profiles)
 (require 'guix-read)
 (require 'guix-utils)
 (require 'guix-misc)
+(require 'llama)
 
 (guix-define-groups profile)
 
@@ -55,15 +55,15 @@  properly.")
   "Return a list of all profiles."
   (or guix-profiles
       (setq guix-profiles
-            (--filter
-             (and it (file-exists-p it))
+            (seq-filter
+             (##and %1 (file-exists-p %1))
              (delete-dups
-              (-cons* guix-default-user-profile
-                      guix-default-pulled-profile
-                      guix-system-profile
-		      guix-home-profile
-                      (--when-let (getenv "GUIX_PROFILE")
-                        (guix-file-name it))
+              (append (list guix-default-user-profile
+                            guix-default-pulled-profile
+                            guix-system-profile
+		            guix-home-profile
+                            (when-let ((profile (getenv "GUIX_PROFILE")))
+                              (guix-file-name profile)))
                       (guix-eval-read "(user-profiles)")))))))
 
 (defun guix-profile->entry (profile)
@@ -107,8 +107,8 @@  are multiple entries, prompt for a profile name and return it."
   (or entries (setq entries (bui-current-entries)))
   (if (cdr entries)
       (completing-read "Profile: "
-                       (--map (bui-entry-value it 'profile)
-                              entries))
+                       (mapcar (##bui-entry-value %1 'profile)
+                               entries))
     (bui-entry-value (car entries) 'profile)))
 
 
@@ -208,8 +208,10 @@  get the information."
                        (lambda (entry)
                          (let ((id (bui-entry-id entry)))
                            (cons `(current . ,(equal id current-id))
-                                 (--remove-first (eq (car it) 'current)
-                                                 entry))))
+                                 (seq-remove-at-position
+                                  (seq-filter (##eq (car %1) 'current)
+                                              entry)
+                                  0))))
                        (bui-current-entries))))
     (setf (bui-item-entries bui-item)
           new-entries))
diff --git a/elisp/guix-ui-store-item.el b/elisp/guix-ui-store-item.el
index 13a2d78..91c1d96 100644
--- a/elisp/guix-ui-store-item.el
+++ b/elisp/guix-ui-store-item.el
@@ -1,7 +1,6 @@ 
 ;;; guix-ui-store-item.el --- Interface to display store items  -*- lexical-binding: t -*-
 
 ;; Copyright © 2018 Alex Kost <alezost@gmail.com>
-;; Copyright © 2025 Nicolas Graves <ngraves@ngraves.fr>
 
 ;; This file is part of Emacs-Guix.
 
@@ -27,7 +26,6 @@ 
 
 (require 'cl-lib)
 (require 'ffap)
-(require 'dash)
 (require 'bui)
 (require 'guix-package)
 (require 'guix-guile)
diff --git a/elisp/guix-utils.el b/elisp/guix-utils.el
index 5535eb9..1d0db3f 100644
--- a/elisp/guix-utils.el
+++ b/elisp/guix-utils.el
@@ -24,7 +24,6 @@ 
 ;;; Code:
 
 (require 'cl-lib)
-(require 'dash)
 (require 'bui-utils)
 (require 'guix nil t)
 
diff --git a/elisp/guix.el b/elisp/guix.el
index 2686a24..6e0ebc8 100644
--- a/elisp/guix.el
+++ b/elisp/guix.el
@@ -6,7 +6,7 @@ 
 ;; Version: 0.5.2
 ;; URL: https://emacs-guix.gitlab.io/website/
 ;; Keywords: tools
-;; Package-Requires: ((emacs "24.3") (dash "2.11.0") (geiser "0.8") (bui "1.2.0") (transient "0.8.4") (edit-indirect "0.1.4"))
+;; Package-Requires: ((emacs "24.3") (llama "0.6.1") (geiser "0.8") (bui "1.2.0") (transient "0.8.4") (edit-indirect "0.1.4"))
 
 ;; This file is part of Emacs-Guix.
 
diff --git a/elisp/local.mk b/elisp/local.mk
index 4efbae5..b5b10c0 100644
--- a/elisp/local.mk
+++ b/elisp/local.mk
@@ -28,8 +28,8 @@  if GEISER_DIR
   AM_ELCFLAGS += -L "$(geiserlispdir)"
 endif
 
-if DASH_DIR
-  AM_ELCFLAGS += -L "$(dashlispdir)"
+if LLAMA_DIR
+  AM_ELCFLAGS += -L "$(llamalispdir)"
 endif
 
 if BUI_DIR