GNU bug report logs - #74378
[PATCH] Allow lambdas for 'flymake-cc-command'

Previous Next

Package: emacs;

Reported by: Pengji Zhang <me <at> pengjiz.com>

Date: Sat, 16 Nov 2024 03:55:01 UTC

Severity: normal

Tags: patch

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 74378 in the body.
You can then email your comments to 74378 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#74378; Package emacs. (Sat, 16 Nov 2024 03:55:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Pengji Zhang <me <at> pengjiz.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sat, 16 Nov 2024 03:55:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Pengji Zhang <me <at> pengjiz.com>
To: bug-gnu-emacs <at> gnu.org
Subject: [PATCH] Allow lambdas for 'flymake-cc-command'
Date: Sat, 16 Nov 2024 11:54:19 +0800
[Message part 1 (text/plain, inline)]
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

[0001-Allow-lambdas-for-flymake-cc-command.patch (text/x-patch, inline)]
From 53cc56749e8b396fefb7f430a1eb9e13aa4a25ee Mon Sep 17 00:00:00 2001
From: Pengji Zhang <me <at> 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


Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74378; Package emacs. (Sat, 16 Nov 2024 14:31:02 GMT) Full text and rfc822 format available.

Message #8 received at 74378 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Pengji Zhang <me <at> pengjiz.com>, Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 74378 <at> debbugs.gnu.org
Subject: Re: bug#74378: [PATCH] Allow lambdas for 'flymake-cc-command'
Date: Sat, 16 Nov 2024 16:30:19 +0200
> From: Pengji Zhang <me <at> 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 <at> 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
> 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74378; Package emacs. (Sat, 30 Nov 2024 09:56:02 GMT) Full text and rfc822 format available.

Message #11 received at 74378 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: sbaugh <at> janestreet.com
Cc: 74378 <at> debbugs.gnu.org, me <at> pengjiz.com
Subject: Re: bug#74378: [PATCH] Allow lambdas for 'flymake-cc-command'
Date: Sat, 30 Nov 2024 11:55:26 +0200
Ping!  Spencer, please respond.

> Cc: 74378 <at> debbugs.gnu.org
> Date: Sat, 16 Nov 2024 16:30:19 +0200
> From: Eli Zaretskii <eliz <at> gnu.org>
> 
> > From: Pengji Zhang <me <at> 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 <at> 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
> > 
> 
> 
> 
> 




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#74378; Package emacs. (Fri, 06 Dec 2024 16:25:02 GMT) Full text and rfc822 format available.

Message #14 received at 74378 <at> debbugs.gnu.org (full text, mbox):

From: Spencer Baugh <sbaugh <at> janestreet.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 74378 <at> debbugs.gnu.org, me <at> pengjiz.com
Subject: Re: bug#74378: [PATCH] Allow lambdas for 'flymake-cc-command'
Date: Fri, 06 Dec 2024 11:24:29 -0500
Eli Zaretskii <eliz <at> gnu.org> writes:
> Ping!  Spencer, please respond.

This seems like a fine change.

I assume the original motivation was that functionp is slightly
ambiguous on lists of symbols; '(lambda) is both a list of symbols and a
functionp.  But this defcustom is a list of strings, so it's fine.




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 07 Dec 2024 12:45:02 GMT) Full text and rfc822 format available.

Notification sent to Pengji Zhang <me <at> pengjiz.com>:
bug acknowledged by developer. (Sat, 07 Dec 2024 12:45:03 GMT) Full text and rfc822 format available.

Message #19 received at 74378-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Spencer Baugh <sbaugh <at> janestreet.com>
Cc: 74378-done <at> debbugs.gnu.org, me <at> pengjiz.com
Subject: Re: bug#74378: [PATCH] Allow lambdas for 'flymake-cc-command'
Date: Sat, 07 Dec 2024 14:44:38 +0200
> From: Spencer Baugh <sbaugh <at> janestreet.com>
> Cc: 74378 <at> debbugs.gnu.org,  me <at> pengjiz.com
> Date: Fri, 06 Dec 2024 11:24:29 -0500
> 
> 
> Eli Zaretskii <eliz <at> gnu.org> writes:
> > Ping!  Spencer, please respond.
> 
> This seems like a fine change.
> 
> I assume the original motivation was that functionp is slightly
> ambiguous on lists of symbols; '(lambda) is both a list of symbols and a
> functionp.  But this defcustom is a list of strings, so it's fine.

Thanks, installed on the master branch, and closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 05 Jan 2025 12:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 165 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.