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, 16 Nov 2024 16:30:19 +0200 Message-ID: <861pzbgsjo.fsf@gnu.org> References: <87plmvj0k4.fsf@pengjiz.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33098"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74378@debbugs.gnu.org To: Pengji Zhang , Spencer Baugh Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 16 15:31:12 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 1tCJpP-0008Qf-DU for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Nov 2024 15:31:11 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCJpI-00009l-OY; Sat, 16 Nov 2024 09:31:04 -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 1tCJpG-00009Y-GB for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2024 09:31: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 1tCJpG-0006n7-8B for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2024 09:31: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=eH2vO9uVeDZ3kZilAy+7+OrSZFX/gpj2dlOIqZysC54=; b=mtRU9foiUi9EzLHLaeQcV9V3IB6hm1hRy02TwokBw7leMyh8akuTkGlLeDeDhzhQXYe/FIVMnZpmQqifzsq6E2h9R11szRmKst3FSkiBia4eOBAlfChrB+LhqDDKsIrIs5hKew93ek/DzZzh2BWKOIrSxs0R602Bf0Wc+/k7nkQP98i6zz6YAgzpujmafWttp1kxZBx5qdVDYO3XrgCDXsSeOgqhxxUQhZ3tGM+OgyU1drdhvSC6e7gLHx9kOaFVNpZVcptwtmY9nsgv9Ks5q4Ads/rLNMpkDCRFAQjJLY5GO/5OUu2c5exPzEmu7qLVwOD08MJU5kKCRXZDlg2AUQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tCJpG-0005qG-2h for bug-gnu-emacs@gnu.org; Sat, 16 Nov 2024 09:31: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, 16 Nov 2024 14:31: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.173176743122413 (code B ref 74378); Sat, 16 Nov 2024 14:31:02 +0000 Original-Received: (at 74378) by debbugs.gnu.org; 16 Nov 2024 14:30:31 +0000 Original-Received: from localhost ([127.0.0.1]:52654 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCJok-0005pR-HN for submit@debbugs.gnu.org; Sat, 16 Nov 2024 09:30:30 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:39942) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCJoj-0005pE-47 for 74378@debbugs.gnu.org; Sat, 16 Nov 2024 09:30:29 -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 1tCJoc-0006kI-88; Sat, 16 Nov 2024 09:30:23 -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=eH2vO9uVeDZ3kZilAy+7+OrSZFX/gpj2dlOIqZysC54=; b=dIuqka5tUcrS NxeP1cyz9otvvjKwtRlPrGqQs5HDwFmLCKM0QUSlch7/uuk/rzaa+bhCFKlK0Pa6iXsvSs2oMP2Ia odvVvPHM/IXXtOwFxSlEonFmI+rA64nsPMkwWn2rd6Iumt4sfpFHhzO9XbUaM+LBv2KB3wqebX9nW LpOkFdRPrPYDXPNn2ILDR8ddjQ7eGyX0MOtl4p2npZnheu2DLZ1/TLgOfwAg43Hzr2jCOAwoLfyJL /hKMqKZHemz4oQyPOoW7XdejOzsO1bX349o/6xLMMUulk6O5/CcqqTAGejw7Wz/aDNYXi2MfrjO0p BzDF23CKW81wzcYv//i9IA==; In-Reply-To: <87plmvj0k4.fsf@pengjiz.com> (message from Pengji Zhang on Sat, 16 Nov 2024 11:54:19 +0800) 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:295463 Archived-At: > 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 >