From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#74378: [PATCH] Allow lambdas for 'flymake-cc-command' Date: Sat, 30 Nov 2024 11:55:26 +0200 Message-ID: <86y11182r5.fsf@gnu.org> References: <87plmvj0k4.fsf@pengjiz.com> <861pzbgsjo.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="22959"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74378@debbugs.gnu.org, me@pengjiz.com To: sbaugh@janestreet.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 30 10:56:18 2024 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 1tHKD3-0005l1-W3 for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 30 Nov 2024 10:56:18 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tHKCp-0008Ot-Tu; Sat, 30 Nov 2024 04:56:03 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tHKCo-0008Oi-LY for bug-gnu-emacs@gnu.org; Sat, 30 Nov 2024 04:56:02 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tHKCo-0007kc-D9 for bug-gnu-emacs@gnu.org; Sat, 30 Nov 2024 04:56:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=sCV4CPes8HsdaC84gkivWQHk0k3XMWUhwMBP1407m8c=; b=VhmF/uEBSI2gsixs2ePyHMDs3JLFFtd3M3BVY4rUNVK894DVaRmRKfhJSeqSyOPLxAil8T8rq+Zg8mp/T1fKbGiEHnC3KPNWSQMppzA0+dDgyzefyhx+ya7iEwKg228F5xIyNEeJS+MZ2agWhUZLKh58fz1sY3/yVFZPnYk2dxor0iIFvmNI5gk/QUOD4jr5VMnNQ1vc/Lp+98K/8wc9BWRqi5TGF1mOIZH7+i6fib04/JRkecY4jYZBenVfXRYyLX5jOP2+a0cUuFC5sP4tb3oWeJVKx24vQemo2iPl+ITvlFKMWI+m5oNZJC2+73ytr5Dtqk3j2U1VZnFqfBl4mw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tHKCo-0006rq-7n for bug-gnu-emacs@gnu.org; Sat, 30 Nov 2024 04:56:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 30 Nov 2024 09:56:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74378 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch Original-Received: via spool by 74378-submit@debbugs.gnu.org id=B74378.173296053826353 (code B ref 74378); Sat, 30 Nov 2024 09:56:02 +0000 Original-Received: (at 74378) by debbugs.gnu.org; 30 Nov 2024 09:55:38 +0000 Original-Received: from localhost ([127.0.0.1]:45488 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHKCP-0006qy-U3 for submit@debbugs.gnu.org; Sat, 30 Nov 2024 04:55:38 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:52784) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tHKCN-0006qi-IY for 74378@debbugs.gnu.org; Sat, 30 Nov 2024 04:55:35 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tHKCH-0007d5-Ut; Sat, 30 Nov 2024 04:55:30 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=sCV4CPes8HsdaC84gkivWQHk0k3XMWUhwMBP1407m8c=; b=UR59IEVQwKqf kjrXCovn579AX1hTcM6EafZWrXOLwZfXPyb86raK1YtZZFkuntwLxSJ70mMu0pV555Gav1AUv5iz/ uxBmdE52LEmDarIfOumKzRENQMwF42seZrqHDfquOGPFpZliItjSOwTLSNWE/y2zlO37qbUNZ5rzs OwpXhm+0wtGxShFgQV5o2ArF4sAsbVw6E97BArOq8tutsqJk7AgJcU047D0iii4m9lmrl6AwiRvqO EEjxIuh7vCiFWdavkkqUe3MsheEWY6SQPfHAxhJpZ1Liv08fBntctfQcD2XxmiKU7Xyr2Ej7DFx06 27CvEZCgK1bwhM6YGw5G/g==; In-Reply-To: <861pzbgsjo.fsf@gnu.org> (message from Eli Zaretskii on Sat, 16 Nov 2024 16:30:19 +0200) 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:296132 Archived-At: Ping! Spencer, please respond. > Cc: 74378@debbugs.gnu.org > Date: Sat, 16 Nov 2024 16:30:19 +0200 > From: Eli Zaretskii > > > From: Pengji Zhang > > Date: Sat, 16 Nov 2024 11:54:19 +0800 > > > > Currently the option 'flymake-cc-command' only takes a symbol that names > > a function, instead of all callable objects. I am not sure if that is an > > intentional design, but I think the alternative is more common and > > semantic. So I am proposing this patch to allow setting > > 'flymake-cc-command' to an unnamed lambda (and other callable objects). > > > > Thank you! > > Spencer, any comments? > > > >From 53cc56749e8b396fefb7f430a1eb9e13aa4a25ee Mon Sep 17 00:00:00 2001 > > From: Pengji Zhang > > Date: Sat, 16 Nov 2024 11:26:41 +0800 > > Subject: [PATCH] Allow lambdas for 'flymake-cc-command' > > > > * lisp/progmodes/flymake-cc.el (flymake-cc-command): Use > > customization type 'function' instead of 'symbol' to allow other > > callable objects in addition to named functions, and update the > > doc string accordingly. > > (flymake-cc): Use 'functionp' to check if 'flymake-cc-command' > > is callable. > > --- > > lisp/progmodes/flymake-cc.el | 12 ++++++------ > > 1 file changed, 6 insertions(+), 6 deletions(-) > > > > diff --git a/lisp/progmodes/flymake-cc.el b/lisp/progmodes/flymake-cc.el > > index 60e7da5d617..79557c9fbe4 100644 > > --- a/lisp/progmodes/flymake-cc.el > > +++ b/lisp/progmodes/flymake-cc.el > > @@ -28,17 +28,17 @@ > > > > (require 'cl-lib) > > > > -(defcustom flymake-cc-command 'flymake-cc-use-special-make-target > > +(defcustom flymake-cc-command #'flymake-cc-use-special-make-target > > "Command used by the `flymake-cc' backend. > > -A list of strings, or a symbol naming a function that produces one > > -such list when called with no arguments in the buffer where the > > -variable `flymake-mode' is active. > > +A list of strings, or a function that produces one such list when called > > +with no arguments in the buffer where the variable `flymake-mode' is > > +active. > > > > The command should invoke a GNU-style compiler that checks the > > syntax of a (Obj)C(++) program passed to it via its standard > > input and prints the result on its standard output." > > :type '(choice > > - (symbol :tag "Function") > > + (function :tag "Function") > > (repeat :tag "Command(s)" string)) > > :version "27.1" > > :group 'flymake-cc) > > @@ -128,7 +128,7 @@ flymake-cc > > (make-process > > :name "gcc-flymake" > > :buffer (generate-new-buffer "*gcc-flymake*") > > - :command (if (symbolp flymake-cc-command) > > + :command (if (functionp flymake-cc-command) > > (funcall flymake-cc-command) > > flymake-cc-command) > > :noquery t :connection-type 'pipe > > -- > > 2.47.0 > > > > > >