From: Sven Bretfeld <sven.bretfeld@ntnu.no>
To: Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Feature request: Maintaining multiple init files with one org file
Date: Sun, 29 Jul 2018 12:49:53 +0200 [thread overview]
Message-ID: <87d0v6joz2.fsf@ntnu.no> (raw)
In-Reply-To: <874lgja2kt.fsf@aminb.org>
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
next prev parent reply other threads:[~2018-07-29 10:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-07-28 9:25 Feature request: Maintaining multiple init files with one org file Sven Bretfeld
2018-07-28 13:53 ` Amin Bandali
2018-07-29 10:49 ` Sven Bretfeld [this message]
2018-07-29 0:06 ` Tim Cross
2018-07-29 10:42 ` Sven Bretfeld
2018-07-30 7:07 ` Eric S Fraga
2018-07-30 12:15 ` Sven Bretfeld
2018-07-30 19:25 ` Diego Zamboni
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87d0v6joz2.fsf@ntnu.no \
--to=sven.bretfeld@ntnu.no \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.