From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Markert Newsgroups: gmane.emacs.help Subject: Re: enviromental variables into dot.emacs Date: Sun, 14 Aug 2011 22:28:28 +0200 Message-ID: <87k4afvitv.fsf@googlemail.com> References: <87sjp42drs.fsf@father.nostromo.wy> <87pqk8t1rb.fsf@thinkpad.tsdh.de> <87fwl3pxbe.fsf@father.nostromo.wy> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Trace: dough.gmane.org 1313388208 24872 80.91.229.12 (15 Aug 2011 06:03:28 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 15 Aug 2011 06:03:28 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: dgiglio@iol.it (daniele.g) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Aug 15 08:03:24 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QsqGh-0005TF-Pu for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Aug 2011 08:03:23 +0200 Original-Received: from localhost ([::1]:41734 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QsqGg-0005uh-Fp for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Aug 2011 02:03:22 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:43328) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QshIR-0004ZH-Dt for help-gnu-emacs@gnu.org; Sun, 14 Aug 2011 16:28:36 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QshIQ-0002ZN-1z for help-gnu-emacs@gnu.org; Sun, 14 Aug 2011 16:28:35 -0400 Original-Received: from mail-fx0-f41.google.com ([209.85.161.41]:45160) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QshIP-0002ZF-Ld for help-gnu-emacs@gnu.org; Sun, 14 Aug 2011 16:28:33 -0400 Original-Received: by fxg9 with SMTP id 9so3810986fxg.0 for ; Sun, 14 Aug 2011 13:28:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=30LVLwWUvZcjP74rwd/vkYOLyLMVqSOI7RUBNHsE0cQ=; b=V3Hos7TgtiqJv0oGpImPccwTPGJm2r/ZuHGcOUvLP3Ew20HFjwMoCtocpo4vrnW0Kp sVIw7r25kY0DiyWa+nP5hIY8tcRusiejyn42rZPxYpywFa2LC1/PfMtQg/ycKPBrdhV1 3xyJ/Ke8HkanEm4+AsCwypZLbwGbpTzwnClP0= Original-Received: by 10.223.5.212 with SMTP id 20mr4469894faw.40.1313353712693; Sun, 14 Aug 2011 13:28:32 -0700 (PDT) Original-Received: from localhost (pD9E23E10.dip.t-dialin.net [217.226.62.16]) by mx.google.com with ESMTPS id i16sm4427610faa.21.2011.08.14.13.28.31 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 14 Aug 2011 13:28:31 -0700 (PDT) In-Reply-To: <87fwl3pxbe.fsf@father.nostromo.wy> (daniele g.'s message of "Sun, 14 Aug 2011 22:12:05 +0200") User-Agent: Gnus/5.110018 (No Gnus v0.18) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.41 X-Mailman-Approved-At: Mon, 15 Aug 2011 02:03:17 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:81950 Archived-At: --=-=-= Content-Type: text/plain On 14 Aug 2011, daniele g. wrote: > There was a misunderstanding. I don't want to set an enviromental > variable, I want to _read_ it. For example, I want set up my email > address for Gnus from $USER and $HOSTNAME values. I know I can use > getenv to read them, but I don't know how to use them in my dot-emacs. > > My aim is to unify my conf files making them picking as many values as > possible from the same place. Do you think of this? #+begin_src emacs-lisp (cond ((and (string= (getenv "USER") "johndoe") (string= (getenv "HOSTNAME") "bar")) (setq user-mail-address "johndow@bar.com") (require 'john)) ((and (string= (getenv "USER") "janedoe") (string= (getenv "HOSTNAME") "bar")) (setq user-mail-address "johndow@bar.com") (require 'jane)) (t (setq user-mail-address (concat (getenv "USER") "@" (getenv "HOSTNAME"))))) #+end_src emacs-lisp But note that $HOSTNAME is often not set. You can use `system-name' here. Michael --=-=-= Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) iQIcBAEBCAAGBQJOSC/sAAoJEHHMVUK0UjKVs5AP/0ImqekxNZCLuGRNkHHXCfuS DJeo6IE8ZVu2vJJfkLD9Z8PZ3lFe5oZkcKDpfsRKkSljHqVSQ5mgpmq1wd9m3ZO2 uImlQqJH6VMRT6UAsP11I9UTQJGqGwTgm2qbWOSXnIlNDl7AJHVJnH+iFvS6VjP0 W2PLShbtgiLJHFYtP3+IYlgCapeeNEICHPC+9S8RqBE2VE/BjWyAtTAXt7t8pZn9 3a9+BL7dMwckXlqcF+Mthhi7Q+Q7g6rw4N9LoD532HISLFqI72y5G8PxmVNeP+Of i/qTsHnhCrPGAyA6gAFfLL1UM4eXfRFFGOdD2yty7LJ36Va7XgqGM2PEfecyDdcX 4azKzgk5evSQB00CeVxdOGWSZwLvtrm2yDnJZ+f7gOLn11OQsJgXPUylQVge70iI elOuO3XrH7Wpf7usCKsmBl7Cdk7HzaOWyw80ZV89/6f5JKvOdF3Krq2o8RmO4Lw8 CoD7MwDv/Vz86TZOHNUJf1luFJqkQFCpBkfxpCRgtULqkEVcRboznFCxNBRZC0wn vP2joEjIiG2fMuL6QEmnP2O9R/i0+k6Cwpg6FGZHC+BMX1/b0GJju/3rKQnWaQUg Ze6Py5IUKzyiyai1MdM4S+VP8893+FVBgJT+PuYji98HuKg2fJMGxQKVTKmnQ+Ig +KJauk5jfRAvoD2smW5x =SHjB -----END PGP SIGNATURE----- --=-=-=--