all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How do I clean up "might not be defined" wrnings?
@ 2014-11-21 19:28 Unknown
  2014-11-21 21:58 ` Tassilo Horn
  2014-11-21 22:14 ` Lars Magne Ingebrigtsen
  0 siblings, 2 replies; 5+ messages in thread
From: Unknown @ 2014-11-21 19:28 UTC (permalink / raw
  To: emacs-devel

I've started a significant refactoring and simplification of the VC
code. This has involved moving functions to different files, which
is causing "functions might not be defined" warnings.

What is the approved way to prevent these or clean them up?
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>

In recent years it has been suggested that the Second Amendment
protects the "collective" right of states to maintain militias, while
it does not protect the right of "the people" to keep and bear arms.
If anyone entertained this notion in the period during which the
Constitution and the Bill of Rights were debated and ratified, it
remains one of the most closely guarded secrets of the eighteenth
century, for no known writing surviving from the period between 1787
and 1791 states such a thesis.
        -- Stephen P. Halbrook, "That Every Man Be Armed", 1984



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

* Re: How do I clean up "might not be defined" wrnings?
  2014-11-21 19:28 How do I clean up "might not be defined" wrnings? Unknown
@ 2014-11-21 21:58 ` Tassilo Horn
  2014-11-21 22:03   ` Eric S. Raymond
  2014-11-21 22:14 ` Lars Magne Ingebrigtsen
  1 sibling, 1 reply; 5+ messages in thread
From: Tassilo Horn @ 2014-11-21 21:58 UTC (permalink / raw
  To: emacs-devel

esr@snark (Eric S. Raymond) writes:

> I've started a significant refactoring and simplification of the VC
> code.  This has involved moving functions to different files, which is
> causing "functions might not be defined" warnings.
>
> What is the approved way to prevent these or clean them up?

,----[ C-h f declare-function RET ]
| declare-function is a Lisp macro in `subr.el'.
| 
| (declare-function FN FILE &optional ARGLIST FILEONLY)
| 
| Tell the byte-compiler that function FN is defined, in FILE.
| Optional ARGLIST is the argument list used by the function.
| The FILE argument is not used by the byte-compiler, but by the
| `check-declare' package, which checks that FILE contains a
| definition for FN.  ARGLIST is used by both the byte-compiler
| and `check-declare' to check for consistency.
| 
| FILE can be either a Lisp file (in which case the ".el"
| extension is optional), or a C file.  C files are expanded
| relative to the Emacs "src/" directory.  Lisp files are
| searched for using `locate-library', and if that fails they are
| expanded relative to the location of the file containing the
| declaration.  A FILE with an "ext:" prefix is an external file.
| `check-declare' will check such files if they are found, and skip
| them without error if they are not.
| 
| FILEONLY non-nil means that `check-declare' will only check that
| FILE exists, not that it defines FN.  This is intended for
| function-definitions that `check-declare' does not recognize, e.g.
| `defstruct'.
| 
| To specify a value for FILEONLY without passing an argument list,
| set ARGLIST to t.  This is necessary because nil means an
| empty argument list, rather than an unspecified one.
| 
| Note that for the purposes of `check-declare', this statement
| must be the first non-whitespace on a line.
| 
| For more information, see Info node `(elisp)Declaring Functions'.
`----

Bye,
Tassilo



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

* Re: How do I clean up "might not be defined" wrnings?
  2014-11-21 21:58 ` Tassilo Horn
@ 2014-11-21 22:03   ` Eric S. Raymond
  2014-11-22  5:53     ` Stephen J. Turnbull
  0 siblings, 1 reply; 5+ messages in thread
From: Eric S. Raymond @ 2014-11-21 22:03 UTC (permalink / raw
  To: emacs-devel

Tassilo Horn <tsdh@gnu.org>:
> esr@snark (Eric S. Raymond) writes:
> 
> > I've started a significant refactoring and simplification of the VC
> > code.  This has involved moving functions to different files, which is
> > causing "functions might not be defined" warnings.
> >
> > What is the approved way to prevent these or clean them up?
> 
> ,----[ C-h f declare-function RET ]
> | declare-function is a Lisp macro in `subr.el'.

This clears up "might not be defined", but doesn't seem to address
"might not be defined at runtime".
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>



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

* Re: How do I clean up "might not be defined" wrnings?
  2014-11-21 19:28 How do I clean up "might not be defined" wrnings? Unknown
  2014-11-21 21:58 ` Tassilo Horn
@ 2014-11-21 22:14 ` Lars Magne Ingebrigtsen
  1 sibling, 0 replies; 5+ messages in thread
From: Lars Magne Ingebrigtsen @ 2014-11-21 22:14 UTC (permalink / raw
  To: emacs-devel

Unknown <unknown@unknown.invalid> writes:

> I've started a significant refactoring and simplification of the VC
> code. This has involved moving functions to different files, which
> is causing "functions might not be defined" warnings.
>
> What is the approved way to prevent these or clean them up?

You should structure this so that you can require the files providing
the functions from the files that need them.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no



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

* Re: How do I clean up "might not be defined" wrnings?
  2014-11-21 22:03   ` Eric S. Raymond
@ 2014-11-22  5:53     ` Stephen J. Turnbull
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen J. Turnbull @ 2014-11-22  5:53 UTC (permalink / raw
  To: esr; +Cc: emacs-devel

Eric S. Raymond writes:
 > Tassilo Horn <tsdh@gnu.org>:
 > > esr@snark (Eric S. Raymond) writes:
 > > 
 > > > I've started a significant refactoring and simplification of the VC
 > > > code.  This has involved moving functions to different files, which is
 > > > causing "functions might not be defined" warnings.

Have you done a bootstrap?

 > > > What is the approved way to prevent these

None.  Most uses of declare-function are crocks committed by
criminally lazy programmers.[1]  IMHO FWIW and you have a right to my
opinion, which is invaluable. :-)

 > > > or clean them up?

As Lars says.  In particular, you should autoload the entry points,
and require libraries containing functions called by functions you are
defining.

Steve

Footnotes: 
[1]  `declare-function' should be used only when the function might
not be available at runtime.






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

end of thread, other threads:[~2014-11-22  5:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-21 19:28 How do I clean up "might not be defined" wrnings? Unknown
2014-11-21 21:58 ` Tassilo Horn
2014-11-21 22:03   ` Eric S. Raymond
2014-11-22  5:53     ` Stephen J. Turnbull
2014-11-21 22:14 ` Lars Magne Ingebrigtsen

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.