all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Circular require
@ 2008-03-13 13:22 Carsten Dominik
  2008-03-13 20:11 ` Leo
  0 siblings, 1 reply; 5+ messages in thread
From: Carsten Dominik @ 2008-03-13 13:22 UTC (permalink / raw)
  To: help-gnu-emacs


Hi,

I have a question about the setup of a package that eventually will
consists of many files (we are talking about org-mode...).

In this package I have a number of files that implement certain
funtionality, and I can use autoload or a well-placed `require'
statement in the code to get the code loaded when I want.

A separate class of files implements optional code that the user might
or might not want to use.  Because it is an option, I cannot autoload
the code.  I can tell the user to do a (require ...) for
the corresponding feature in .emacs to get things loaded.

However, I am not entirely happy with this setup.

1. I would like to make it easy for the user to get an overview over the
   possible extensions and make it a simple mouse-clock selection in a
   customize variabe to get this features loaded.

2. Each of these small add-ons contains a (require 'org), which means
   that loading this add-on will also load org.el and the whole
   stuff, even into an emacs sesstion where we will not use org-mode at
   all. 

So the kind of setup I had in mind is this


(defcustom org-default-extensions '(org-irc)
  "Extensions that should always be loaded together with org.el.
If the description starts with <A>, this means the extension
will be autoloaded when needed, preloading is not necessary.
FIXME: this does not ork correctly, ignore it for now."
  :group 'org
  :type
  '(set :greedy t
	(const :tag "    Mouse support (org-mouse.el)" org-mouse)
	(const :tag "<A> Publishing (org-publish.el)" org-publish)
	(const :tag "<A> LaTeX export (org-export-latex.el)" org-export-latex)
	(const :tag "    IRC/ERC links (org-irc.el)" org-irc)
	(const :tag "    Apple Mail message links under OS X (org-mac-message.el)" org-mac-message)))

(defun org-load-default-extensions ()
  "Load all extensions listed in `org-default-extensions'."
  (mapc (lambda (ext) 
	  (condition-case nil (require ext)
	    (error (message "Problems while trying to load feature `%s'" ext))))
	org-default-extensions))


Then do as the last thing in org.el

(provide 'org)
(org-load-default-extensions)

This is all nice, and works will upon load time.  However, during
compilation it leads to problems, because the extension will be *loaded*
while Emacs is trying to compile it.  This happens because the
compilation executed the (require 'org), which in turn tries to require
the extension.

So finally, here is my question.  Does anyone have a good idea how to
deal with such a setup?  Or is what I am trying to do not something that
can/should be done?

Thanks a bunch.

- Carsten


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

* Re: Circular require
  2008-03-13 13:22 Circular require Carsten Dominik
@ 2008-03-13 20:11 ` Leo
  2008-03-13 23:41   ` Lennart Borgman (gmail)
  2008-03-14 12:53   ` Carsten Dominik
  0 siblings, 2 replies; 5+ messages in thread
From: Leo @ 2008-03-13 20:11 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: help-gnu-emacs

Hi Carsten,

On 2008-03-13 13:22 +0000, Carsten Dominik wrote:
> In this package I have a number of files that implement certain
> funtionality, and I can use autoload or a well-placed `require'
> statement in the code to get the code loaded when I want.

ERC has that kind of facility in place. For examples, users can set up:

,----
| (setq erc-modules '(netsplit fill track pcomplete ring button autojoin
|                              smiley services match menu scrolltobottom
|                              stamp track page spelling readonly))
`----

to choose what kind of functionality they need.

Best wishes,
-- 
.:  Leo  :.  [ sdl.web AT gmail.com ]  .:  [ GPG Key: 9283AA3F ]  :.

          Use the best OS -- http://www.fedoraproject.org/




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

* Re: Circular require
  2008-03-13 20:11 ` Leo
@ 2008-03-13 23:41   ` Lennart Borgman (gmail)
  2008-03-14 12:54     ` Carsten Dominik
  2008-03-14 12:53   ` Carsten Dominik
  1 sibling, 1 reply; 5+ messages in thread
From: Lennart Borgman (gmail) @ 2008-03-13 23:41 UTC (permalink / raw)
  To: Leo; +Cc: help-gnu-emacs, Carsten Dominik

Leo wrote:
> Hi Carsten,
> 
> On 2008-03-13 13:22 +0000, Carsten Dominik wrote:
>> In this package I have a number of files that implement certain
>> funtionality, and I can use autoload or a well-placed `require'
>> statement in the code to get the code loaded when I want.
> 
> ERC has that kind of facility in place. For examples, users can set up:
> 
> ,----
> | (setq erc-modules '(netsplit fill track pcomplete ring button autojoin
> |                              smiley services match menu scrolltobottom
> |                              stamp track page spelling readonly))
> `----
> 
> to choose what kind of functionality they need.

Nice solution, but it looks a bit strange that erc-update-modules only 
turns on the minor modes. Is that correct?




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

* Re: Circular require
  2008-03-13 20:11 ` Leo
  2008-03-13 23:41   ` Lennart Borgman (gmail)
@ 2008-03-14 12:53   ` Carsten Dominik
  1 sibling, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2008-03-14 12:53 UTC (permalink / raw)
  To: Leo; +Cc: help-gnu-emacs


On Mar 13, 2008, at 9:11 PM, Leo wrote:

> Hi Carsten,
>
> On 2008-03-13 13:22 +0000, Carsten Dominik wrote:
>> In this package I have a number of files that implement certain
>> funtionality, and I can use autoload or a well-placed `require'
>> statement in the code to get the code loaded when I want.
>
> ERC has that kind of facility in place. For examples, users can set  
> up:
>
> ,----
> | (setq erc-modules '(netsplit fill track pcomplete ring button  
> autojoin
> |                              smiley services match menu  
> scrolltobottom
> |                              stamp track page spelling readonly))
> `----
>
> to choose what kind of functionality they need.

Yes, will take a look, thanks.

- Carsten





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

* Re: Circular require
  2008-03-13 23:41   ` Lennart Borgman (gmail)
@ 2008-03-14 12:54     ` Carsten Dominik
  0 siblings, 0 replies; 5+ messages in thread
From: Carsten Dominik @ 2008-03-14 12:54 UTC (permalink / raw)
  To: Lennart Borgman; +Cc: help-gnu-emacs, Leo


On Mar 14, 2008, at 12:41 AM, Lennart Borgman (gmail) wrote:

> Leo wrote:
>> Hi Carsten,
>> On 2008-03-13 13:22 +0000, Carsten Dominik wrote:
>>> In this package I have a number of files that implement certain
>>> funtionality, and I can use autoload or a well-placed `require'
>>> statement in the code to get the code loaded when I want.
>> ERC has that kind of facility in place. For examples, users can set  
>> up:
>> ,----
>> | (setq erc-modules '(netsplit fill track pcomplete ring button  
>> autojoin
>> |                              smiley services match menu  
>> scrolltobottom
>> |                              stamp track page spelling readonly))
>> `----
>> to choose what kind of functionality they need.
>
> Nice solution, but it looks a bit strange that erc-update-modules  
> only turns on the minor modes. Is that correct?

It seems to me that is first requires the feature and then indeed  
turns on the minor mode.  So maybe each feature is a minor mode???


- Carsten








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

end of thread, other threads:[~2008-03-14 12:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-13 13:22 Circular require Carsten Dominik
2008-03-13 20:11 ` Leo
2008-03-13 23:41   ` Lennart Borgman (gmail)
2008-03-14 12:54     ` Carsten Dominik
2008-03-14 12:53   ` Carsten Dominik

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.