[PATCH] gnu: emacs-flymake-shellcheck: Add shellcheck as an input

  • Done
  • quality assurance status badge
Details
2 participants
  • Morgan.J.Smith
  • Efraim Flashner
Owner
unassigned
Submitted by
Morgan.J.Smith
Severity
normal
Merged with
M
M
Morgan.J.Smith wrote on 24 Oct 2021 00:21
(address . guix-patches@gnu.org)(name . Morgan Smith)(address . Morgan.J.Smith@outlook.com)
BYAPR05MB4023A6FD0C1527D04116C7F3C5819@BYAPR05MB4023.namprd05.prod.outlook.com
From: Morgan Smith <Morgan.J.Smith@outlook.com>

* gnu/packages/emacs-xyz.scm (emacs-flymake-shellcheck)
[inputs]: Add shellcheck.
[arguments]: Add substitute-shellcheck-path phase.
---
gnu/packages/emacs-xyz.scm | 12 ++++++++++++
1 file changed, 12 insertions(+)

Toggle diff (25 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index aeb6aa4aba..602e6067a4 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -1649,6 +1649,18 @@ (define-public emacs-flymake-shellcheck
(sha256
(base32 "04yfb4sy41spjzk9mhm4gy0h8vnjx09p2g6nm1yzgd9a5ph9sqgl"))))
(build-system emacs-build-system)
+ (arguments
+ '(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'substitute-shellcheck-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ (chmod "flymake-shellcheck.el" #o644)
+ (emacs-substitute-variables "flymake-shellcheck.el"
+ ("flymake-shellcheck-path"
+ (string-append (assoc-ref inputs "shellcheck")
+ "/bin/shellcheck"))))))))
+ (inputs
+ `(("shellcheck" ,shellcheck)))
(home-page "https://github.com/federicotdn/flymake-shellcheck")
(synopsis "Flymake backend for Bash/Sh powered by ShellCheck")
(description
--
2.33.1
M
M
Morgan Smith wrote on 24 Oct 2021 00:24
control message for bug #51364
(address . control@debbugs.gnu.org)
BYAPR05MB402399E321163C00123A6E96C5819@BYAPR05MB4023.namprd05.prod.outlook.com
merge 51364 40429
quit
E
E
Efraim Flashner wrote on 25 Oct 2021 13:39
Re: [bug#51364] [PATCH] gnu: emacs-flymake-shellcheck: Add shellcheck as an input
(address . Morgan.J.Smith@outlook.com)(address . 51364@debbugs.gnu.org)
YXaXfOIke9aDzc/o@3900XT
On Sat, Oct 23, 2021 at 06:21:28PM -0400, Morgan.J.Smith@outlook.com wrote:
Toggle quote (24 lines)
> From: Morgan Smith <Morgan.J.Smith@outlook.com>
>
> * gnu/packages/emacs-xyz.scm (emacs-flymake-shellcheck)
> [inputs]: Add shellcheck.
> [arguments]: Add substitute-shellcheck-path phase.
> ---
> gnu/packages/emacs-xyz.scm | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
> index aeb6aa4aba..602e6067a4 100644
> --- a/gnu/packages/emacs-xyz.scm
> +++ b/gnu/packages/emacs-xyz.scm
> @@ -1649,6 +1649,18 @@ (define-public emacs-flymake-shellcheck
> (sha256
> (base32 "04yfb4sy41spjzk9mhm4gy0h8vnjx09p2g6nm1yzgd9a5ph9sqgl"))))
> (build-system emacs-build-system)
> + (arguments
> + '(#:phases
> + (modify-phases %standard-phases
> + (add-after 'unpack 'substitute-shellcheck-path
> + (lambda* (#:key inputs #:allow-other-keys)
> + (chmod "flymake-shellcheck.el" #o644)

This line I'd change to
(make-file-writable "flymake-shellcheck.el")

Toggle quote (13 lines)
> + (emacs-substitute-variables "flymake-shellcheck.el"
> + ("flymake-shellcheck-path"
> + (string-append (assoc-ref inputs "shellcheck")
> + "/bin/shellcheck"))))))))
> + (inputs
> + `(("shellcheck" ,shellcheck)))
> (home-page "https://github.com/federicotdn/flymake-shellcheck")
> (synopsis "Flymake backend for Bash/Sh powered by ShellCheck")
> (description
> --
> 2.33.1
>

I'm not sure about hardcoding the path to shellcheck and removing the
option to override it in the normal way of the file, by setting
flymake-shellcheck-path¹. I am not sure of the exact return value of
(executable-find "shellcheck") but it seems safer to replace that.

Can you send an updated patch?

¹ I assume, I don't actually use emacs

--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmF2l3wACgkQQarn3Mo9
g1Eo4A/+IZ2xBPwxB8WbjWMa5NXZ10/s10IrFIwxgCUOXLJ8DB1Q3Dj+F+2MGBsF
AIN+48J/nPRV/e1M9P5QaucSf90gST7sqlY0NesUHnPRhzLpiqLStH9NT0s+EZ4n
QqW3WRnI2uRGvV2IUvgrw52ZpaiPQnDak2tVjKzRoaw6lUKwf9sqlR8m3gbgkrp/
QyuU9FapurPwI+YBPHY7C8SbUxUn+Dd1WUv/mBEyEw4+/E2hgw9+jHNwYnCz0QAI
omdUCh6mMCsBJuu+SEea1VXrIttQzXtByK1OSucVRAvFlMj7a+nMrhmjQjOHwmAu
onUcSvQNrbd6FFWn+g917MvsEMm6U0yP2HzRSKnhlZrqSkgEmzdK31NeG9mB307q
cwg2nd4IeYLc4kFzJon3YeWU5cTb0y+AOqzt7Q4Zz/VbFkGFx2vVSeBv+0XmiLXv
Riwdsrm+XQ6ARApS0T6xO6qRbCXPq6DQF+DMjUNvodd7mjALM1myVvyCPji2pHjd
deEVY2hA/k6VcQvKZtBqkvz3YhWNyCvelGGv0UC+Ha0V26MOm+WaQ8HURjJyNk/v
MKGpMCvhMsAjcwSd4pLhvsVTfQw9QNRvoP4QI+Ybhhse8Mq16e7UKcU7oI09SDfL
PWg5R5Qe/Lj5U1SFLXhITLrfh+K2EPHxymVD3vHtRwmh28/Ew5Q=
=WUG6
-----END PGP SIGNATURE-----


M
M
Morgan.J.Smith wrote on 3 Nov 2021 00:23
[PATCH] gnu: emacs-flymake-shellcheck: Add shellcheck as an input
(address . 51364@debbugs.gnu.org)(name . Morgan Smith)(address . Morgan.J.Smith@outlook.com)
BYAPR05MB402350C92D4D2F0E6BEA55F3C58B9@BYAPR05MB4023.namprd05.prod.outlook.com
From: Morgan Smith <Morgan.J.Smith@outlook.com>

* gnu/packages/emacs-xyz.scm (emacs-flymake-shellcheck)
[inputs]: Add shellcheck.
[arguments]: Add substitute-shellcheck-path phase.
---

Sorry for the late reply, I didn't see this in my email.

People would still have been able to set the variable from their configuration.
The value I'm editing just determines the default value. However, I think I
came up with a nice solution that should make everyone happy. It first checks
if there is shellcheck in your path and only hard codes the path if you don't
have it. Apparently Emacs even re-evaluates defcustoms in certain situations
so this *might* even work if someone installs shellcheck after this file has
been loaded.

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

Toggle diff (26 lines)
diff --git a/gnu/packages/emacs-xyz.scm b/gnu/packages/emacs-xyz.scm
index 624fe957e3..dad555cae3 100644
--- a/gnu/packages/emacs-xyz.scm
+++ b/gnu/packages/emacs-xyz.scm
@@ -1649,6 +1649,19 @@ (define-public emacs-flymake-shellcheck
(sha256
(base32 "04yfb4sy41spjzk9mhm4gy0h8vnjx09p2g6nm1yzgd9a5ph9sqgl"))))
(build-system emacs-build-system)
+ (arguments
+ '(#:phases
+ (modify-phases %standard-phases
+ (add-after 'unpack 'substitute-shellcheck-path
+ (lambda* (#:key inputs #:allow-other-keys)
+ (make-file-writable "flymake-shellcheck.el")
+ (emacs-substitute-sexps "flymake-shellcheck.el"
+ ("defcustom flymake-shellcheck-path"
+ `(or (executable-find "shellcheck")
+ ,(string-append (assoc-ref inputs "shellcheck")
+ "/bin/shellcheck")))))))))
+ (inputs
+ `(("shellcheck" ,shellcheck)))
(home-page "https://github.com/federicotdn/flymake-shellcheck")
(synopsis "Flymake backend for Bash/Sh powered by ShellCheck")
(description
--
2.33.1
E
E
Efraim Flashner wrote on 4 Nov 2021 14:05
Re: [PATCH v2] gnu: emacs-flymake-shellcheck: Add shellcheck as an input
(address . 51364-done@debbugs.gnu.org)
YYPajyv/00+5HQgP@3900XT
On Tue, Nov 02, 2021 at 07:13:10PM -0400, Morgan.J.Smith@outlook.com wrote:
Toggle quote (11 lines)
> From: Morgan Smith <Morgan.J.Smith@outlook.com>
>
> * gnu/packages/emacs-xyz.scm (emacs-flymake-shellcheck)
> [inputs]: Add shellcheck.
> [arguments]: Add substitute-shellcheck-path phase.
> ---
>
> Sorry for the late reply, I didn't see this in my email.
>
> People would still have been able to set the variable from their configuration. The value I'm editing just determines the default value. However, I think I came up with a nice solution that should make everyone happy. It first checks if there is shellcheck in your path and only hard codes the path if you don't have it. Apparently Emacs even re-evaluates defcustoms in certain situations so this *might* even work if someone installs shellcheck after this file has been loaded.

Looks good to me. Patch pushed.

You also might've missed the email because my self-hosted email server
sometimes gets blocked. I've added you to X-Debbugs-CC so you should get
this email directly.

--
Efraim Flashner <efraim@flashner.co.il> ????? ?????
GPG key = A28B F40C 3E55 1372 662D 14F7 41AA E7DC CA3D 8351
Confidentiality cannot be guaranteed on emails sent or received unencrypted
-----BEGIN PGP SIGNATURE-----

iQIzBAABCgAdFiEEoov0DD5VE3JmLRT3Qarn3Mo9g1EFAmGD2o8ACgkQQarn3Mo9
g1HRcg/8DEepcYsz/5J1aFw4FkpPU9155/wxIQJExcPHy44LZGrUvnDhVFuK5a6m
RLDwANkaYSfERfu97NQlHNVk7T1hULm9T74Sns3h3H998NUUR2/FBBaXf0wYd4Wj
GC2emy96FIynFwxlNGlDgN2iaikBIt/dt/2IcA/jopDPBSpFOmu5R6uDJbao4zkm
Cea4RdkptM3C7wTetH5oZPYnxmAQ55xTupr2hAq0G/Ngp5UJHjdC002ROebu/tYO
HkpNoQxks/uXon3TN3by49OWp2dvZXUUFBKOomUNhp6E1MC3qSw7BseJQdSGW64b
wGwruPix7bXseJyjSMawsMgrHPbtJg/a/YSHUEE9aSPyWMtARO12NLQogRw3HKuH
ABMlXWHTYCB8XdIUxDuu+obYjfL3O6BOHnVoWFiYXXtp3i7/yPxWm1ijGsi3rstF
aptD35puMYRcI9sb0K1TjmLO1ACoPma0TFfQEDTbgChQfni7lRT4Oq32kbMdGLEz
ZLb1QXdsPJQW9+atE396N9WbMm90FN1jMWveFFBr6ex3IsjIf+rcdUfYb9ViGlQt
sBc0bhD1YxtMCjN5qlK/496nVWqcCpATaxh9npvcbvcAX4EvKM3O+Pkg11+w4Vj7
MeDNWPWIiJP3m52y5GQfnRfLa5lwrANP4NR5e0VDLQw4w1+9+JA=
=lCPX
-----END PGP SIGNATURE-----


Closed
?