From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: tyler Newsgroups: gmane.emacs.help Subject: Re: Nice Emacs Lisp Date: Wed, 18 Mar 2009 14:45:07 -0300 Message-ID: <87ljr2913w.fsf@blackbart.sedgenet> References: <87mybiamwi.fsf@mundaneum.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Trace: ger.gmane.org 1237398435 2260 80.91.229.12 (18 Mar 2009 17:47:15 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 18 Mar 2009 17:47:15 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Mar 18 18:48:32 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 1LjzsK-0004S6-6G for geh-help-gnu-emacs@m.gmane.org; Wed, 18 Mar 2009 18:48:20 +0100 Original-Received: from localhost ([127.0.0.1]:58103 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ljzqx-0002cx-VP for geh-help-gnu-emacs@m.gmane.org; Wed, 18 Mar 2009 13:46:55 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ljzpx-0002PZ-Vt for help-gnu-emacs@gnu.org; Wed, 18 Mar 2009 13:45:53 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ljzpt-0002Ov-FM for help-gnu-emacs@gnu.org; Wed, 18 Mar 2009 13:45:53 -0400 Original-Received: from [199.232.76.173] (port=55682 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ljzpt-0002Os-Av for help-gnu-emacs@gnu.org; Wed, 18 Mar 2009 13:45:49 -0400 Original-Received: from main.gmane.org ([80.91.229.2]:57961 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ljzps-0007QM-Mj for help-gnu-emacs@gnu.org; Wed, 18 Mar 2009 13:45:49 -0400 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1Ljzpf-0008AD-L4 for help-gnu-emacs@gnu.org; Wed, 18 Mar 2009 17:45:35 +0000 Original-Received: from hlfxns0169w-142068220250.pppoe-dynamic.ns.aliant.net ([142.68.220.250]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 18 Mar 2009 17:45:35 +0000 Original-Received: from tyler.smith by hlfxns0169w-142068220250.pppoe-dynamic.ns.aliant.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Wed, 18 Mar 2009 17:45:35 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 46 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: hlfxns0169w-142068220250.pppoe-dynamic.ns.aliant.net User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:jbDIxoZrwAjv9y13FjCvkyG+ob4= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:63053 Archived-At: Sébastien Vauban writes: > I'd like to mix Linux and Windows settings in my .emacs file, so that > I can use GNU Emacs on both platforms with the same init file. > > Currently, I've defined: > > (defmacro GNULinux (&rest body) > (list 'if (string-match "linux" (prin1-to-string system-type)) (cons 'progn body))) > > (defmacro Windows (&rest body) > (list 'if (string-match "windows" (prin1-to-string system-type)) (cons 'progn body))) > > and I write (for example): > > (setq bcc-cache-directory > (concat > (Windows "~/.emacs.d/byte-cache-ms-windows") > (GNULinux "~/.emacs.d/byte-cache-linux"))) > > But do you know some better way to write the above (the concat function is not > that clear there...) I'm not very familiar with macros, but maybe using a single macro instead of two makes things clearer: (defmacro gnu-win (gnu win) `(if (string-match "gnu/linux" (prin1-to-string system-type)) (,@gnu) (,@win))) (setq bcc-cache-directory (gnu-win "~/.emacs.d/byte-cache-linux" "~/.emacs.d/byte-cache-ms-windows")) Cheers, Tyler -- Philosophy of science is about as useful to scientists as ornithology is to birds. --Richard Feynman