From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tim Cross Subject: Re: Feature request: Maintaining multiple init files with one org file Date: Sun, 29 Jul 2018 10:06:01 +1000 Message-ID: <87in4yucra.fsf@gmail.com> References: <87va8ziuem.fsf@ntnu.no> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:35774) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fjZE1-0006Fe-CL for emacs-orgmode@gnu.org; Sat, 28 Jul 2018 20:06:18 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fjZE0-0000zB-95 for emacs-orgmode@gnu.org; Sat, 28 Jul 2018 20:06:17 -0400 Received: from mail-pg1-x536.google.com ([2607:f8b0:4864:20::536]:39627) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1fjZE0-0000xA-0H for emacs-orgmode@gnu.org; Sat, 28 Jul 2018 20:06:16 -0400 Received: by mail-pg1-x536.google.com with SMTP id a11-v6so5248204pgw.6 for ; Sat, 28 Jul 2018 17:06:15 -0700 (PDT) In-reply-to: <87va8ziuem.fsf@ntnu.no> 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: Sven Bretfeld Cc: Org-mode I suspect part of the reason org doesn't have specific support for this is because for many, solving the multiple machine/multiple platform/multiple environment issue pre-dates org and so wasn't an itch needing to be scratched. I've been using pretty much the same approach since emacs 21. As your emacs init file is really just a lisp program, it is relatively easy to implement multiple environment support within the file itself, which is what I do. At the start of my init file, I just have some elisp which sets variables representing the platform (linux or mac), the hostname (I have both a linux and mac box at home and work) and the profile (home/work). Then it is just if/cond/when conditionals where needed. I use org to store the file mainly for documentation purposes and will have the same file on all platforms. The advantage is that it is the same file on all platforms, the disadvantage is that it is larger and probably more complex than it would be if you tangled different files per system. For me this is just 6 of one and half a dozen of the other. YMMV. I do find there are some things best set/managed via Emacs' custom facility, so the most useful bit in my init file is the bit which loads different custom files based on the platform. I don't bother keeping the custom files in git, so they stay local to each system. I find using custom to manage face and font settings particularly convenient over managing them by hand in my init file. Tim Sven Bretfeld writes: > Hi > > I don't know how you guys maintain init files for different hosts. I > have one org-file with the header: > > #+PROPERTY: header-args :tangle ~/.emacs > > The file is synced to all my machines and produces the local init files > on each. Most configurations are shared, but some are host-specific > (e.g. font size). > > Sadly export filtering does not work with the tangle function. It would > be nice to be able to do something like: > > ,---- > | * Default Frame > | ** Office Computer :OFFICE: > | #+begin_src emacs-lisp > | (setq default-frame-alist '( > | (font . "-PfEd-DejaVu Sans Mono-normal-normal-normal-*-26-*-*-*-m-0-iso10646-1") > | (width . 102) > | (height . 41)) > | #+end_src > | > | ** Computer at home :HOME: > | #+begin_src emacs-lisp > | (setq default-frame-alist '( > | (font . "-PfEd-DejaVu Sans Mono-normal-normal-normal-*-18-*-*-*-m-0-iso10646-1") > | (width . 150) > | (height . 50)) > | #+end_src > | > | ** Laptop :LAPTOP: > | #+begin_src emacs-lisp > | (setq default-frame-alist '( > | (font . "-PfEd-DejaVu Sans Mono-normal-normal-normal-*-12-*-*-*-m-0-iso10646-1") > | (width . 80) > | (height . 30)) > | #+end_src > `---- > > It should be clear what this is about. On the office computer you would > prepare the file headers to exclude the tags HOME and LAPTOP from being > tangled and, after saving/tangling the file, you would have a nice init > file suiting this computer. At home the same by excluding the other tags > etc. > > This would save a lot of work and you would have a tidy way to maintain > all your init files without (if (string-equal (system-name) clauses. > > If the noexport tag worked, it would also save a lot of time and mess > when debugging your init file in case of an error. > > I don't actually understand why the developers decided not to implement > export filtering in the tangling operations. I know about the COMMENT > keyword, but the above example should make clear that this solution is > far from handy. > > Maybe there is another way that escaped me so far? > > All best, > > Sven -- Tim Cross