From: Damien Cassou Date: Sat, 10 Nov 2012 15:58:10 +0000 (+0100) Subject: emacs: Handling external dependencies X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=655fadd59075a4df6ca870b50c91c0a645a36a9b;p=notmuch-archives.git emacs: Handling external dependencies --- diff --git a/7b/65be0f184c68da26330e3f11ccaa78a9b238ac b/7b/65be0f184c68da26330e3f11ccaa78a9b238ac new file mode 100644 index 000000000..e1ecdca05 --- /dev/null +++ b/7b/65be0f184c68da26330e3f11ccaa78a9b238ac @@ -0,0 +1,104 @@ +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 AE8BA431FBC + for ; Sat, 10 Nov 2012 07:58:35 -0800 (PST) +X-Virus-Scanned: Debian amavisd-new at olra.theworths.org +X-Spam-Flag: NO +X-Spam-Score: -0.799 +X-Spam-Level: +X-Spam-Status: No, score=-0.799 tagged_above=-999 required=5 + tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, + FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7] 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 CD2ypcnvWsIw for ; + Sat, 10 Nov 2012 07:58:31 -0800 (PST) +Received: from mail-vb0-f53.google.com (mail-vb0-f53.google.com + [209.85.212.53]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) + (No client certificate requested) + by olra.theworths.org (Postfix) with ESMTPS id CFB67431FAF + for ; Sat, 10 Nov 2012 07:58:31 -0800 (PST) +Received: by mail-vb0-f53.google.com with SMTP id fc21so5141576vbb.26 + for ; Sat, 10 Nov 2012 07:58:31 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; + h=mime-version:from:date:message-id:subject:to:content-type; + bh=dJka071jdD2ePwkysbcvOiNMlKDOh00iA7Ahxv1iCqE=; + b=zDLz49Gykr7bzYyqhD1ZP3IA59V4NPVvX2G8atH7fNPjt47nUBLW5fsJU+qcrnQqta + 4la28cicgAgBPdJQ+QvnInKV4pJtX9dmBqlKP7wWFMDnWUmsGjQ4HGACHQ29wejLV50N + yzT2yjDyHxpoSHIoNKYR2KNY8vkYw6+S0iDW7DcRccvytWskEzLvU2VyCqf6ZpThiply + V1UJ3M3+tH2m8O97I1KUOqQbyj+uKnrMbevcEDcAupDSeD6E/RziH63OSFrVYOQtT81c + Z4xtPuV2CsRTTlT462Phchx4R9LXagG3z2Ej3++lj+fEq0HWyMJdE5h3AZS9fJ4UX+lL + 65sQ== +Received: by 10.58.2.71 with SMTP id 7mr10954957ves.42.1352563111123; Sat, 10 + Nov 2012 07:58:31 -0800 (PST) +MIME-Version: 1.0 +Received: by 10.58.143.51 with HTTP; Sat, 10 Nov 2012 07:58:10 -0800 (PST) +From: Damien Cassou +Date: Sat, 10 Nov 2012 16:58:10 +0100 +Message-ID: + +Subject: emacs: Handling external dependencies +To: notmuch mailing list +Content-Type: text/plain; charset=ISO-8859-1 +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: Sat, 10 Nov 2012 15:58:35 -0000 + +Hi, + +I recently sent a patch for notmuch emacs that depends on a particular +library. What is the best way to deal with such dependencies? + +I can see different solutions: + +1) distribute a rewritten version of the dependency so that the code +now belongs to notmuch (e.g., replace the name of the library by +'notmuch'). This has the disadvantage of requiring maintenance when a +new version of the library is released and can also be considered +'stealing' by some authors. + +2) use a package manager to load the library. This has the +disadvantage that the now standard package manager is not in +widespread use yet and is not compatible with other OS-based package +managers (such as apt-get in Debian). + +3) distribute the dependency with the rest of notmuch and load this +one. This has the disadvantage of possibly shadowing an already +existing version of this library installed through a different means. + +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? + +-- +Damien Cassou +http://damiencassou.seasidehosting.st + +"Success is the ability to go from one failure to another without +losing enthusiasm." +Winston Churchill