unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / code / Atom feed
* [bug#51364] [PATCH] gnu: emacs-flymake-shellcheck: Add shellcheck as an input
@ 2021-10-23 22:21 Morgan.J.Smith
  2021-10-25 11:39 ` Efraim Flashner
  2021-11-02 23:23 ` Morgan.J.Smith
  0 siblings, 2 replies; 3+ messages in thread
From: Morgan.J.Smith @ 2021-10-23 22:21 UTC (permalink / raw)
  To: 51364; +Cc: Morgan Smith

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)
+               (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





^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [bug#51364] [PATCH] gnu: emacs-flymake-shellcheck: Add shellcheck as an input
  2021-10-23 22:21 [bug#51364] [PATCH] gnu: emacs-flymake-shellcheck: Add shellcheck as an input Morgan.J.Smith
@ 2021-10-25 11:39 ` Efraim Flashner
  2021-11-02 23:23 ` Morgan.J.Smith
  1 sibling, 0 replies; 3+ messages in thread
From: Efraim Flashner @ 2021-10-25 11:39 UTC (permalink / raw)
  To: Morgan.J.Smith; +Cc: 51364

[-- Attachment #1: Type: text/plain, Size: 2177 bytes --]

On Sat, Oct 23, 2021 at 06:21:28PM -0400, Morgan.J.Smith@outlook.com wrote:
> 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")

> +               (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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [bug#51364] [PATCH] gnu: emacs-flymake-shellcheck: Add shellcheck as an input
  2021-10-23 22:21 [bug#51364] [PATCH] gnu: emacs-flymake-shellcheck: Add shellcheck as an input Morgan.J.Smith
  2021-10-25 11:39 ` Efraim Flashner
@ 2021-11-02 23:23 ` Morgan.J.Smith
  1 sibling, 0 replies; 3+ messages in thread
From: Morgan.J.Smith @ 2021-11-02 23:23 UTC (permalink / raw)
  To: 51364; +Cc: Morgan Smith

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(+)

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





^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-11-02 23:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-23 22:21 [bug#51364] [PATCH] gnu: emacs-flymake-shellcheck: Add shellcheck as an input Morgan.J.Smith
2021-10-25 11:39 ` Efraim Flashner
2021-11-02 23:23 ` Morgan.J.Smith

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).