From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: build a macro that opens a directory and prompts for file name Date: Fri, 23 Jan 2009 23:16:47 -0800 Message-ID: <00ac01c97df3$cfcca4f0$0200a8c0@us.oracle.com> References: <87f0e43c-d0e9-45eb-8d4f-ae5c7745a2a3@t26g2000prh.googlegroups.com><4r5tz7qrqjh.fsf@one.net> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1232781485 3627 80.91.229.12 (24 Jan 2009 07:18:05 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 24 Jan 2009 07:18:05 +0000 (UTC) To: "'Norm'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sat Jan 24 08:19:17 2009 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.50) id 1LQcnV-0000Zu-Dw for geh-help-gnu-emacs@m.gmane.org; Sat, 24 Jan 2009 08:19:17 +0100 Original-Received: from localhost ([127.0.0.1]:33722 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQcmD-0007TO-59 for geh-help-gnu-emacs@m.gmane.org; Sat, 24 Jan 2009 02:17:57 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LQclo-0007Sc-HH for help-gnu-emacs@gnu.org; Sat, 24 Jan 2009 02:17:32 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LQcln-0007S8-Fp for help-gnu-emacs@gnu.org; Sat, 24 Jan 2009 02:17:31 -0500 Original-Received: from [199.232.76.173] (port=44809 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LQcln-0007Rq-8v for help-gnu-emacs@gnu.org; Sat, 24 Jan 2009 02:17:31 -0500 Original-Received: from acsinet11.oracle.com ([141.146.126.233]:20603) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LQclm-0004ay-Km for help-gnu-emacs@gnu.org; Sat, 24 Jan 2009 02:17:30 -0500 Original-Received: from rgminet15.oracle.com (rcsinet15.oracle.com [148.87.113.117]) by acsinet11.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n0O7JDQ3028587 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Sat, 24 Jan 2009 07:19:14 GMT Original-Received: from acsmt707.oracle.com (acsmt707.oracle.com [141.146.40.85]) by rgminet15.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n0O7HNAH020668; Sat, 24 Jan 2009 07:17:24 GMT Original-Received: from dradamslap1 (/141.144.83.31) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 23 Jan 2009 23:17:20 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: Thread-Index: Acl97Tb8mRIuZegcQ4+Cv0HCxispSgABLBOg X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 X-Source-IP: acsmt707.oracle.com [141.146.40.85] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090206.497AC082.00B0:SCFSTAT928724,ss=1,fgs=0 X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6 (newer, 1) 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:61599 Archived-At: > > > I have been googleing and reading the docs trying to figure out a > > > solution to this. I spend the majority of my time working > > > in a single directory on a CIFS server and I am always doing a > > > C-x C-f \\server\dir\long_sub_dir\subdir\filename > > > > > In the spirit of emacs I'd like to automate it so that > > > when I do C-co it knows the directory and simply prompts me for > > > the file to be opened or if I leave it blank and press RET it > > > lists the directory. > > > > I use bookmarks to take me to the directories themselves. > > Thanks Chris. That is exactly what I need. Wonderful. I too use and recommend using bookmarks. But from your description, all you want is a command that reads a file name in some predefined directory. You can do that just by binding `default-directory' to the directory and calling `find-file': (defun foo () "Visit a file in my favorite directory." (interactive) (let ((default-directory "/my.server.somewhere:/dir/longsubdir/subdir/")) (call-interactively 'find-file)))