* About features
@ 2013-03-06 10:08 Xue Fuqiao
2013-03-06 10:48 ` Andreas Röhler
2013-03-06 14:28 ` Kevin Rodgers
0 siblings, 2 replies; 7+ messages in thread
From: Xue Fuqiao @ 2013-03-06 10:08 UTC (permalink / raw)
To: help-gnu-emacs
In (info "(elisp) Coding Conventions"):
* Put a call to `provide' at the end of each separate Lisp file.
*Note Named Features::.
* If a file requires certain other Lisp programs to be loaded
beforehand, then the comments at the beginning of the file should
say so. Also, use `require' to make sure they are loaded. *Note
Named Features::.
Why should we use `provide' and `require'? Is
`load'/`load-library'/`load-file' enough? Thanks.
--
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: About features
2013-03-06 10:08 About features Xue Fuqiao
@ 2013-03-06 10:48 ` Andreas Röhler
2013-03-06 14:28 ` Kevin Rodgers
1 sibling, 0 replies; 7+ messages in thread
From: Andreas Röhler @ 2013-03-06 10:48 UTC (permalink / raw)
To: help-gnu-emacs
Am 06.03.2013 11:08, schrieb Xue Fuqiao:
> In (info "(elisp) Coding Conventions"):
>
> * Put a call to `provide' at the end of each separate Lisp file.
> *Note Named Features::.
>
> * If a file requires certain other Lisp programs to be loaded
> beforehand, then the comments at the beginning of the file should
> say so. Also, use `require' to make sure they are loaded. *Note
> Named Features::.
>
> Why should we use `provide' and `require'? Is `load'/`load-library'/`load-file' enough? Thanks.
>
IMHO `provide' delivers a kind of city-map with street-names, which exists, before you will visit a street.
Also require, before you a looking for the location of a certain building, checks if the
street-in-my-example exists.
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: About features
2013-03-06 10:08 About features Xue Fuqiao
2013-03-06 10:48 ` Andreas Röhler
@ 2013-03-06 14:28 ` Kevin Rodgers
1 sibling, 0 replies; 7+ messages in thread
From: Kevin Rodgers @ 2013-03-06 14:28 UTC (permalink / raw)
To: help-gnu-emacs
On 3/6/13 3:08 AM, Xue Fuqiao wrote:
> In (info "(elisp) Coding Conventions"):
>
> * Put a call to `provide' at the end of each separate Lisp file.
> *Note Named Features::.
>
> * If a file requires certain other Lisp programs to be loaded
> beforehand, then the comments at the beginning of the file should
> say so. Also, use `require' to make sure they are loaded. *Note
> Named Features::.
>
> Why should we use `provide' and `require'? Is `load'/`load-library'/`load-file'
> enough? Thanks.
`provide' allows you to `require' unconditionally, but the library/file will
only be loaded if necessary.
--
Kevin Rodgers
Denver, Colorado, USA
^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <mailman.21537.1362564509.855.help-gnu-emacs@gnu.org>]
* Re: About features
[not found] <mailman.21537.1362564509.855.help-gnu-emacs@gnu.org>
@ 2013-03-06 10:42 ` Barry Margolin
0 siblings, 0 replies; 7+ messages in thread
From: Barry Margolin @ 2013-03-06 10:42 UTC (permalink / raw)
To: help-gnu-emacs
In article <mailman.21537.1362564509.855.help-gnu-emacs@gnu.org>,
Xue Fuqiao <xfq.free@gmail.com> wrote:
> In (info "(elisp) Coding Conventions"):
>
> * Put a call to `provide' at the end of each separate Lisp file.
> *Note Named Features::.
>
> * If a file requires certain other Lisp programs to be loaded
> beforehand, then the comments at the beginning of the file should
> say so. Also, use `require' to make sure they are loaded. *Note
> Named Features::.
>
> Why should we use `provide' and `require'? Is
> `load'/`load-library'/`load-file' enough? Thanks.
`require' doesn't reload the file if it has already been loaded.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: About features
@ 2013-03-06 22:21 Xue Fuqiao
0 siblings, 0 replies; 7+ messages in thread
From: Xue Fuqiao @ 2013-03-06 22:21 UTC (permalink / raw)
To: help-gnu-emacs
>> Why should we use `provide' and `require'? Is `load'/`load-library'/`load-file'
>> enough? Thanks.
>
> `provide' allows you to `require' unconditionally, but the library/file will
> only be loaded if necessary.
Why? Can you explain it more detailed?
--
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao
^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <mailman.21593.1362608491.855.help-gnu-emacs@gnu.org>]
* Re: About features
[not found] <mailman.21593.1362608491.855.help-gnu-emacs@gnu.org>
@ 2013-03-06 23:55 ` Barry Margolin
0 siblings, 0 replies; 7+ messages in thread
From: Barry Margolin @ 2013-03-06 23:55 UTC (permalink / raw)
To: help-gnu-emacs
In article <mailman.21593.1362608491.855.help-gnu-emacs@gnu.org>,
Xue Fuqiao <xfq.free@gmail.com> wrote:
> >> Why should we use `provide' and `require'? Is
> >> `load'/`load-library'/`load-file'
> >> enough? Thanks.
> >
> > `provide' allows you to `require' unconditionally, but the library/file
> > will
> > only be loaded if necessary.
>
> Why? Can you explain it more detailed?
Why don't you just look at the source code? Simplifying, it's something
like:
(defun require (feature)
(if (not (member feature features))
(load feature)))
(defun provide (feature)
(if (not (member feature features))
(push feature features)))
As I said in my earlier response: require won't reload a library if it's
already been loaded, and it uses the features variable to keep track of
which libraries have been loaded this way.
--
Barry Margolin, barmar@alum.mit.edu
Arlington, MA
*** PLEASE post questions in newsgroups, not directly to me ***
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: About features
@ 2013-03-07 12:47 Xue Fuqiao
0 siblings, 0 replies; 7+ messages in thread
From: Xue Fuqiao @ 2013-03-07 12:47 UTC (permalink / raw)
To: help-gnu-emacs
>>>> Why should we use `provide' and `require'? Is
>>>> `load'/`load-library'/`load-file'
>>>> enough? Thanks.
>>> `provide' allows you to `require' unconditionally, but the library/file
>>> will
>>> only be loaded if necessary.
>> Can you explain it more detailed?
> Simplifying, it's something like:
> (defun require (feature)
> (if (not (member feature features))
> (load feature)))
> (defun provide (feature)
> (if (not (member feature features))
> (push feature features)))
> As I said in my earlier response: require won't reload a library if it's
> already been loaded, and it uses the features variable to keep track of
> which libraries have been loaded this way.
I see. Thanks, I misunderstood your meaning before. (My English sucks.)
--
Best regards, Xue Fuqiao.
http://www.emacswiki.org/emacs/XueFuqiao
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-03-07 12:47 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-06 10:08 About features Xue Fuqiao
2013-03-06 10:48 ` Andreas Röhler
2013-03-06 14:28 ` Kevin Rodgers
[not found] <mailman.21537.1362564509.855.help-gnu-emacs@gnu.org>
2013-03-06 10:42 ` Barry Margolin
-- strict thread matches above, loose matches on Subject: below --
2013-03-06 22:21 Xue Fuqiao
[not found] <mailman.21593.1362608491.855.help-gnu-emacs@gnu.org>
2013-03-06 23:55 ` Barry Margolin
2013-03-07 12:47 Xue Fuqiao
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).