[bug#77185,v2] gnu: Add emacs-bqn-mode.

Message ID 20250323180136.24876-1-lee.p.thomp@gmail.com
State New
Headers
Series [bug#77185,v2] gnu: Add emacs-bqn-mode. |

Commit Message

Lee Thompson March 23, 2025, 6:01 p.m. UTC
  * gnu/packages/emacs-xyz.scm (emacs-bqn-mode): New variable.

Change-Id: Ibe9a32c4f8414dbc5d3bb350aa684a8f3e15c567
---
 gnu/packages/emacs-xyz.scm | 47 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 47 insertions(+)
  

Comments

Cayetano Santos March 24, 2025, 1:53 p.m. UTC | #1
One last thing: could you include the

    (arguments (list #:tests? #f))      ; no tests

to comply with upcoming emacs packaging standard ?

Thanks !
  
Lee Thompson March 24, 2025, 2:35 p.m. UTC | #2
Okay I've sent over a v3 patch with the `#:tests #f` change.  I'm away
from my main PC at the moment so had to edit the patch with a text
editor and send via Gmail's web interface.  Hopefully all should be
right but let me know if something's gone wrong with it.

On Mon, 24 Mar 2025 at 13:53, Cayetano Santos <csantosb@inventati.org> wrote:
>
>
> One last thing: could you include the
>
>     (arguments (list #:tests? #f))      ; no tests
>
> to comply with upcoming emacs packaging standard ?
>
> Thanks !
  
Cayetano Santos March 24, 2025, 2:47 p.m. UTC | #3
>Mon 24 Mar 2025 at 14:35, Lee Thompson <lee.p.thomp@gmail.com> wrote:

> Okay I've sent over a v3 patch with the `#:tests #f` change.  I'm away
> from my main PC at the moment so had to edit the patch with a text
> editor and send via Gmail's web interface.  Hopefully all should be
> right but let me know if something's gone wrong with it.

I’m unable to apply the patch. Better take your time using git
send-email when you have time.
  
Lee Thompson March 24, 2025, 7:27 p.m. UTC | #4
Cayetano Santos <csantosb@inventati.org> writes:

> I’m unable to apply the patch. Better take your time using git
> send-email when you have time.

Okay should be all good now, #:tests added and I rebased onto the latest
master just in case.
  
Cayetano Santos March 25, 2025, 8:13 a.m. UTC | #5
>Mon 24 Mar 2025 at 19:27, Lee Thompson <lee.p.thomp@gmail.com> wrote:

> Okay should be all good now, #:tests added and I rebased onto the latest
> master just in case.

Thanks ! I submitted a latest v4, as there is no need for revisions
here (we prefer releases, when feasible), as we assume upstream they’re
using dates for releases.  What do you think ?
  
Lee Thompson March 25, 2025, 10:02 a.m. UTC | #6
Cayetano Santos <csantosb@inventati.org> writes:

> Thanks ! I submitted a latest v4, as there is no need for revisions
> here (we prefer releases, when feasible), as we assume upstream they’re
> using dates for releases.  What do you think ?

I see now what you mean about revisions, all looks great to me! Thanks
for all the patience and help!
  

Patch

diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index f7459c3c32..38c59489e1 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -155,6 +155,7 @@ 
 ;;; Copyright © 2025 Remco van 't Veer <remco@remworks.net>
 ;;; Copyright © 2025 Skylar Hill <stellarskylark@posteo.net>
 ;;; Copyright © 2025 Cayetano Santos <csantosb@inventati.org>
+;;; Copyright © 2025 Lee Thompson <lee.p.thomp@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -487,6 +488,52 @@  (define-public emacs-bookmark-plus
 reading the extensive documentation about BookmarkPlus on the Emacs Wiki.")
     (license license:gpl3+)))
 
+(define-public emacs-bqn-mode
+  ;; No releases, versions are tagged by date on GitHub
+  (let ((tag "2024-09-10")
+        (revision "0"))
+    (package
+      (name "emacs-bqn-mode")
+      (version tag)
+      (source
+       (origin
+         (method git-fetch)
+         (uri (git-reference
+               (url "https://github.com/museoa/bqn-mode")
+               (commit tag)))
+         (file-name (git-file-name name version))
+         (sha256
+          (base32 "0a4whlx8065c15nfyqy8176mwysnc13z4q7mmdfnf6skdnvi2pk6"))))
+      (build-system emacs-build-system)
+      (arguments
+       (list
+        #:phases
+        #~(modify-phases %standard-phases
+            ;; `bqn-comint-bring' in `bqn-mode.el' uses the macro
+            ;; `thread-last', defined in `subr-x.el' but not autoloaded.
+            ;; `emacs-build-system' will happily byte-compile `bqn-mode.el'
+            ;; but interactively calling `bqn-comint-bring' will cause an
+            ;; error.  An explicit call to `(require 'subr-x)' remedies the
+            ;; issue until it is fixed upstream.
+            (add-after 'unpack 'require-subr-x
+              (lambda _
+                (emacs-batch-edit-file "bqn-mode.el"
+                                       '(progn (goto-char (point-min))
+                                               (re-search-forward
+                                                "(require 'pulse)")
+                                               (forward-line)
+                                               (insert "(require 'subr-x)\n")
+                                               (basic-save-buffer))))))))
+      (propagated-inputs (list emacs-compat))
+      (synopsis "Emacs major mode for the BQN programming language")
+      (description
+       "This package provides a major mode for editing and executing BQN code.
+It can be used to interactively evaluate BQN code in buffer or can be used to
+launch BQN REPL sessions.  For evaluating BQN code or spawning interpreters an
+executable implementation is required such as @code{cbqn} or @code{dbqn}.")
+      (home-page "https://github.com/museoa/bqn-mode")
+      (license license:gpl3))))
+
 (define-public emacs-cfrs
   (package
     (name "emacs-cfrs")