From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Sebastian Tennant Newsgroups: gmane.emacs.help Subject: Re: build a macro that opens a directory and prompts for file name Date: Thu, 29 Jan 2009 13:08:22 +0000 Message-ID: <8wou6z09.fsf@vps203.linuxvps.org> References: <87f0e43c-d0e9-45eb-8d4f-ae5c7745a2a3@t26g2000prh.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1233234424 28205 80.91.229.12 (29 Jan 2009 13:07:04 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 29 Jan 2009 13:07:04 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jan 29 14:08: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 1LSWcr-0003WG-F2 for geh-help-gnu-emacs@m.gmane.org; Thu, 29 Jan 2009 14:08:09 +0100 Original-Received: from localhost ([127.0.0.1]:43241 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LSWbZ-0000zr-B6 for geh-help-gnu-emacs@m.gmane.org; Thu, 29 Jan 2009 08:06:49 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LSWbI-0000zh-5d for help-gnu-emacs@gnu.org; Thu, 29 Jan 2009 08:06:32 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LSWbG-0000zV-N1 for help-gnu-emacs@gnu.org; Thu, 29 Jan 2009 08:06:31 -0500 Original-Received: from [199.232.76.173] (port=41972 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LSWbG-0000zS-JV for help-gnu-emacs@gnu.org; Thu, 29 Jan 2009 08:06:30 -0500 Original-Received: from main.gmane.org ([80.91.229.2]:38430 helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LSWbF-0002qe-Ub for help-gnu-emacs@gnu.org; Thu, 29 Jan 2009 08:06:30 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1LSWbE-000741-3y for help-gnu-emacs@gnu.org; Thu, 29 Jan 2009 13:06:28 +0000 Original-Received: from vps203.linuxvps.org ([91.186.7.203]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 29 Jan 2009 13:06:28 +0000 Original-Received: from sebyte by vps203.linuxvps.org with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Thu, 29 Jan 2009 13:06:28 +0000 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 42 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: vps203.linuxvps.org X-Host: localhost User-Agent: Gnus/5.110011 (No Gnus v0.11) Emacs/22.2 (gnu/linux) Cancel-Lock: sha1:XRf+Z6l1+mz2XxHtk/wHWXe381s= X-detected-operating-system: by monty-python.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) 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:61752 Archived-At: Quoth Norm : > 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. > > Any suggestions on how to accomplish this. I don't have time to read this (fairly long) thread but I've been using a (tiny) macro for years which I think may meet your needs perfectly. You can get it from here: http://article.gmane.org/gmane.emacs.sources/3157 In your case, you could define a command 'M-x cifs' in your ~/.emacs like so: (require 'commandir) (commandir cifs ; command name "CIFS hosted filename: " ; prompt "\\server\dir=long_sub_dir\subdir" ; directory "