From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Thien-Thi Nguyen Newsgroups: gmane.emacs.help Subject: Re: Looking for CDPATH functionality in emacs. Date: Mon, 03 Jan 2011 20:08:58 +0100 Message-ID: <87pqsd6bzp.fsf@ambire.localdomain> References: <4D221B85.5040702@syslang.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Trace: dough.gmane.org 1294082095 20764 80.91.229.12 (3 Jan 2011 19:14:55 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 3 Jan 2011 19:14:55 +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 Jan 03 20:14:50 2011 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1PZprk-0004u7-5T for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Jan 2011 20:14:48 +0100 Original-Received: from localhost ([127.0.0.1]:55094 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZprj-0002Sr-AS for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Jan 2011 14:14:47 -0500 Original-Received: from [140.186.70.92] (port=54975 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PZprA-0002Pl-Je for help-gnu-emacs@gnu.org; Mon, 03 Jan 2011 14:14:13 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PZpr9-00080A-NQ for help-gnu-emacs@gnu.org; Mon, 03 Jan 2011 14:14:12 -0500 Original-Received: from smtp207.alice.it ([82.57.200.103]:45488) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PZpr9-0007zv-DU for help-gnu-emacs@gnu.org; Mon, 03 Jan 2011 14:14:11 -0500 Original-Received: from ambire.localdomain (95.245.72.7) by smtp207.alice.it (8.5.124.08) id 4C9E16C907F8F621 for help-gnu-emacs@gnu.org; Mon, 3 Jan 2011 20:14:09 +0100 Original-Received: from ttn by ambire.localdomain with local (Exim 4.69) (envelope-from ) id 1PZpm7-0008Qh-7d for help-gnu-emacs@gnu.org; Mon, 03 Jan 2011 20:08:59 +0100 In-Reply-To: <4D221B85.5040702@syslang.net> (Steven W. Orr's message of "Mon, 03 Jan 2011 13:55:01 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:78128 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable () "Steven W. Orr" () Mon, 03 Jan 2011 13:55:01 -0500 1. Does anything already exist that smells like what I want? Probably smells regardless, but FWIW, i use =E2=80=98jamenv-from-file=E2=80= =99 (attached) with a ~/.directory-env-vars that looks like: --8<---------------cut here---------------start------------->8--- ;;; -*- emacs-lisp -*- ;;; comments start with ";" ;;; lines of form "- VAR" clear env var VAR ;;; lines of form "VAR VALUE" set env var VAR to VALUE ;; clear - OLDPWD - PAGER - PWD ;; set D ~/build/tastiera-dura G ~/build/GNU GG ~/build/GNU/GG --8<---------------cut here---------------end--------------->8--- Then, to get to, say ~/build/GNU, i type =E2=80=98C-x C-f $G RET=E2=80=99. --=-=-= Content-Type: application/emacs-lisp Content-Disposition: attachment; filename=jamenv.el Content-Transfer-Encoding: quoted-printable ;;; jamenv.el ;;; ;;; Copyright (C) 2002, 2003, 2004, 2007, 2008 Thien-Thi Nguyen ;;; ;;; This file is part of ttn's personal elisp library, released under ;;; the terms of the GNU General Public License as published by the ;;; Free Software Foundation; either version 3, or (at your option) any ;;; later version. There is NO WARRANTY. See file COPYING for details. ;;; Description: Function to clear and set env vars. (require 'map-table) ;;;###autoload (defun jamenv (clear set) "Clear env vars in CLEAR and set env vars in SET. CLEAR is a list of symbols. SET is a list of symbols, alternating name and value, name first, similar to a plist." (mapc 'setenv (mapcar 'symbol-name clear)) (map-table-2col (lambda (varsym valsym) (setenv (symbol-name varsym) (symbol-name valsym))) set)) ;;;###autoload (defun jamenv-buffer () "Run `jamenv' on current-buffer." (interactive) (save-excursion (goto-char (point-min)) (let (clear set) (ignore-errors (while t (let ((a (read (current-buffer))) (b (read (current-buffer)))) (if (eq '- a) (setq clear (cons b clear)) (setq set (cons b (cons a set))))))) (jamenv (reverse clear) (reverse set)) (message "%s cleared, %s set" (length clear) (length set))))) ;;;###autoload (defun jamenv-from-file (file) "Read FILE and call `jamenv' on its contents. Lines beginning with \";\" are comments. Lines of the form \"- VAR\" mean to clear env var VAR. Lines of the form \"VAR VAL\" mean to set env var VAR to value VAL." (interactive "fDo `jamenv' on file: ") (with-temp-buffer (insert-file-contents file) (jamenv-buffer))) (provide 'jamenv) ;;;------------------------------------------------------------------------= --- ;;; jamenv.el ends here --=-=-=--