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: Mon, 26 Jan 2009 10:15:50 -0800 Message-ID: <003b01c97fe2$1ea731e0$c2b22382@us.oracle.com> References: <87f0e43c-d0e9-45eb-8d4f-ae5c7745a2a3@t26g2000prh.googlegroups.com><4r5tz7qrqjh.fsf@one.net> <7cwscil6fu.fsf@pbourguignon.anevia.com> 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 1232998739 32521 80.91.229.12 (26 Jan 2009 19:38:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 26 Jan 2009 19:38:59 +0000 (UTC) To: "'Pascal J. Bourguignon'" , Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jan 26 20:40:12 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 1LRXJR-0004xU-0Z for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Jan 2009 20:40:01 +0100 Original-Received: from localhost ([127.0.0.1]:46485 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LRXI9-0004zP-7t for geh-help-gnu-emacs@m.gmane.org; Mon, 26 Jan 2009 14:38:41 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LRW05-000360-7B for help-gnu-emacs@gnu.org; Mon, 26 Jan 2009 13:15:57 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LRW04-00035c-9X for help-gnu-emacs@gnu.org; Mon, 26 Jan 2009 13:15:56 -0500 Original-Received: from [199.232.76.173] (port=53709 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LRW03-00035P-VD for help-gnu-emacs@gnu.org; Mon, 26 Jan 2009 13:15:56 -0500 Original-Received: from acsinet11.oracle.com ([141.146.126.233]:26106) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LRW03-0000T0-D9 for help-gnu-emacs@gnu.org; Mon, 26 Jan 2009 13:15:55 -0500 Original-Received: from acsinet13.oracle.com (acsinet13.oracle.com [141.146.126.235]) by acsinet11.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n0QIHjUP032486 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 26 Jan 2009 18:17:46 GMT Original-Received: from acsmt706.oracle.com (acsmt706.oracle.com [141.146.40.84]) by acsinet13.oracle.com (Switch-3.3.1/Switch-3.3.1) with ESMTP id n0QIFo5u029854; Mon, 26 Jan 2009 18:15:52 GMT Original-Received: from dradamslap1 (/130.35.178.194) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Mon, 26 Jan 2009 18:15:49 +0000 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <7cwscil6fu.fsf@pbourguignon.anevia.com> Thread-Index: Acl/4Wlu/kgdE46FQs+3sotBUPiLewAAC1tQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350 X-Source-IP: acsmt706.oracle.com [141.146.40.84] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A010205.497DFDD7.007A: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:61663 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': > > This is not even needed! > You only have to type C-x C-f, that's all. By default it is in the > default-directory, which is a buffer local variable, so if your > current buffer is in the right directory, you've got nothing more to > do. > > So the answer, and you won't say you've not been warned, is not to > kill your old buffers! Just leave them alone in emacs. Thus, with > your old buffer in the right directory, you just type C-x C-f and the > other file name. > > If you really need to kill your buffer before opening another file, > you could open a directory buffer: > C-x C-f \\server\dir\long_sub_dir\subdir\ RET > > Note that in this directory buffer you may just click (or type RET) on > a file to open it. > > Also, you could use some more sophisticated package such as speedbar, > but it would be overkill... All of what Pascal says is true and pertinent. FYI, you can also just use Emacs (yes, Emacs) command `cd' to change the `default-directory' at any time. No need to open a Dired buffer.