Subject: [bug#47661] [PATCH v2 24/33] gnu: Add emacs-geiser-guile.

From: Leo Prikler <[email-masked]>
Date: Sat, 17 Apr 2021 19:06:39 +0200

From: Morgan Smith <[email-masked]>

* gnu/packages/patches/emacs-geiser-guile-auto-activate.patch: New file.
* gnu/local.mk (dist_patch_DATA): Add it here.
* gnu/packages/emacs-xyz.scm (emacs-geiser-guile): New variable.

Signed-off-by: Leo Prikler <[email-masked]>
---
 gnu/local.mk                                  |  1 +
 gnu/packages/emacs-xyz.scm                    | 42 +++++++++++++++++++
 .../emacs-geiser-guile-auto-activate.patch    | 34 +++++++++++++++
 3 files changed, 77 insertions(+)
 create mode 100644 gnu/packages/patches/emacs-geiser-guile-auto-activate.patch

diff --git a/gnu/local.mk b/gnu/local.mk
index 393fa61bf5..9c632fc2d7 100644
--- a/gnu/local.mk
+++ b/gnu/local.mk
@@ -968,6 +968,7 @@ dist_patch_DATA =						\
   %D%/packages/patches/emacs-exec-path.patch			\
   %D%/packages/patches/emacs-exwm-fix-fullscreen-states.patch	\
   %D%/packages/patches/emacs-fix-scheme-indent-function.patch	\
+  %D%/packages/patches/emacs-geiser-guile-auto-activate.patch	\
   %D%/packages/patches/emacs-geiser-autoload-activate-implementation.patch	\
   %D%/packages/patches/emacs-ignore-empty-xim-styles.patch	\
   %D%/packages/patches/emacs-json-reformat-fix-tests.patch	\
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 85295524a5..38b3ed0687 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -266,6 +266,48 @@ favourite Scheme implementation, you also need the corresponding geiser package,
 e.g. emacs-geiser-guile for Guile.")
     (license license:bsd-3)))
 
+(define-public emacs-geiser-guile
+  (package
+    (name "emacs-geiser-guile")
+    (version "0.13")
+    (source
+     (origin
+       (method git-fetch)
+       (uri (git-reference
+             (url "https://gitlab.com/emacs-geiser/guile.git")
+             (commit version)))
+       (file-name (git-file-name name version))
+       (sha256
+        (base32 "0w264pjwlxna31260ll6gd0n77jlynhzf3h2dws5wr7jflns5mbc"))
+       (patches (search-patches
+                 "emacs-geiser-guile-auto-activate.patch"))))
+    (build-system emacs-build-system)
+    (arguments
+     '(#:include (cons "^src/" %default-include)
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'make-autoloads 'patch-autoloads
+           (lambda* (#:key outputs #:allow-other-keys)
+             (substitute* (string-append
+                           (elpa-directory (assoc-ref outputs "out"))
+                           "/geiser-guile-autoloads.el")
+               ;; Activating implementations fails when Geiser is not yet
+               ;; loaded, so let's defer that until it is.
+               (("\\(geiser-activate-implementation .*\\)" all)
+                (string-append
+                 "(eval-after-load 'geiser-impl '" all ")")))
+             #t)))))
+    (inputs
+     `(("guile" ,guile-2.2)))
+    (propagated-inputs
+     `(("geiser" ,emacs-geiser)))
+    (home-page "https://nongnu.org/geiser/")
+    (synopsis "Guile Scheme support for Geiser")
+    (description
+     "This package adds support for the Guile Scheme implementation to Geiser,
+a generic Scheme interaction mode for the GNU Emacs editor.")
+    (license license:bsd-3)))
+
 (define-public emacs-ac-geiser
   (let ((commit "93818c936ee7e2f1ba1b315578bde363a7d43d05")
         (revision "0"))
diff --git a/gnu/packages/patches/emacs-geiser-guile-auto-activate.patch b/gnu/packages/patches/emacs-geiser-guile-auto-activate.patch
new file mode 100644
index 0000000000..44837f90df
--- /dev/null
+++ b/gnu/packages/patches/emacs-geiser-guile-auto-activate.patch
@@ -0,0 +1,34 @@
+From 93ef7101fdfcc7eac6f465b4b9788c384a323c14 Mon Sep 17 00:00:00 2001
+From: jao <[email-masked]>
+Date: Mon, 5 Apr 2021 20:17:50 +0100
+Subject: [PATCH] fix: auto-activate guile implementation
+
+---
+ geiser-guile.el | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/geiser-guile.el b/geiser-guile.el
+index 340442b..deeb76f 100644
+--- a/geiser-guile.el
++++ b/geiser-guile.el
+@@ -25,6 +25,7 @@
+ (require 'geiser-syntax)
+ (require 'geiser-custom)
+ (require 'geiser-repl)
++(require 'geiser-impl)
+ (require 'geiser-base)
+ (require 'geiser-eval)
+ (require 'geiser-edit)
+@@ -474,6 +475,9 @@ it spawn a server thread."
+ 
+ (geiser-impl--add-to-alist 'regexp "\\.scm$" 'guile t)
+ 
++;;;###autoload
++(geiser-activate-implementation 'guile)
++
+ ;;;###autoload
+ (autoload 'run-guile "geiser-guile" "Start a Geiser Guile REPL." t)
+ 
+-- 
+GitLab
+
-- 
2.31.1