From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Carsten Dominik Newsgroups: gmane.emacs.help Subject: Circular require Date: Thu, 13 Mar 2008 14:22:58 +0100 Organization: Faculty of Science, University of Amsterdam Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1205432875 25042 80.91.229.12 (13 Mar 2008 18:27:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 13 Mar 2008 18:27:55 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Mar 13 19:28:23 2008 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1JZsAA-000870-RG for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Mar 2008 19:28:23 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1JZs9b-0004P1-Oc for geh-help-gnu-emacs@m.gmane.org; Thu, 13 Mar 2008 14:27:47 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!news.tele.dk!news.tele.dk!small.news.tele.dk!kanaga.switch.ch!switch.ch!tudelft.nl!binfeed1.tudelft.nl!usenet.uva.nl!news.science.uva.nl!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 69 Original-Distribution: world Original-NNTP-Posting-Host: nb-dominik2.science.uva.nl Original-X-Trace: info.science.uva.nl 1205414578 28025 146.50.22.167 (13 Mar 2008 13:22:58 GMT) Original-X-Complaints-To: usenet@science.uva.nl Original-NNTP-Posting-Date: Thu, 13 Mar 2008 13:22:58 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.50 (darwin) Cancel-Lock: sha1:FOHyChS7wTpjgMd9PZXjpJgn+eg= Original-Xref: shelby.stanford.edu gnu.emacs.help:156995 X-Mailman-Approved-At: Thu, 13 Mar 2008 14:26:53 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:52376 Archived-At: 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 , 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 " Publishing (org-publish.el)" org-publish) (const :tag " 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