From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Mike Mattie Newsgroups: gmane.emacs.help Subject: Re: Nice Emacs Lisp Date: Wed, 18 Mar 2009 14:31:16 -0700 Message-ID: <20090318213115.GA6695@reforged> References: <87mybiamwi.fsf@mundaneum.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oyUTqETQ0mS9luUI" X-Trace: ger.gmane.org 1237412472 21766 80.91.229.12 (18 Mar 2009 21:41:12 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 Mar 2009 21:41:12 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: S??bastien Vauban Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 18 22:42:27 2009 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 1Lk3Wa-0001PW-8A for geh-help-gnu-emacs@m.gmane.org; Wed, 18 Mar 2009 22:42:09 +0100 Original-Received: from localhost ([127.0.0.1]:50693 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lk3VD-0000Ao-R8 for geh-help-gnu-emacs@m.gmane.org; Wed, 18 Mar 2009 17:40:43 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lk3MF-0005PU-Dn for help-gnu-emacs@gnu.org; Wed, 18 Mar 2009 17:31:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lk3MA-0005Oa-Id for help-gnu-emacs@gnu.org; Wed, 18 Mar 2009 17:31:26 -0400 Original-Received: from [199.232.76.173] (port=47483 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lk3MA-0005OQ-8c for help-gnu-emacs@gnu.org; Wed, 18 Mar 2009 17:31:22 -0400 Original-Received: from wa-out-1112.google.com ([209.85.146.178]:59809) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lk3M9-0008Qb-S1 for help-gnu-emacs@gnu.org; Wed, 18 Mar 2009 17:31:22 -0400 Original-Received: by wa-out-1112.google.com with SMTP id j40so122577wah.26 for ; Wed, 18 Mar 2009 14:31:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:date:from:to:cc:subject :message-id:references:mime-version:content-type:content-disposition :in-reply-to:user-agent; bh=mK6cnGZUphB/ih6+Rq/E5rCZoXc0iKBeqhweDqCFOs4=; b=wJCxKeTc30/2MajiHuVvd3eievKyw15M2gFVGI+kq3TEjPk5GI4r3KxhbpXpgpTM3g i0jVjVQe5XDF2X0DIM85vLOYpwkYsJBzX9K9iDHPw75MzA33yB94d8umNmlqhkahs3ig VdVGs8A1lhvBvum2sYQX7vdF2FNoDePhYpt1U= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=O97/ovNeZAQ+buiEV6WIedcN+9F5qIgehNhBD5GzDrpnihIXFWMt8NEIv/1zmFe+2p q34jBO1dj6liwW6WUR4AIyf8zUnoOIQUTVaXwE+s9cz5PAObA+4xzRfbTpoQJY33Akaq GRSAexQJYsPjJf0a6OyLtOZ7Ugsbaz2oNWIEg= Original-Received: by 10.114.159.17 with SMTP id h17mr667959wae.124.1237411878998; Wed, 18 Mar 2009 14:31:18 -0700 (PDT) Original-Received: from @ (c66-235-1-45.sea2.cablespeed.com [66.235.1.45]) by mx.google.com with ESMTPS id b39sm684040rvf.8.2009.03.18.14.31.18 (version=TLSv1/SSLv3 cipher=RC4-MD5); Wed, 18 Mar 2009 14:31:18 -0700 (PDT) Content-Disposition: inline In-Reply-To: <87mybiamwi.fsf@mundaneum.com> User-Agent: Mutt/1.5.16 (2007-06-09) X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 2) 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:63057 Archived-At: --oyUTqETQ0mS9luUI Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable I use this in Grail: ;;---------------------------------------------------------------------- ;; Host specific adaptation ;; ;; each host system has a site file that normalizes the platform ;; and extends the library search space for extra libraries it ;; manages. ;; ;; these files and platform specific customization are loaded by ;; platform here. ;;---------------------------------------------------------------------- (load-user-elisp (cond ((string-equal "gnu/linux" system-type) "linux.el") ((string-equal "darwin" system-type) "darwin.el") ((string-equal "windows" system-type) "windows.el"))) note that load-user-elisp is a function of my own. You can substitute that with (load) and a full path to the files. I think the file approach is the cleanest, as it clearly separates the logic of adapting to the platform from the platform code itself which can become quite long, and more prone to simple parentheses nesting errors when placed inside a form. On Wed, Mar 18, 2009 at 04:09:01PM +0100, S??bastien Vauban wrote: > Hello, >=20 > I'd like to mix Linux and Windows settings in my .emacs file, so that I c= an > use GNU Emacs on both platforms with the same init file. >=20 > Currently, I've defined: >=20 > --8<---------------cut here---------------start------------->8--- > (defmacro GNULinux (&rest body) > (list 'if (string-match "linux" (prin1-to-string system-type)) (cons 'p= rogn body))) >=20 > (defmacro Windows (&rest body) > (list 'if (string-match "windows" (prin1-to-string system-type)) (cons = 'progn body))) > --8<---------------cut here---------------end--------------->8--- >=20 > and I write (for example): >=20 > --8<---------------cut here---------------start------------->8--- > (setq bcc-cache-directory > (concat > (Windows "~/.emacs.d/byte-cache-ms-windows") > (GNULinux "~/.emacs.d/byte-cache-linux"))) > --8<---------------cut here---------------end--------------->8--- >=20 > But do you know some better way to write the above (the concat function i= s not > that clear there...), while avoiding such a construction: >=20 > --8<---------------cut here---------------start------------->8--- > (Windows > (setq bcc-cache-directory "~/.emacs.d/byte-cache-ms-windows")) > (GNULinux > (setq bcc-cache-directory "~/.emacs.d/byte-cache-linux")) > --8<---------------cut here---------------end--------------->8--- >=20 > as I hate duplicating things (error-prone when changing one and not the > other). >=20 > Best regards, > Seb >=20 > --=20 > S??bastien??Vauban --=20 GnuPG Key: B9012279 is available from HKP server pgp.mit.edu --oyUTqETQ0mS9luUI Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.9 (GNU/Linux) iEYEABECAAYFAknBaCMACgkQdfRchrkBInnRsACfWr9shBh4SGV0mX7eKKb0sx/c NloAn3lWBY9EFAEKqh8OYrEiIaAIpkr/ =edU9 -----END PGP SIGNATURE----- --oyUTqETQ0mS9luUI--