* bug#13740: About a coding convention
@ 2013-02-18 0:25 Xue Fuqiao
2013-02-19 19:55 ` Glenn Morris
0 siblings, 1 reply; 7+ messages in thread
From: Xue Fuqiao @ 2013-02-18 0:25 UTC (permalink / raw)
To: 13740
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
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#13740: About a coding convention
2013-02-18 0:25 bug#13740: About a coding convention Xue Fuqiao
@ 2013-02-19 19:55 ` Glenn Morris
2013-02-21 0:28 ` Xue Fuqiao
0 siblings, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2013-02-19 19:55 UTC (permalink / raw)
To: Xue Fuqiao; +Cc: 13740
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?
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#13740: About a coding convention
2013-02-19 19:55 ` Glenn Morris
@ 2013-02-21 0:28 ` Xue Fuqiao
[not found] ` <8738wqa0sp@ch.ristopher.com>
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Xue Fuqiao @ 2013-02-21 0:28 UTC (permalink / raw)
To: Glenn Morris; +Cc: 13740
On Tue, 19 Feb 2013 14:55:35 -0500
Glenn Morris <rgm@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
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#13740: About a coding convention
[not found] ` <8738wqa0sp@ch.ristopher.com>
@ 2013-02-21 2:10 ` Xue Fuqiao
0 siblings, 0 replies; 7+ messages in thread
From: Xue Fuqiao @ 2013-02-21 2:10 UTC (permalink / raw)
To: Christopher Schmidt; +Cc: 13740
On Thu, 21 Feb 2013 01:54:56 +0000 (GMT)
Christopher Schmidt <christopher@ch.ristopher.com> wrote:
> Xue Fuqiao <xfq.free@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
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#13740: About a coding convention
2013-02-21 0:28 ` Xue Fuqiao
[not found] ` <8738wqa0sp@ch.ristopher.com>
@ 2013-02-21 15:21 ` Stefan Monnier
2013-02-21 17:01 ` Glenn Morris
2 siblings, 0 replies; 7+ messages in thread
From: Stefan Monnier @ 2013-02-21 15:21 UTC (permalink / raw)
To: Xue Fuqiao; +Cc: 13740
> 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
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#13740: About a coding convention
2013-02-21 0:28 ` Xue Fuqiao
[not found] ` <8738wqa0sp@ch.ristopher.com>
2013-02-21 15:21 ` Stefan Monnier
@ 2013-02-21 17:01 ` Glenn Morris
2020-08-07 11:23 ` Stefan Kangas
2 siblings, 1 reply; 7+ messages in thread
From: Glenn Morris @ 2013-02-21 17:01 UTC (permalink / raw)
To: Xue Fuqiao; +Cc: 13740
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-}.
^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#13740: About a coding convention
2013-02-21 17:01 ` Glenn Morris
@ 2020-08-07 11:23 ` Stefan Kangas
0 siblings, 0 replies; 7+ messages in thread
From: Stefan Kangas @ 2020-08-07 11:23 UTC (permalink / raw)
To: Glenn Morris; +Cc: Xue Fuqiao, 13740-done
Glenn Morris <rgm@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
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2020-08-07 11:23 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-02-18 0:25 bug#13740: About a coding convention Xue Fuqiao
2013-02-19 19:55 ` Glenn Morris
2013-02-21 0:28 ` Xue Fuqiao
[not found] ` <8738wqa0sp@ch.ristopher.com>
2013-02-21 2:10 ` Xue Fuqiao
2013-02-21 15:21 ` Stefan Monnier
2013-02-21 17:01 ` Glenn Morris
2020-08-07 11:23 ` Stefan Kangas
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.