Return-Path: X-Original-To: notmuch@notmuchmail.org Delivered-To: notmuch@notmuchmail.org Received: from localhost (localhost [127.0.0.1]) by olra.theworths.org (Postfix) with ESMTP id 88DAB431FBC for ; Wed, 14 Nov 2012 01:43:02 -0800 (PST) X-Virus-Scanned: Debian amavisd-new at olra.theworths.org X-Spam-Flag: NO X-Spam-Score: 0 X-Spam-Level: X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none] autolearn=disabled Received: from olra.theworths.org ([127.0.0.1]) by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 64B90LtQKL4m for ; Wed, 14 Nov 2012 01:43:01 -0800 (PST) Received: from guru.guru-group.fi (guru.guru-group.fi [46.183.73.34]) by olra.theworths.org (Postfix) with ESMTP id 7408E431FAF for ; Wed, 14 Nov 2012 01:43:01 -0800 (PST) Received: from guru.guru-group.fi (localhost [IPv6:::1]) by guru.guru-group.fi (Postfix) with ESMTP id 19C4D1000E2; Wed, 14 Nov 2012 11:43:01 +0200 (EET) From: Tomi Ollila To: Ethan Glasser-Camp , Damien Cassou , notmuch mailing list Subject: Re: emacs: Handling external dependencies In-Reply-To: <87pq3h56d5.fsf@betacantrips.com> References: <87pq3h56d5.fsf@betacantrips.com> User-Agent: Notmuch/0.14+84~g8a199bf (http://notmuchmail.org) Emacs/24.2.1 (x86_64-unknown-linux-gnu) X-Face: HhBM'cA~ MIME-Version: 1.0 Content-Type: text/plain X-BeenThere: notmuch@notmuchmail.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: "Use and development of the notmuch mail system." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 14 Nov 2012 09:43:02 -0000 On Wed, Nov 14 2012, Ethan Glasser-Camp wrote: > Damien Cassou writes: > >> 4) distribute the dependency with the rest of notmuch (in a separate >> "fallback-libs/" directory) and load it only when requiring the >> library with the standard load-path does not work. Jonas Bernoulli >> gave me a way to do that: >> >> ,---- >> | (or (require 'THE-LIB nil t) >> | (let ((load-path >> | (cons (expand-file-name >> | "fallback-libs" >> | (file-name-directory (or load-file-name buffer-file-name))) >> | load-path))) >> | (require 'THE-LIB))) >> `---- >> >> What do you think? > > Why not just append it to the *end* of load-path? Then it won't shadow > anything. The scope of the load-path change is for just this one require -- if header-button required some other modules, the fallback-libs version should be preferred (in case exists) over loading elsewehere in this case header-button is loaded from fallback-libs. But, maybe we should be more spesific there and use something like: (let ((dir (expand-file-name "notmuch-deps" (file-name-directory (or load-file-name buffer-file-name))))) (unless (require 'header-button (concat dir "/header-button.elc") t) (require 'header-button (concat dir "/header-button.el") nil))) (if we ever agree to do either kind of loading...) > Ethan Tomi