unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* 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
[parent not found: <mailman.21593.1362608491.855.help-gnu-emacs@gnu.org>]
* 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
* 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

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 --
     [not found] <mailman.21537.1362564509.855.help-gnu-emacs@gnu.org>
2013-03-06 10:42 ` About features Barry Margolin
2013-03-07 12:47 Xue Fuqiao
     [not found] <mailman.21593.1362608491.855.help-gnu-emacs@gnu.org>
2013-03-06 23:55 ` Barry Margolin
  -- strict thread matches above, loose matches on Subject: below --
2013-03-06 22:21 Xue Fuqiao
2013-03-06 10:08 Xue Fuqiao
2013-03-06 10:48 ` Andreas Röhler
2013-03-06 14:28 ` Kevin Rodgers

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