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

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

Nice Emacs Lisp


From: Sébastien Vauban
Subject: Nice Emacs Lisp
Date: Wed, 18 Mar 2009 16:09:01 +0100
User-agent: Gnus/5.110009 (No Gnus v0.9) Emacs/23.0.60 (gnu/linux)

Hello,

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:

--8<---------------cut here---------------start------------->8---
(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)))
--8<---------------cut here---------------end--------------->8---

and I write (for example):

--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---

But do you know some better way to write the above (the concat function is not
that clear there...), while avoiding such a construction:

--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---

as I hate duplicating things (error-prone when changing one and not the
other).

Best regards,
  Seb

-- 
Sébastien Vauban


reply via email to

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