emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Amin Bandali <aminb@gnu.org>
To: Sven Bretfeld <sven.bretfeld@ntnu.no>, Org-mode <emacs-orgmode@gnu.org>
Subject: Re: Feature request: Maintaining multiple init files with one org file
Date: Sat, 28 Jul 2018 09:53:54 -0400	[thread overview]
Message-ID: <874lgja2kt.fsf@aminb.org> (raw)
In-Reply-To: <87va8ziuem.fsf@ntnu.no>

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

  reply	other threads:[~2018-07-28 13:56 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 [this message]
2018-07-29 10:49   ` Sven Bretfeld
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

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=874lgja2kt.fsf@aminb.org \
    --to=aminb@gnu.org \
    --cc=emacs-orgmode@gnu.org \
    --cc=sven.bretfeld@ntnu.no \
    /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 public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).