From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pengji Zhang Newsgroups: gmane.emacs.bugs Subject: bug#74378: [PATCH] Allow lambdas for 'flymake-cc-command' Date: Sat, 16 Nov 2024 11:54:19 +0800 Message-ID: <87plmvj0k4.fsf@pengjiz.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10657"; mail-complaints-to="usenet@ciao.gmane.io" To: 74378@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Nov 16 04:55:24 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 1tC9u7-0002Yi-BJ for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 16 Nov 2024 04:55:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tC9tp-00063I-Fp; Fri, 15 Nov 2024 22:55:05 -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 1tC9to-00062N-AQ for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 22:55:04 -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 1tC9to-0000C5-20 for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 22:55:04 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=326Yqy7hGxvwI4hms0UcwdSO4oJ8Xg23Eu8Ykxka0xU=; b=GEKOC0YxzE/LorGaIts3tC06UOON8rXinad7jF3YMocZWahVdXXnARJQsVDXdqM1r2vyFXeX9uF71sT9P3L0LGrZi929tnulDY/Y/P2R4hr8vF+7EUEhK/Ni0sHLRa397e2ME3Q9mRriZT7YfvCH18n/I/Ist/porBLsda2SarcujhEeVU86wTrFZcMDeexujv1b5skl/OuYLwvxKVXI1bpxwa8ChXEXYZKRpIG4D+MVPooXV9AXDWsGbGyICz7K9W3gtFDyI96uJz7Qa1POrZRUSKrPelDEvxuIG+a4ENZoN8iLxtsOf1Boc/3/+81zFnb9Hvd5VcN+rK2ktXW/3A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tC9tl-0001SP-SO for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 22:55:01 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Pengji Zhang Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 16 Nov 2024 03:55:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74378 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17317292865570 (code B ref -1); Sat, 16 Nov 2024 03:55:01 +0000 Original-Received: (at submit) by debbugs.gnu.org; 16 Nov 2024 03:54:46 +0000 Original-Received: from localhost ([127.0.0.1]:51649 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC9tW-0001Rl-A9 for submit@debbugs.gnu.org; Fri, 15 Nov 2024 22:54:46 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:57678) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tC9tU-0001Rb-G8 for submit@debbugs.gnu.org; Fri, 15 Nov 2024 22:54:45 -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 1tC9tS-000603-OU for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 22:54:42 -0500 Original-Received: from fout-a6-smtp.messagingengine.com ([103.168.172.149]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tC9tQ-00008s-T6 for bug-gnu-emacs@gnu.org; Fri, 15 Nov 2024 22:54:42 -0500 Original-Received: from phl-compute-08.internal (phl-compute-08.phl.internal [10.202.2.48]) by mailfout.phl.internal (Postfix) with ESMTP id 94AFA138045F for ; Fri, 15 Nov 2024 22:54:38 -0500 (EST) Original-Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-08.internal (MEProxy); Fri, 15 Nov 2024 22:54:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pengjiz.com; h= cc:content-type:content-type:date:date:from:from:in-reply-to :message-id:mime-version:reply-to:subject:subject:to:to; s=fm1; t=1731729278; x=1731815678; bh=326Yqy7hGxvwI4hms0UcwdSO4oJ8Xg23 Eu8Ykxka0xU=; b=BGw6/QhWQRXs4mm0R+J9cz5givre+yUsLuD0+Z3GQnFK4Kv1 XLrNIXWKUY8V4wus4trJ8GZ78KT9l+fzHMqOgosQ7ozhcZ3JjQjvJ+/W7cTRfABE 3E+IeZy4FhEeNLpeeAkk5iqXoXxEu4E+FjV7+9eGOvGG9RmSntxE/LdkHS4Zt4pf mdMfAsuKAHJnPY3DZ/BETqjI6We77MA/98lTTFNVXhIklvVdBHXmdp1AAmjTLyG6 eu6rcC021oc6Mvbwdmk8cSW2HnX/PJWeaw8pbVdGQ2iW1iw+/lrMehOlAdpE1UPr l132ZP6ziq4GP1r865WZlJI5KCQnV0iWnZUZKw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:message-id :mime-version:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm3; t=1731729278; x= 1731815678; bh=326Yqy7hGxvwI4hms0UcwdSO4oJ8Xg23Eu8Ykxka0xU=; b=h hw4ytBCk8jbas5AF4FCRyJ5ACk9iYXIymm3RuDngDmG0tfvwaKivTleKdL9RimAJ +gKAhycG3zqBkKGMavhR1zMtznklEy4lSu0M4jmdLNj4+4sA9GHkP8fM3rO1o/6A /txxwiDwlK6mNpCElQ/E32iDZBVpQY6n76y6T25wqe9KxpYT1pkJQyTz7q0+bwNz sB0o7ZFup6PiMD6JRp8ie2xje/k/L+OptKX31ljd2VXlhNC+Jpm83uvNbN3UPVE3 lflS9tFv25VH6LVFq+1vFRrRP1Yj1TY7XKuHRMXlf5jiDiu4L+0gQPswMTyq7Yfj vuWhD7N2bCJc82Q7Kq3iA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefuddrvdehgdeifecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdpuffr tefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecunecujfgurhephffvufffkf ggtgesmhdtreertddttdenucfhrhhomheprfgvnhhgjhhiucgkhhgrnhhguceomhgvsehp vghnghhjihiirdgtohhmqeenucggtffrrghtthgvrhhnpeffgfeihffgudelledvieeitd dvfeeigeektdekffdtleejgfehledvffejgeetgeenucevlhhushhtvghrufhiiigvpedt necurfgrrhgrmhepmhgrihhlfhhrohhmpehmvgesphgvnhhgjhhiiidrtghomhdpnhgspg hrtghpthhtohepuddpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepsghughdqghhn uhdqvghmrggtshesghhnuhdrohhrgh X-ME-Proxy: Feedback-ID: i16614472:Fastmail Original-Received: by mail.messagingengine.com (Postfix) with ESMTPA for ; Fri, 15 Nov 2024 22:54:37 -0500 (EST) Received-SPF: pass client-ip=103.168.172.149; envelope-from=me@pengjiz.com; helo=fout-a6-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:295429 Archived-At: --=-=-= Content-Type: text/plain Hello! 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! Pengji --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Allow-lambdas-for-flymake-cc-command.patch >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 --=-=-=--