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

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.