From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sven Bretfeld Subject: Re: Feature request: Maintaining multiple init files with one org file Date: Sun, 29 Jul 2018 12:49:53 +0200 Message-ID: <87d0v6joz2.fsf@ntnu.no> References: <87va8ziuem.fsf@ntnu.no> <874lgja2kt.fsf@aminb.org> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40963) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fjjH2-0007i9-A5 for emacs-orgmode@gnu.org; Sun, 29 Jul 2018 06:50:07 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fjjGu-0000Qz-Nz for emacs-orgmode@gnu.org; Sun, 29 Jul 2018 06:50:04 -0400 Received: from mailgw02.it.ntnu.no ([129.241.56.175]:36834) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1fjjGu-0000Q2-F2 for emacs-orgmode@gnu.org; Sun, 29 Jul 2018 06:49:56 -0400 Received: from localhost (localhost [127.0.0.1]) by mailgw02.it.ntnu.no (Postfix) with ESMTP id 35B258019C0 for ; Sun, 29 Jul 2018 12:49:54 +0200 (CEST) Received: from mailgw02.it.ntnu.no ([127.0.0.1]) by localhost (mailgw02.it.ntnu.no [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yKsEG-Cb5_b3 for ; Sun, 29 Jul 2018 12:49:54 +0200 (CEST) Received: from kamaloka (239.228.16.62.customer.cdi.no [62.16.228.239]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: svenbre) by mailgw02.it.ntnu.no (Postfix) with ESMTPSA id EEF7A8018FD for ; Sun, 29 Jul 2018 12:49:53 +0200 (CEST) In-reply-to: <874lgja2kt.fsf@aminb.org> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Org-mode 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