all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* About definition finding
@ 2013-03-06 13:28 Xue Fuqiao
  2013-03-06 16:11 ` Drew Adams
  0 siblings, 1 reply; 6+ messages in thread
From: Xue Fuqiao @ 2013-03-06 13:28 UTC (permalink / raw)
  To: help-gnu-emacs

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.

Which tools will make use of it?  Imenu/etags/...?  I'm not quite 
familiar with it.  Can anybody help?  Thanks.

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



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

* RE: About definition finding
  2013-03-06 13:28 Xue Fuqiao
@ 2013-03-06 16:11 ` Drew Adams
  2013-03-06 22:18   ` Xue Fuqiao
  0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2013-03-06 16:11 UTC (permalink / raw)
  To: 'Xue Fuqiao', help-gnu-emacs

> 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.
> 
> Which tools will make use of it?  Imenu/etags/...?  I'm not quite 
> familiar with it.  Can anybody help?  Thanks.

Yes, both Imenu and Emacs tags.  And perhaps other tools that you might write to
take advantage of such a convention.

Note that this doc section's guideline conflicts a bit with that of adding a
package/library prefix to such macros.  E.g., `icicle-define-command' vs
`define-icicle-command'.  I put the library prefix first, but others might do
otherwise.




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

* Re: About definition finding
       [not found] <mailman.21544.1362576522.855.help-gnu-emacs@gnu.org>
@ 2013-03-06 18:05 ` Michael Heerdegen
  0 siblings, 0 replies; 6+ messages in thread
From: Michael Heerdegen @ 2013-03-06 18:05 UTC (permalink / raw)
  To: help-gnu-emacs

Xue Fuqiao <xfq.free@gmail.com> writes:

> 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.
>
> Which tools will make use of it?  Imenu/etags/...?

Also `find-func.el' comes to my mind.

Michael.



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

* Re: About definition finding
  2013-03-06 16:11 ` Drew Adams
@ 2013-03-06 22:18   ` Xue Fuqiao
  2013-03-06 22:31     ` Drew Adams
  0 siblings, 1 reply; 6+ messages in thread
From: Xue Fuqiao @ 2013-03-06 22:18 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs

On 03/07/2013 12:11 AM, Drew Adams 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.
>>
>> Which tools will make use of it?  Imenu/etags/...?  I'm not quite
>> familiar with it.  Can anybody help?  Thanks.
>
> Yes, both Imenu and Emacs tags.  And perhaps other tools that you might write to
> take advantage of such a convention.

Ah, I see, thanks.

> Note that this doc section's guideline conflicts a bit with that of adding a
> package/library prefix to such macros.  E.g., `icicle-define-command' vs
> `define-icicle-command'.  I put the library prefix first, but others might do
> otherwise.

Does alias make sense?  E.g., `package-list-packages' is an alias of 
`list-packages'.

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



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

* RE: About definition finding
  2013-03-06 22:18   ` Xue Fuqiao
@ 2013-03-06 22:31     ` Drew Adams
  2013-03-06 22:41       ` Xue Fuqiao
  0 siblings, 1 reply; 6+ messages in thread
From: Drew Adams @ 2013-03-06 22:31 UTC (permalink / raw)
  To: 'Xue Fuqiao'; +Cc: help-gnu-emacs

> > Note that this doc section's guideline conflicts a bit with 
> > that of adding a package/library prefix to such macros.  E.g., 
> > `icicle-define-command' vs `define-icicle-command'.  I put
> > the library prefix first, but others might do otherwise.
> 
> Does alias make sense?  E.g., `package-list-packages' is an alias of 
> `list-packages'.

First, note also that `list-packages' is a command, not a macro.  The aliasing
in that case is presumably for user convenience interactively.

Beyond that, someone from Emacs Dev can perhaps speak to the relation between
such a guideline and aliasing in general.

I would guess that if you bother to follow the guideline for a macro then there
is little sense in following that up by then defining an alias and using that
instead.

In principle, the guidelines are there to help you and those who use your code.
But remember that they are just guidelines, not rules to be followed blindly
without using your judgment.  Do what makes the most sense to you, after reading
the guidelines.




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

* Re: About definition finding
  2013-03-06 22:31     ` Drew Adams
@ 2013-03-06 22:41       ` Xue Fuqiao
  0 siblings, 0 replies; 6+ messages in thread
From: Xue Fuqiao @ 2013-03-06 22:41 UTC (permalink / raw)
  To: Drew Adams; +Cc: help-gnu-emacs

On 03/07/2013 06:31 AM, Drew Adams wrote:
>>> Note that this doc section's guideline conflicts a bit with
>>> that of adding a package/library prefix to such macros.  E.g.,
>>> `icicle-define-command' vs `define-icicle-command'.  I put
>>> the library prefix first, but others might do otherwise.
>>
>> Does alias make sense?  E.g., `package-list-packages' is an alias of
>> `list-packages'.

> First, note also that `list-packages' is a command, not a macro.  The aliasing
> in that case is presumably for user convenience interactively.

Sorry, I forgot it.

[...]

> In principle, the guidelines are there to help you and those who use your code.
> But remember that they are just guidelines, not rules to be followed blindly
> without using your judgment.  Do what makes the most sense to you, after reading
> the guidelines.

That's true, especially for those in (info "(elisp) C Integer Types").

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



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

end of thread, other threads:[~2013-03-06 22:41 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.21544.1362576522.855.help-gnu-emacs@gnu.org>
2013-03-06 18:05 ` About definition finding Michael Heerdegen
2013-03-06 13:28 Xue Fuqiao
2013-03-06 16:11 ` Drew Adams
2013-03-06 22:18   ` Xue Fuqiao
2013-03-06 22:31     ` Drew Adams
2013-03-06 22:41       ` Xue Fuqiao

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.