From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: C K Kashyap Newsgroups: gmane.emacs.help Subject: Re: A question about interactive Date: Fri, 22 Mar 2013 12:29:31 +0530 Message-ID: References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7bd6ae8045b28904d87dff48 X-Trace: ger.gmane.org 1363935584 13004 80.91.229.3 (22 Mar 2013 06:59:44 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 22 Mar 2013 06:59:44 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Drew Adams Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Mar 22 08:00:10 2013 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UIvxQ-0004fU-TM for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Mar 2013 08:00:09 +0100 Original-Received: from localhost ([::1]:33238 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIvx3-0001fW-GB for geh-help-gnu-emacs@m.gmane.org; Fri, 22 Mar 2013 02:59:45 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:52611) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIvws-0001fR-9F for help-gnu-emacs@gnu.org; Fri, 22 Mar 2013 02:59:35 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UIvwr-00015X-6I for help-gnu-emacs@gnu.org; Fri, 22 Mar 2013 02:59:34 -0400 Original-Received: from mail-qc0-x232.google.com ([2607:f8b0:400d:c01::232]:34595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UIvwr-00015T-1C for help-gnu-emacs@gnu.org; Fri, 22 Mar 2013 02:59:33 -0400 Original-Received: by mail-qc0-f178.google.com with SMTP id d10so1089823qca.37 for ; Thu, 21 Mar 2013 23:59:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=IwZ5X0DaKINQ8iCMNCBk3TAL9GekzfuWOFa9fhluOKw=; b=YTb7of/IMuCpbEYjyplS6HCkv2SAn/Cti+WGccgzdHuWcFTUwdubnIEnxRzSjv+q+E u5YQikDpjWzA9U20ZOTedpC2jDM+odQhspSa1Yruyl/LxRof7T3Z78uMWQqZgK/s0nHi Lr442/zR0BKk2AFUdXgYMpCTkGvdvhFfdripKLW2Lka6cwsBhbY1WCi0PObDoNfIVifV 6I19f8g0zvUsvLrazSufk1Eb4yIUSJsm6k1rvqpIuzx2zvup5p7/P8aSGBT1JCdLyChz 0yEBaAgIMqnDnFHpJLpwewbfch3w48gjTrV31vS7A0vXV/IifDdIaVj6U8EOnwPxxY7E WFlw== X-Received: by 10.49.15.198 with SMTP id z6mr267867qec.6.1363935572100; Thu, 21 Mar 2013 23:59:32 -0700 (PDT) Original-Received: by 10.229.34.3 with HTTP; Thu, 21 Mar 2013 23:59:31 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:400d:c01::232 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:89654 Archived-At: --047d7bd6ae8045b28904d87dff48 Content-Type: text/plain; charset=ISO-8859-1 Thanks a lot Drew ... using read-file-name worked for me (defun f () (interactive) (setq fn (read-file-name "Enter filename" "C:/")) (insert fn) ) I did not have to do the let-binding of default-directory - actually I do not know how to do it either. It'll be great if you could show me what you meant. Regards, Kashyap On Thu, Mar 21, 2013 at 6:54 PM, Drew Adams wrote: > > Here's what I want to do - I'd like to write utility > > functions in different el files and store them in a > > particular directory. then write a function in .emacs > > - say - my-script-load ... What I'd like it to do is > > this: (interactive "fEnter script name: ") > > > > Now, the problem is that the ineractive "f" seems to > > use the current buffer location as the starting point. > > How can I change that? > > In the `interactive' spec, let-bind `default-directory' and then read the > file > name with `read-file-name'. See the doc for `interactive'. > > --047d7bd6ae8045b28904d87dff48 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Thanks a lot Drew ... using read-file-name worked for me= =A0

(defun f ()
=A0 (interactive)
=A0 (setq fn (read-file-name "Enter filename" "C:/")= )
=A0 (insert fn)
)

I did= not have to do the let-binding of default-directory - actually I do not kn= ow how to do it either. It'll be great if you could show me what you me= ant.

Regards,
Kashyap
=
--047d7bd6ae8045b28904d87dff48--