GNU bug report logs - #13740
About a coding convention

Previous Next

Package: emacs;

Reported by: Xue Fuqiao <xfq.free <at> gmail.com>

Date: Mon, 18 Feb 2013 00:27:02 UTC

Severity: wishlist

Done: Stefan Kangas <stefan <at> marxist.se>

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 13740 in the body.
You can then email your comments to 13740 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#13740; Package emacs. (Mon, 18 Feb 2013 00:27:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Xue Fuqiao <xfq.free <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Mon, 18 Feb 2013 00:27:02 GMT) Full text and rfc822 format available.

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

From: Xue Fuqiao <xfq.free <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: About a coding convention
Date: Mon, 18 Feb 2013 08:25:15 +0800
In (info "(elisp) Coding Conventions"):

   * Constructs that define a function or variable should be macros,
     not functions, and their names should start with `define-'.  The
     macro should receive the name to be defined as the first argument.
     That will help various tools find the definition automatically.
     Avoid constructing the names in the macro itself, since that would
     confuse these tools.

I think macros like `cl-defsubst', `cl-defun' should be mentioned here.

-- 
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13740; Package emacs. (Tue, 19 Feb 2013 19:57:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Xue Fuqiao <xfq.free <at> gmail.com>
Cc: 13740 <at> debbugs.gnu.org
Subject: Re: bug#13740: About a coding convention
Date: Tue, 19 Feb 2013 14:55:35 -0500
Xue Fuqiao wrote:

> In (info "(elisp) Coding Conventions"):
>
>    * Constructs that define a function or variable should be macros,
>      not functions, and their names should start with `define-'.  The
>      macro should receive the name to be defined as the first argument.
>      That will help various tools find the definition automatically.
>      Avoid constructing the names in the macro itself, since that would
>      confuse these tools.
>
> I think macros like `cl-defsubst', `cl-defun' should be mentioned here.

Why? What would you say about them?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13740; Package emacs. (Thu, 21 Feb 2013 00:31:02 GMT) Full text and rfc822 format available.

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

From: Xue Fuqiao <xfq.free <at> gmail.com>
To: Glenn Morris <rgm <at> gnu.org>
Cc: 13740 <at> debbugs.gnu.org
Subject: Re: bug#13740: About a coding convention
Date: Thu, 21 Feb 2013 08:28:57 +0800
On Tue, 19 Feb 2013 14:55:35 -0500
Glenn Morris <rgm <at> gnu.org> wrote:

> Xue Fuqiao wrote:
> > In (info "(elisp) Coding Conventions"):
> >
> >    * Constructs that define a function or variable should be macros,
> >      not functions, and their names should start with `define-'.  The
> >      macro should receive the name to be defined as the first argument.
> >      That will help various tools find the definition automatically.
> >      Avoid constructing the names in the macro itself, since that would
> >      confuse these tools.
> >
> > I think macros like `cl-defsubst', `cl-defun' should be mentioned here.

> Why?

They are macros that define functions, but they don't start with `define-'.

>  What would you say about them?

Maybe something like this:

Constructs that define a function or variable should be macros, not functions, and their names should start with `define-', except for some macros in `cl-lib', like `cl-defsubst' and `cl-defun'.

-- 
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13740; Package emacs. (Thu, 21 Feb 2013 02:13:01 GMT) Full text and rfc822 format available.

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

From: Xue Fuqiao <xfq.free <at> gmail.com>
To: Christopher Schmidt <christopher <at> ch.ristopher.com>
Cc: 13740 <at> debbugs.gnu.org
Subject: Re: bug#13740: About a coding convention
Date: Thu, 21 Feb 2013 10:10:52 +0800
On Thu, 21 Feb 2013 01:54:56 +0000 (GMT)
Christopher Schmidt <christopher <at> ch.ristopher.com> wrote:

> Xue Fuqiao <xfq.free <at> gmail.com> writes:
> > They are macros that define functions, but they don't start with
> > `define-'.
> Anything about cl-lib does not belong into the Elisp node.  IMO cl-lib
> breaking conventions is not worth a note, either.

But cl-lib is a part of Emacs.  We make aliases like this:

define-inline-function-cl --> cl-defsubst
defune-function-cl --> cl-defun

Or we can mention the convention breakage in the CL manual.

>         Christopher

-- 
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13740; Package emacs. (Thu, 21 Feb 2013 15:23:01 GMT) Full text and rfc822 format available.

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

From: Stefan Monnier <monnier <at> IRO.UMontreal.CA>
To: Xue Fuqiao <xfq.free <at> gmail.com>
Cc: Glenn Morris <rgm <at> gnu.org>, 13740 <at> debbugs.gnu.org
Subject: Re: bug#13740: About a coding convention
Date: Thu, 21 Feb 2013 10:21:38 -0500
> Constructs that define a function or variable should be macros, not
> functions, and their names should start with `define-', except for some
> macros in `cl-lib', like `cl-defsubst' and `cl-defun'.

Actually, I think they can also start with "<prefix>-define-".


        Stefan




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#13740; Package emacs. (Thu, 21 Feb 2013 17:04:02 GMT) Full text and rfc822 format available.

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

From: Glenn Morris <rgm <at> gnu.org>
To: Xue Fuqiao <xfq.free <at> gmail.com>
Cc: 13740 <at> debbugs.gnu.org
Subject: Re: bug#13740: About a coding convention
Date: Thu, 21 Feb 2013 12:01:54 -0500
Xue Fuqiao wrote:

> Constructs that define a function or variable should be macros, not
> functions, and their names should start with `define-', except for
> some macros in `cl-lib', like `cl-defsubst' and `cl-defun'.

I don't think it is useful to list pre-existing exceptions to a general
guideline.


The whole thing is mutually inconsistent anyway:

   constructs that define functions, variables, etc., work better if
   they start with @samp{defun} or @samp{defvar}, [...]
   [...]
   Constructs that define a function or variable should be macros,
   not functions, and their names should start with @samp{define-}.




Reply sent to Stefan Kangas <stefan <at> marxist.se>:
You have taken responsibility. (Fri, 07 Aug 2020 11:24:02 GMT) Full text and rfc822 format available.

Notification sent to Xue Fuqiao <xfq.free <at> gmail.com>:
bug acknowledged by developer. (Fri, 07 Aug 2020 11:24:02 GMT) Full text and rfc822 format available.

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

From: Stefan Kangas <stefan <at> marxist.se>
To: Glenn Morris <rgm <at> gnu.org>
Cc: Xue Fuqiao <xfq.free <at> gmail.com>, 13740-done <at> debbugs.gnu.org
Subject: Re: bug#13740: About a coding convention
Date: Fri, 7 Aug 2020 04:23:22 -0700
Glenn Morris <rgm <at> gnu.org> writes:

> Xue Fuqiao wrote:
>
>> Constructs that define a function or variable should be macros, not
>> functions, and their names should start with `define-', except for
>> some macros in `cl-lib', like `cl-defsubst' and `cl-defun'.
>
> I don't think it is useful to list pre-existing exceptions to a general
> guideline.

Agreed.  Since no one else has voiced an opinion, I'm therefore closing
this bug report.

Best regards,
Stefan Kangas




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

This bug report was last modified 3 years and 233 days ago.

Previous Next


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