[PATCH] gnu: Add emacs-flycheck-ledger.

  • Done
  • quality assurance status badge
Details
2 participants
  • Morgan.J.Smith
  • Nicolas Goaziou
Owner
unassigned
Submitted by
Morgan.J.Smith
Severity
normal
M
M
Morgan.J.Smith wrote on 5 Jul 2020 20:20
(address . guix-patches@gnu.org)(name . Morgan Smith)(address . Morgan.J.Smith@outlook.com)
DM5PR1001MB2105D585E38C8C158A3490E6C5680@DM5PR1001MB2105.namprd10.prod.outlook.com
From: Morgan Smith <Morgan.J.Smith@outlook.com>

* gnu/packages/emacs-xyz.scm (emacs-flycheck-ledger): New variable.
---
gnu/packages/emacs-xyz.scm | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)

Toggle diff (43 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index a67fe06610..486c93dce3 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -179,6 +179,7 @@
#:use-module (gnu packages wordnet)
#:use-module (gnu packages photo)
#:use-module (gnu packages uml)
+ #:use-module (gnu packages finance)
#:use-module (guix utils)
#:use-module (srfi srfi-1)
#:use-module (ice-9 match))
@@ -4074,6 +4075,28 @@ repetitions for example).")
compile}.")
(license license:gpl3+)))
+(define-public emacs-flycheck-ledger
+ (package
+ (name "emacs-flycheck-ledger")
+ (version "20200304.2204")
+ (source (origin
+ (method url-fetch)
+ (uri (string-append "https://melpa.org/packages/flycheck-ledger-"
+ version ".el"))
+ (sha256
+ (base32
+ "036xn52xjxbbvag9slqi4xqlvzg9p2q544hhxhqqi7jz1kap0yx8"))))
+ (inputs `(("ledger" ,ledger)))
+ (propagated-inputs
+ `(("emacs-flycheck" ,emacs-flycheck)))
+ (build-system emacs-build-system)
+ (home-page "https://github.com/purcell/flycheck-ledger")
+ (synopsis "Ledger support for Flycheck")
+ (description "This flychecker uses the output of @code{ledger balance} on
+the current file to find errors such as unbalanced transactions and syntax
+errors.")
+ (license license:gpl3+)))
+
(define-public emacs-flycheck-rust
(package
(name "emacs-flycheck-rust")
--
2.27.0
N
N
Nicolas Goaziou wrote on 6 Jul 2020 14:24
(address . Morgan.J.Smith@outlook.com)(address . 42216@debbugs.gnu.org)
87fta47rw0.fsf@nicolasgoaziou.fr
Hello,

Morgan.J.Smith@outlook.com writes:

Toggle quote (2 lines)
> * gnu/packages/emacs-xyz.scm (emacs-flycheck-ledger): New variable.

Thank you. Some comments follow.

Toggle quote (5 lines)
> +(define-public emacs-flycheck-ledger
> + (package
> + (name "emacs-flycheck-ledger")
> + (version "20200304.2204")

There's a stable "0.5" release. We should use it instead.

Toggle quote (5 lines)
> + (source (origin
> + (method url-fetch)
> + (uri (string-append "https://melpa.org/packages/flycheck-ledger-"
> + version ".el"))

We don't use source files from MELPA, as they are somewhat modified
in-place. Use git-fetch instead.

Also, could you move `origin' behind `source'?

Toggle quote (5 lines)
> + (sha256
> + (base32
> + "036xn52xjxbbvag9slqi4xqlvzg9p2q544hhxhqqi7jz1kap0yx8"))))
> + (inputs `(("ledger" ,ledger)))

I think this is not sufficient, because Emacs Flycheck Ledger will not
find the Ledger executable. You need to tweak
`flycheck-ledger-executable', using `emacs-substitute-variables'.

Could you send an updated patch?

Regards,
--
Nicolas Goaziou
M
M
Morgan.J.Smith wrote on 11 Jul 2020 03:34
[PATCH] gnu: Add emacs-flycheck-ledger.
(address . 42216@debbugs.gnu.org)(name . Morgan Smith)(address . Morgan.J.Smith@outlook.com)
DM5PR1001MB2105E337F314BACC778138B3C5620@DM5PR1001MB2105.namprd10.prod.outlook.com
From: Morgan Smith <Morgan.J.Smith@outlook.com>

* gnu/packages/emacs-xyz.scm (emacs-flycheck-ledger): New variable.
---

Your idea of using `emacs-substitute-variables' was a good one, but
the variable in question is autogenerated somehow I think. I decided
to do a regex replace instead. I'm not super happy about this because
I think it could break easily but I saw emacs-flycheck-grammalecte
doing the same thing

gnu/packages/emacs-xyz.scm | 35 +++++++++++++++++++++++++++++++++++
1 file changed, 35 insertions(+)

Toggle diff (55 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 89fed81059..4de95a4f0a 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -181,6 +181,7 @@
#:use-module (gnu packages wordnet)
#:use-module (gnu packages photo)
#:use-module (gnu packages uml)
+ #:use-module (gnu packages finance)
#:use-module (guix utils)
#:use-module (srfi srfi-1)
#:use-module (ice-9 match))
@@ -4076,6 +4077,40 @@ repetitions for example).")
compile}.")
(license license:gpl3+)))
+(define-public emacs-flycheck-ledger
+ (package
+ (name "emacs-flycheck-ledger")
+ (version "0.5")
+ (source
+ (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/purcell/flycheck-ledger.git")
+ (commit version)))
+ (file-name (git-file-name name version))
+ (sha256
+ (base32 "1djrj3is0dzrl2703bw7bclf33dp4xqmy144q7xj5pvpb9v3kf50"))))
+ (inputs `(("ledger" ,ledger)))
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'configure
+ (lambda* (#:key inputs outputs #:allow-other-keys)
+ (let ((ledger (assoc-ref inputs "ledger")))
+ ;; Specify the absolute executable location of ledger
+ (substitute* "flycheck-ledger.el"
+ (("\"ledger\"") (string-append "\"" ledger "\""))))
+ #t)))))
+ (propagated-inputs
+ `(("emacs-flycheck" ,emacs-flycheck)))
+ (build-system emacs-build-system)
+ (home-page "https://github.com/purcell/flycheck-ledger")
+ (synopsis "Ledger support for Flycheck")
+ (description "This flychecker uses the output of @code{ledger balance} on
+the current file to find errors such as unbalanced transactions and syntax
+errors.")
+ (license license:gpl3+)))
+
(define-public emacs-flycheck-rust
(package
(name "emacs-flycheck-rust")
--
2.27.0
N
N
Nicolas Goaziou wrote on 14 Jul 2020 11:13
(address . Morgan.J.Smith@outlook.com)(address . 42216-done@debbugs.gnu.org)
87d04y1mtb.fsf@nicolasgoaziou.fr
Hello,

Morgan.J.Smith@outlook.com writes:

Toggle quote (4 lines)
> From: Morgan Smith <Morgan.J.Smith@outlook.com>
>
> * gnu/packages/emacs-xyz.scm (emacs-flycheck-ledger): New variable.

Applied. Thank you.

Regards,
--
Nicolas Goaziou
Closed
?