From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Matt Brown Newsgroups: gmane.emacs.help Subject: defining functions in emacs Date: Tue, 24 Jan 2006 13:40:35 -0800 Message-ID: <43D69ED3.6070005@ucsc.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1138143769 14140 80.91.229.2 (24 Jan 2006 23:02:49 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 24 Jan 2006 23:02:49 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Wed Jan 25 00:02:46 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F1XBQ-0004jk-GT for geh-help-gnu-emacs@m.gmane.org; Wed, 25 Jan 2006 00:02:41 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F1XBj-0001nA-Lf for geh-help-gnu-emacs@m.gmane.org; Tue, 24 Jan 2006 18:02:59 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F1Wxz-0002RP-Hi for help-gnu-emacs@gnu.org; Tue, 24 Jan 2006 17:48:47 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F1Wxw-0002Pz-6Y for help-gnu-emacs@gnu.org; Tue, 24 Jan 2006 17:48:46 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F1WZg-0001r9-Vp for help-gnu-emacs@gnu.org; Tue, 24 Jan 2006 17:23:41 -0500 Original-Received: from [128.114.125.40] (helo=smtp-test-1.ucsc.edu) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1F1WFM-00036Z-DP for help-gnu-emacs@gnu.org; Tue, 24 Jan 2006 17:02:40 -0500 Original-Received: from ucsc.edu (cruzmail-fe1.ucsc.edu [128.114.125.5]) by smtp-test-1.ucsc.edu (8.13.1/8.13.1) with ESMTP id k0OLeZWv021379 for ; Tue, 24 Jan 2006 13:40:35 -0800 (PST) Original-Received: from [64.164.31.160] (account mbrown83@ucsc.edu HELO [192.168.0.50]) by copper.ucsc.edu (CommuniGate Pro SMTP 4.3.7) with ESMTPSA id 43731853 for help-gnu-emacs@gnu.org; Tue, 24 Jan 2006 13:40:35 -0800 User-Agent: Debian Thunderbird 1.0.2 (X11/20050817) X-Accept-Language: en-us, en Original-To: help-gnu-emacs@gnu.org X-UCSC-CATS-Information: This message was scanned by the ITS MailScanner X-UCSC-CATS-MailScanner: Found to be clean X-UCSC-CATS-MailScanner-SpamCheck: X-UCSC-CATS-MailScanner-From: mbrown83@ucsc.edu 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:32833 Archived-At: Hi everyone I wrote my first emacs function! Here's my function: (defun read-environment () (setq outbuf (generate-new-buffer "read-environment-outbuf")) (call-process "read-environment.sh" nil outbuf nil) (eval-buffer outbuf) (kill-buffer outbuf)) It uses read-environment.sh to generate a whole bunch of setenv lines, and then evaluates them. Basically, it sources .bashrc and sets the new variables in emacs. It works fine, but I want to be able to run it by M-x read-environment This doesn't work. I have to put (read-environment) into *scratch*, move to the ')' and do C-x C-e to evaluate it. Pretty lame. From the digging around I've done, it seems like it should just work. Any ideas? BTW, the defun is in my .emacs Thanks Matt