From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Fabrice Niessen" Newsgroups: gmane.emacs.help Subject: Re: suggestion for portable emacs customizations Date: Thu, 30 May 2013 10:42:01 +0200 Organization: My Googlest Message-ID: <868v2wx3ja.fsf@somewhere.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1369925793 16832 80.91.229.3 (30 May 2013 14:56:33 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 30 May 2013 14:56:33 +0000 (UTC) To: help-gnu-emacs-mXXj517/zsQ@public.gmane.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Thu May 30 16:56:34 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Ui4HK-0002Ut-F3 for geh-help-gnu-emacs@m.gmane.org; Thu, 30 May 2013 16:56:34 +0200 Original-Received: from localhost ([::1]:50301 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ui4HK-0000Wc-3w for geh-help-gnu-emacs@m.gmane.org; Thu, 30 May 2013 10:56:34 -0400 Original-Path: usenet.stanford.edu!newsfeed.news.ucla.edu!news.snarked.org!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!eternal-september.org!feeder.eternal-september.org!mx05.eternal-september.org!.POSTED!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 68 Injection-Info: mx05.eternal-september.org; posting-host="56267169612f95d5ad2eeba965a549c1"; logging-data="28863"; mail-complaints-to="abuse-VVbKFVtnif8H+i2N2EyTrmui9UKz+5OX@public.gmane.org"; posting-account="U2FsdGVkX185hUjzc+uJcKE7GT9cTV4C" User-Agent: Gnus/5.130006 (Ma Gnus v0.6) Emacs/24.3 (windows-nt) X-Archive: encrypt Cancel-Lock: sha1:NGuz3SAoqkBkMg8giGSKQsRprlg= sha1:GbX2Mc1+fpztrGXX1DfRAc9Gmq0= X-Url: http://www.MyGooglest.com/fni Original-Xref: usenet.stanford.edu gnu.emacs.help:198897 X-Mailman-Approved-At: Thu, 30 May 2013 10:56:21 -0400 X-BeenThere: help-gnu-emacs-mXXj517/zsQ@public.gmane.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org-mXXj517/zsQ@public.gmane.org Xref: news.gmane.org gmane.emacs.help:91169 Archived-At: Hi Luca, Luca Ferrari wrote: > I'm beginning to have a lot of virtual machines where I have to run > emacs, and I would like to have them all configured the same way with > the same extensions (e.g., autocomplete) and configurations. Is there > a smart way to provide a kind of "distribution" so that I can ease and > automate the configuration of the multiple installations? > The first thing was thinking about was to set up a ~/.emacs directory > will all the lisp extensions and to raw copy it, but there could be a > smarter way... > Any idea? The approach I chose: have one (huge) Emacs config file [1], and as less system-dependent customs as possible. So, I consider it OK to have "when running-ms-windows" or such conditions, but I don't like "conds" with the different machine names. At least, I try to avoid that as much as I can, and abstract the differences between the machines. Now, regarding the loading of packages, I choose to: - put them in a distributed (versioning) system: SVN, Git or DropBox. - replace explicit `require' calls by `try-require' calls which won't fail (and stop processing the rest of your .emacs) if the package is not present. --8<---------------cut here---------------start------------->8--- (defvar lvn/missing-packages nil "List of packages that `try-require' can't find.") ;; require a feature/library if available; if not, fail silently (defun try-require (feature) "Attempt to load a library or module. Return true if the library given as argument is successfully loaded. If not, instead of an error, just add the package to a list of missing packages." (let (lvn/time-start) (condition-case err (progn (message "(info) Checking for `%s'..." feature) (if (stringp feature) (load-library feature) (setq lvn/time-start (float-time)) (require feature)) (message "(info) Checking for `%s'... %s (loaded in %.2f s)" feature (locate-library (symbol-name feature)) (- (float-time) lvn/time-start)) t) (file-error (progn (message "(info) Checking for `%s'... missing" feature) (add-to-list 'lvn/missing-packages feature 'append)) nil)))) --8<---------------cut here---------------end--------------->8--- Best regards, Fabrice Niessen [1] Under a VCS, so that you can easily propagate your changes from one machine to the others. PS- If you're interested, here's a link to my .emacs file, provided as a library (called "emacs-leuven"): https://www.assembla.com/code/emacs-leuven/git/nodes/master/emacs-leuven.el -- Fabrice Niessen Leuven, Belgium