From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Philip Kaludercic Newsgroups: gmane.emacs.bugs Subject: bug#57884: [PATCH] Flymake backend using the shellcheck program Date: Sun, 18 Sep 2022 12:50:17 +0000 Message-ID: <87sfko4zjq.fsf@posteo.net> References: <87a66yaqwc.fsf@gmail.com> <83bkre0w4m.fsf@gnu.org> <871qs9c3er.fsf@gmail.com> <87zgewdhhd.fsf@posteo.net> <87fsgoyi0l.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="26460"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Eli Zaretskii , 57884@debbugs.gnu.org, Stefan Kangas To: Augusto Stoffel Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 18 14:51:16 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oZtlT-0006fq-QQ for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Sep 2022 14:51:15 +0200 Original-Received: from localhost ([::1]:57160 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oZtlS-0005xz-D9 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Sep 2022 08:51:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58520) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZtlH-0005w4-Hh for bug-gnu-emacs@gnu.org; Sun, 18 Sep 2022 08:51:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:49222) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oZtlG-0003Hv-95 for bug-gnu-emacs@gnu.org; Sun, 18 Sep 2022 08:51:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oZtlG-0000WN-3z for bug-gnu-emacs@gnu.org; Sun, 18 Sep 2022 08:51:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Philip Kaludercic Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Sep 2022 12:51:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57884 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 57884-submit@debbugs.gnu.org id=B57884.16635054281952 (code B ref 57884); Sun, 18 Sep 2022 12:51:02 +0000 Original-Received: (at 57884) by debbugs.gnu.org; 18 Sep 2022 12:50:28 +0000 Original-Received: from localhost ([127.0.0.1]:48300 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oZtkh-0000VP-Ri for submit@debbugs.gnu.org; Sun, 18 Sep 2022 08:50:28 -0400 Original-Received: from mout01.posteo.de ([185.67.36.65]:42165) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oZtkg-0000V3-GD for 57884@debbugs.gnu.org; Sun, 18 Sep 2022 08:50:27 -0400 Original-Received: from submission (posteo.de [185.67.36.169]) by mout01.posteo.de (Postfix) with ESMTPS id BFBA1240026 for <57884@debbugs.gnu.org>; Sun, 18 Sep 2022 14:50:18 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=posteo.net; s=2017; t=1663505420; bh=0ZhRCxQxymhorFqR4l1llo6j0iFh7GsR46bOMGaUmz8=; h=From:To:Cc:Subject:Autocrypt:Date:From; b=bg2MxP1reT+IUplGxFZ1zX/BUR278FfaOqRuDpUAgak2mhJuSAvtnEC3P/Tgk+82d kP0cW/Pl0Hf9Rkh0o+DKzbvUjzYOFO1hrabgvsd0twKz/hZNp/uSkl8zcyIJGggBWO ZgoYU2T1Ie/pXxkFocub+6A5AaUyft7tpKVgKfmJ3t6rDywC56J9Wz34V1Cewi7+1x thXHHRzciOxYUcUHyEYG41ygY5xd6saAmObTegjaO/JI4EHqQUf2Hubv/GRnwY/8hU kBb0C9jNIbkYcK4ovKH+uMbKeS0YWn9wn4kVa9g9t5V7xAv3QXAOUtD4/CoHjdQliF UFupP1hCt2XTA== Original-Received: from customer (localhost [127.0.0.1]) by submission (posteo.de) with ESMTPSA id 4MVnhn5WTLz6tm6; Sun, 18 Sep 2022 14:50:17 +0200 (CEST) In-Reply-To: <87fsgoyi0l.fsf@gmail.com> (Augusto Stoffel's message of "Sun, 18 Sep 2022 14:38:34 +0200") Autocrypt: addr=philipk@posteo.net; prefer-encrypt=nopreference; keydata= mDMEYHHqUhYJKwYBBAHaRw8BAQdAp3GdmYJ6tm5McweY6dEvIYIiry+Oz9rU4MH6NHWK0Ee0QlBo aWxpcCBLYWx1ZGVyY2ljIChnZW5lcmF0ZWQgYnkgYXV0b2NyeXB0LmVsKSA8cGhpbGlwa0Bwb3N0 ZW8ubmV0PoiQBBMWCAA4FiEEDM2H44ZoPt9Ms0eHtVrAHPRh1FwFAmBx6lICGwMFCwkIBwIGFQoJ CAsCBBYCAwECHgECF4AACgkQtVrAHPRh1FyTkgEAjlbGPxFchvMbxzAES3r8QLuZgCxeAXunM9gh io0ePtUBALVhh9G6wIoZhl0gUCbQpoN/UJHI08Gm1qDob5zDxnIHuDgEYHHqUhIKKwYBBAGXVQEF AQEHQNcRB+MUimTMqoxxMMUERpOR+Q4b1KgncDZkhrO2ql1tAwEIB4h4BBgWCAAgFiEEDM2H44Zo Pt9Ms0eHtVrAHPRh1FwFAmBx6lICGwwACgkQtVrAHPRh1Fw1JwD/Qo7kvtib8jy7puyWrSv0MeTS g8qIxgoRWJE/KKdkCLEA/jb9b9/g8nnX+UcwHf/4VfKsjExlnND3FrBviXUW6NcB X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:242985 Archived-At: Augusto Stoffel writes: > With the attached patch I believe I've addressed all comments from this > and previous messages. (In case I missed some detail, the committer > should feel free to make any desired copyediting.) > > > > On Sun, 18 Sep 2022 at 11:55, Philip Kaludercic wrote: > >> Augusto Stoffel writes: >> >>> >>> I could split this into two defcustoms if you feel strongly about it, >>> but it seems a bit of overengineering to me. Not many people will want >>>to customize the program name, and the switches would have to be >>> provided as a list anyway, since we're not going to call this through a >>> shell. >> >> I think it would be good, because then you could make the flags file >> local in case you need something special, without having to worry about >> some evil file that sets the command to >> >> '("rm" "-rf" "--no-preserve-root" "/") >> > > Well, fine then. I've split this into two variables. > >> I don't use `named-let' that much, but calling both the result and the >> recursive function `dialect' seems confusing to me. >> > > Welcome to Lisp-2... It is not so much that they share the same name, but that I don't understand why you close to give the function the name "dialect". From what I have seen, named-let is usually given a self-referential call like "next", "recur", "loop", etc. >>> + (pattern "^-:\\([0-9]+\\):\\([0-9]+\\): \\([^:]+\\): \\(.*\\)$") >> >> Do you think that that using `rx' would make this pattern more maintainable? >> > > I use rx often, but I think this is still at a level where rx doesn't > really help much. OK. >>> + (sentinel >>> + (lambda (proc _event) >> >> Wouldn't it be cleaner to pull this lambda out into a separate named function? >> > > That's not possible, it needs to be in that lexical scope. Not if you use `process-put' and `process-get'. I recently reworked flymake-proselint and did the same thing. IMO it doesn't look that bad: https://git.sr.ht/~manuel-uberti/flymake-proselint/commit/30c4baa08db32e73d956c978c81a9f79062c2e1d >>> + (setq sh--shellcheck-process >>> + (make-process >>> + :name "luacheck" :noquery t :connection-type 'pipe >> ^ >> Typo? >> >>> + :buffer (generate-new-buffer " *flymake-luacheck*") >> ^ >> same here > > Ouch, fixed. 1+ >> Also what happens if someone doesn't have shellcheck installed? > > Then Flymake logs a warning and disables the backend. The error message > will be whatever make-process gives, which I find more than good enough. But isn't that rather late to detect the error. Couldn't you also check if "shellcheck" (or whatever the new option name will be) can be found in the path before adding the hook in `shell-mode'?