From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alex Bennee Newsgroups: gmane.emacs.help Subject: Re: Machine-dependent elisp Date: Tue, 27 Apr 2010 16:00:00 +0100 Message-ID: References: <84mxww8rff.fsf@csr.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: dough.gmane.org 1272380749 18965 80.91.229.12 (27 Apr 2010 15:05:49 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 27 Apr 2010 15:05:49 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: pocmatos@gmail.com Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Apr 27 17:05:44 2010 connect(): No such file or directory 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.69) (envelope-from ) id 1O6mM3-0003Ar-HV for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Apr 2010 17:05:43 +0200 Original-Received: from localhost ([127.0.0.1]:55731 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O6mLy-0002Ms-Ik for geh-help-gnu-emacs@m.gmane.org; Tue, 27 Apr 2010 11:05:38 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1O6mGu-0007YS-3t for help-gnu-emacs@gnu.org; Tue, 27 Apr 2010 11:00:24 -0400 Original-Received: from [140.186.70.92] (port=39901 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1O6mGo-0007V9-9N for help-gnu-emacs@gnu.org; Tue, 27 Apr 2010 11:00:23 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1O6mGe-0004np-BD for help-gnu-emacs@gnu.org; Tue, 27 Apr 2010 11:00:18 -0400 Original-Received: from mail-px0-f169.google.com ([209.85.212.169]:52645) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1O6mGe-0004n6-6b for help-gnu-emacs@gnu.org; Tue, 27 Apr 2010 11:00:08 -0400 Original-Received: by pxi15 with SMTP id 15so2610709pxi.0 for ; Tue, 27 Apr 2010 08:00:06 -0700 (PDT) Original-Received: by 10.114.237.3 with SMTP id k3mr6875759wah.219.1272380401270; Tue, 27 Apr 2010 08:00:01 -0700 (PDT) Original-Received: by 10.231.199.12 with HTTP; Tue, 27 Apr 2010 08:00:00 -0700 (PDT) In-Reply-To: <84mxww8rff.fsf@csr.com> X-Google-Sender-Auth: 797dc87aa29f1fd0 X-detected-operating-system: by eggs.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:72847 Archived-At: On 21 April 2010 21:46, wrote: > Hi all, > > I have some code which I would like to make dependent on the machine I > am currently working on. I have a single .emacs shared between my work > machine and my home machine. I thought about making dependent on the ip > address (or hostname) but then I need a way to get the ip address (or > hostname) of my current machine. I do exactly this with (system-name), e.g.: (defvar I-am-at-work (string-match "workdomain" (system-name))) (defvar I-am-at-home (string-match "danny" (system-name))) (defvar I-am-on-netbook (string-match "trent" (system-name))) And then later on in my .emacs I have stanzas like: (cond ((eval I-am-on-netbook) ;; With menu bars 86x24 ;; Full screen 92x26 (message "setting default frame for netbook") (setq default-frame-alist '((menu-bar-lines . 0) (tool-bar-lines . 0) (width . 90) (height . 24) (left . 0) (top . 0) (background-color . "DarkSlateGrey") (foreground-color . "wheat") (vertical-scroll-bars . left))) (setq normal-width 90) (setq normal-height 24) (setq fullscreen-width 92) (setq fullscreen-height 26)) ((eval I-am-at-work) (setq default-frame-alist '((menu-bar-lines . 0) (tool-bar-lines . 0) (width . 167) (height . 50) (left . 1200) ; right hand monitor (background-color . "DarkSlateGrey") (foreground-color . "wheat") (vertical-scroll-bars . right)))) ; different screens at home ((eval I-am-at-home) (setq default-frame-alist '((menu-bar-lines . 0) (tool-bar-lines . 0) (top . 0) (left . 0) (width . 120) (height . 50) (background-color . "DarkSlateGrey") (foreground-color . "wheat") (vertical-scroll-bars . right))))) Hope that helps. -- Alex, homepage: http://www.bennee.com/~alex/ http://www.half-llama.co.uk