From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: dgiglio@iol.it (daniele.g) Newsgroups: gmane.emacs.help Subject: Re: enviromental variables into dot.emacs Date: Mon, 15 Aug 2011 10:47:28 +0200 Message-ID: <871uwnqcwv.fsf@father.nostromo.wy> References: <87sjp42drs.fsf@father.nostromo.wy> <87pqk8t1rb.fsf@thinkpad.tsdh.de> <87fwl3pxbe.fsf@father.nostromo.wy> <87k4afvitv.fsf@googlemail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1313400863 26649 80.91.229.12 (15 Aug 2011 09:34:23 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 15 Aug 2011 09:34:23 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Aug 15 11:34:16 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 1QstYj-0003rc-25 for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Aug 2011 11:34:13 +0200 Original-Received: from localhost ([::1]:34838 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QstYi-0001XM-BV for geh-help-gnu-emacs@m.gmane.org; Mon, 15 Aug 2011 05:34:12 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:52966) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QstYe-0001XD-H0 for help-gnu-emacs@gnu.org; Mon, 15 Aug 2011 05:34:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QstYd-0001Sh-8H for help-gnu-emacs@gnu.org; Mon, 15 Aug 2011 05:34:08 -0400 Original-Received: from lo.gmane.org ([80.91.229.12]:53795) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QstYc-0001SW-OL for help-gnu-emacs@gnu.org; Mon, 15 Aug 2011 05:34:07 -0400 Original-Received: from list by lo.gmane.org with local (Exim 4.69) (envelope-from ) id 1QstYY-0003jU-Pt for help-gnu-emacs@gnu.org; Mon, 15 Aug 2011 11:34:02 +0200 Original-Received: from 94.160.203.80 ([94.160.203.80]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Aug 2011 11:34:02 +0200 Original-Received: from dgiglio by 94.160.203.80 with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 15 Aug 2011 11:34:02 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 38 Original-X-Complaints-To: usenet@dough.gmane.org X-Gmane-NNTP-Posting-Host: 94.160.203.80 Face: iVBORw0KGgoAAAANSUhEUgAAADAAAAAwBAMAAAClLOS0AAAAG1BMVEUFAwFGNgRkUxCEcxSk kxzIsR/EuUz83gT04Uqi58KMAAAACXBIWXMAABwgAAAcIAHND5ueAAABHElEQVQ4y83TsU7DMBAG 4LNJOycIQUfTCqkjlZDKWJBQMxJRNZ270BWEiVeqCL82jhPb53CROvbG+2T/F9uBaqDg7EENQbaj QaacBnUPc3qrFfCShALQErzVK8AFucIA6EqW/1YIAy9bMe+B2kNbh4cYPrs+u+UaQ52CqwSvkKHf ztzBtwh9hjMKQMXKAAKmAVC4EuMaqPA34Cjk2gMatamlg16fvXcgRdRvIwyoXh9u3CHajVjmIXdg P27064KYv48mI9k9OxiFGzwCzzd+smUAKfIwgT0P94Hy59JHT6LH8NWELmz0OgJVQHZnjzHR8fOp 2UEf/e0hkGaWDxh4cCsDjxQsnkJC/+3Sv4FKryoS5EzTEBcCPQTVafAHfzuJduD81s8AAAAPdEVY dEpQRUctUXVhbGl0eQA5MDBR7JEAAAARdEVYdEpQRUctQ29sb3JzcGFjZQAygQ0hJAAAACF0RVh0 SlBFRy1TYW1wbGluZy1mYWN0b3JzADJ4MiwxeDEsMXgx5VHbuAAAAABJRU5ErkJggg== User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.2 (gnu/linux) Cancel-Lock: sha1:gkGjZ04uodFaI1s5HWcHUq0hCX8= X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 80.91.229.12 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:81952 Archived-At: Michael Markert writes: > 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? Oh yesss! > #+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. Indeed, the hostname can be recall using the program hostname. This is the further step, using shell commands within the file. :-) -- - Grazie al cielo, ha lavoro. Chi? - L'astronomo!!