help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Machine-dependent elisp


From: Alex Bennee
Subject: Re: Machine-dependent elisp
Date: Tue, 27 Apr 2010 16:00:00 +0100

On 21 April 2010 21:46,  <pocmatos@gmail.com> 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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]