* bug#74378: [PATCH] Allow lambdas for 'flymake-cc-command'
@ 2024-11-16 3:54 Pengji Zhang
2024-11-16 14:30 ` Eli Zaretskii
0 siblings, 1 reply; 2+ messages in thread
From: Pengji Zhang @ 2024-11-16 3:54 UTC (permalink / raw)
To: 74378
[-- Attachment #1: Type: text/plain, Size: 370 bytes --]
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
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Allow-lambdas-for-flymake-cc-command.patch --]
[-- Type: text/x-patch, Size: 2066 bytes --]
From 53cc56749e8b396fefb7f430a1eb9e13aa4a25ee Mon Sep 17 00:00:00 2001
From: Pengji Zhang <me@pengjiz.com>
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* bug#74378: [PATCH] Allow lambdas for 'flymake-cc-command'
2024-11-16 3:54 bug#74378: [PATCH] Allow lambdas for 'flymake-cc-command' Pengji Zhang
@ 2024-11-16 14:30 ` Eli Zaretskii
0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2024-11-16 14:30 UTC (permalink / raw)
To: Pengji Zhang, Spencer Baugh; +Cc: 74378
> From: Pengji Zhang <me@pengjiz.com>
> 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 <me@pengjiz.com>
> 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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-16 14:30 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-16 3:54 bug#74378: [PATCH] Allow lambdas for 'flymake-cc-command' Pengji Zhang
2024-11-16 14:30 ` Eli Zaretskii
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.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).