all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Pascal J. Bourguignon'" <pjb@informatimago.com>,
	<help-gnu-emacs@gnu.org>
Subject: RE: build a macro that opens a directory and prompts for file name
Date: Mon, 26 Jan 2009 10:15:50 -0800	[thread overview]
Message-ID: <003b01c97fe2$1ea731e0$c2b22382@us.oracle.com> (raw)
In-Reply-To: <7cwscil6fu.fsf@pbourguignon.anevia.com>

> >> > > 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.





  reply	other threads:[~2009-01-26 18:15 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-01-23 15:13 build a macro that opens a directory and prompts for file name Norm
2009-01-23 15:27 ` Chris McMahan
2009-01-23 15:38   ` Norm
2009-01-24  7:16     ` Drew Adams
     [not found]     ` <mailman.5627.1232781454.26697.help-gnu-emacs@gnu.org>
2009-01-26 10:15       ` Pascal J. Bourguignon
2009-01-26 18:15         ` Drew Adams [this message]
     [not found]         ` <mailman.5864.1232993759.26697.help-gnu-emacs@gnu.org>
2009-01-27 10:04           ` Stefan Kamphausen
2009-01-27 10:45             ` roodwriter
2009-01-28  8:09               ` Kevin Rodgers
2009-01-29 13:08 ` Sebastian Tennant

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='003b01c97fe2$1ea731e0$c2b22382@us.oracle.com' \
    --to=drew.adams@oracle.com \
    --cc=help-gnu-emacs@gnu.org \
    --cc=pjb@informatimago.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.