unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Naming conventions for defining macros
@ 2015-02-24  6:45 Philipp Stephani
  0 siblings, 0 replies; 3+ messages in thread
From: Philipp Stephani @ 2015-02-24  6:45 UTC (permalink / raw)
  To: help-gnu-emacs@gnu.org

Hi,

the manual page about coding conventions says: "Constructs that define a
function or variable should be macros, not functions, and their names
should start with `define-'." This recommendation is at odds with the usual
recommendation to prefix all non-local names with the package name and
doesn't seem to be widely followed by either Emacs (e.g. ert-deftest,
cl-defstruct) or popular third-party packages (e.g. magit-define-command).
Should we get rid of this recommendation? It amounts to special-casing a
certain class of names without much benefit.

Thanks,
Philipp


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Naming conventions for defining macros
       [not found] <mailman.727.1424760332.31049.help-gnu-emacs@gnu.org>
@ 2015-02-24 15:38 ` Barry Margolin
  2015-06-21 19:47   ` Philipp Stephani
  0 siblings, 1 reply; 3+ messages in thread
From: Barry Margolin @ 2015-02-24 15:38 UTC (permalink / raw)
  To: help-gnu-emacs

In article <mailman.727.1424760332.31049.help-gnu-emacs@gnu.org>,
 Philipp Stephani <p.stephani2@gmail.com> wrote:

> Hi,
> 
> the manual page about coding conventions says: "Constructs that define a
> function or variable should be macros, not functions, and their names
> should start with `define-'." This recommendation is at odds with the usual
> recommendation to prefix all non-local names with the package name and
> doesn't seem to be widely followed by either Emacs (e.g. ert-deftest,
> cl-defstruct) or popular third-party packages (e.g. magit-define-command).
> Should we get rid of this recommendation? It amounts to special-casing a
> certain class of names without much benefit.

I think you're expected to combine the conventions, hence 
magit-define-command. It obeys the recommendation to use the package 
name prefix, then the define- prefix.

-- 
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Naming conventions for defining macros
  2015-02-24 15:38 ` Naming conventions for defining macros Barry Margolin
@ 2015-06-21 19:47   ` Philipp Stephani
  0 siblings, 0 replies; 3+ messages in thread
From: Philipp Stephani @ 2015-06-21 19:47 UTC (permalink / raw)
  To: Barry Margolin, help-gnu-emacs

Barry Margolin <barmar@alum.mit.edu> schrieb am Di., 24. Feb. 2015 um
16:45 Uhr:

> In article <mailman.727.1424760332.31049.help-gnu-emacs@gnu.org>,
>  Philipp Stephani <p.stephani2@gmail.com> wrote:
>
> > Hi,
> >
> > the manual page about coding conventions says: "Constructs that define a
> > function or variable should be macros, not functions, and their names
> > should start with `define-'." This recommendation is at odds with the
> usual
> > recommendation to prefix all non-local names with the package name and
> > doesn't seem to be widely followed by either Emacs (e.g. ert-deftest,
> > cl-defstruct) or popular third-party packages (e.g.
> magit-define-command).
> > Should we get rid of this recommendation? It amounts to special-casing a
> > certain class of names without much benefit.
>
> I think you're expected to combine the conventions, hence
> magit-define-command. It obeys the recommendation to use the package
> name prefix, then the define- prefix.
>
>
Instead of trying to formalize this convention, would it do much harm to
get rid of the 'define-' convention altogether? AFAIK there's no other kind
of function with a conventional midfix; the other conventions are either
suffixes (e.g. '-hook') or prefixes (the package name).


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-21 19:47 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.727.1424760332.31049.help-gnu-emacs@gnu.org>
2015-02-24 15:38 ` Naming conventions for defining macros Barry Margolin
2015-06-21 19:47   ` Philipp Stephani
2015-02-24  6:45 Philipp Stephani

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).