[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Feature request: Maintaining multiple init files with one org fi
From: |
Sven Bretfeld |
Subject: |
Re: [O] Feature request: Maintaining multiple init files with one org file |
Date: |
Sun, 29 Jul 2018 12:49:53 +0200 |
User-agent: |
mu4e 0.9.19; emacs 26.1 |
Hi Armin
That's an interesting approach. I didn't think about giving arguments to
the :tangle operator. This is basically what I was looking for. Just a
bit more to write to each relevant source block. I will give it a try.
Sven
Amin Bandali writes:
> Hello,
>
> Indeed, a tag-based solution (e.g. with :office:, :home:, etc)
> would be great; but what I do right now looks something like
> this:
>
> ,----
> | #+property: header-args :tangle ~/.emacs
> |
> | * Default Frame
> |
> | ** All computers
> | #+begin_src emacs-lisp
> | (defvar myvar "testing")
> | #+end_src
> |
> | ** Office Computer
> | #+begin_src emacs-lisp :tangle (when (string= (system-name) "officepc")
> "~/.emacs")
> | (setq default-frame-alist '(
> | (font . "-PfEd-DejaVu Sans
> Mono-normal-normal-normal-*-26-*-*-*-m-0-iso10646-1")
> | (width . 102)
> | (height . 41))
> | #+end_src
> |
> | ** Laptop
> | #+begin_src emacs-lisp :tangle (when (string= (system-name) "mylaptop")
> "~/.emacs")
> | (setq default-frame-alist '(
> | (font . "-PfEd-DejaVu Sans
> Mono-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1")
> | (width . 80)
> | (height . 30))
> | #+end_src
> |
> | ** More stuff for all computers
> |
> | #+begin_src emacs-lisp
> | (message myvar)
> | #+end_src
> `----
>
> In other words, I use `when' and `string=' (from subr.el) and
> `system-name' to check the hostname. If it matches what I want,
> I return the "~/.emacs" filename, nil otherwise. Alternatively,
> you could probably use `if' and return "no" when it doesn't
> match, but :tangle nil seems to work just fine so I went with
> `when'.
>
> Hope that helps.
>
> Best,
>
> -amin