all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* find-file, default path
@ 2005-07-19 12:35 Jan Guido Donath
  2005-07-19 15:46 ` Joe Corneli
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Jan Guido Donath @ 2005-07-19 12:35 UTC (permalink / raw)


hi, 

is it possible to pass find-file a default path?
i do have all my files in a certain directory, but find-file aka C-x C-f
always starts where the emacs bins are located.

greets, 

guido

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: find-file, default path
  2005-07-19 12:35 find-file, default path Jan Guido Donath
@ 2005-07-19 15:46 ` Joe Corneli
  2005-07-19 16:05 ` Alex Schroeder
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 8+ messages in thread
From: Joe Corneli @ 2005-07-19 15:46 UTC (permalink / raw)


Since `find-file' takes an argument, all you have to do is build the
argument using the default path and then pass the argument to
`find-file'.  The way to make this easy is to use `read-file-name'.
E.g. some variant on

(defun find-file-home-directory ()
  (interactive)
  (find-file (read-file-name "File: " "/Users/arided/")))

BTW, I think after you find a file that isn't in the bin dir,
`find-file' will have a new default path.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: find-file, default path
  2005-07-19 12:35 find-file, default path Jan Guido Donath
  2005-07-19 15:46 ` Joe Corneli
@ 2005-07-19 16:05 ` Alex Schroeder
  2005-07-19 16:23   ` Lennart Borgman
  2005-07-19 16:40 ` Kevin Rodgers
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 8+ messages in thread
From: Alex Schroeder @ 2005-07-19 16:05 UTC (permalink / raw)


Jan Guido Donath schrieb:
> is it possible to pass find-file a default path?
> i do have all my files in a certain directory, but find-file aka C-x C-f
> always starts where the emacs bins are located.

Just start emacs from a different directory or with a different "working
directory".

Alex.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: find-file, default path
  2005-07-19 16:05 ` Alex Schroeder
@ 2005-07-19 16:23   ` Lennart Borgman
  0 siblings, 0 replies; 8+ messages in thread
From: Lennart Borgman @ 2005-07-19 16:23 UTC (permalink / raw)
  Cc: help-gnu-emacs

Alex Schroeder wrote:

>Jan Guido Donath schrieb:
>  
>
>>is it possible to pass find-file a default path?
>>i do have all my files in a certain directory, but find-file aka C-x C-f
>>always starts where the emacs bins are located.
>>    
>>
>
>Just start emacs from a different directory or with a different "working
>directory".
>  
>
Or set `default-directory' in your .emacs:

   (setq default-directory "/my/files/directory/")

`default-directory' will later change to the dir of the file you are 
editing.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: find-file, default path
  2005-07-19 12:35 find-file, default path Jan Guido Donath
  2005-07-19 15:46 ` Joe Corneli
  2005-07-19 16:05 ` Alex Schroeder
@ 2005-07-19 16:40 ` Kevin Rodgers
       [not found] ` <mailman.1014.1121792292.20277.help-gnu-emacs@gnu.org>
       [not found] ` <mailman.1008.1121788609.20277.help-gnu-emacs@gnu.org>
  4 siblings, 0 replies; 8+ messages in thread
From: Kevin Rodgers @ 2005-07-19 16:40 UTC (permalink / raw)


Jan Guido Donath wrote:
 > is it possible to pass find-file a default path?
 > i do have all my files in a certain directory, but find-file aka C-x C-f
 > always starts where the emacs bins are located.

No, find-file always prompts with the current directory.  When you have
visited one of the files in your certain directory, it will prompt with
that directory.

If typing that directory name even once is too much, try setting an
environment variable to it so you can reference it: C-x C-f $CERTAIN_DIR 
<tab>

Or try putting this in your ~/.emacs file: (cd 
"/path/to/a/certain/directory")

-- 
Kevin Rodgers

^ permalink raw reply	[flat|nested] 8+ messages in thread

* find-file + bookmarks = true? (was: find-file, default path)
       [not found] ` <mailman.1014.1121792292.20277.help-gnu-emacs@gnu.org>
@ 2005-07-20  6:58   ` Mathias Dahl
  2005-07-20 10:54     ` Emilio Lopes
  0 siblings, 1 reply; 8+ messages in thread
From: Mathias Dahl @ 2005-07-20  6:58 UTC (permalink / raw)


Kevin Rodgers <ihs_4664@yahoo.com> writes:

> If typing that directory name even once is too much, try setting an
> environment variable to it so you can reference it: C-x C-f
> $CERTAIN_DIR <tab>

Slightly off-topic, but for a while I have been wondering if there is
a way to combine `find-file' with bookmarks.

Just for the record I know about C-x r b and all, but many times per
day (yes, I seem to never learn) I find myself using `find-file' to
open some file, and in the instant the prompt appears I remember that
I have a bookmark to the directory where the file I want is.

I have been thinking about writing my own hack to do some kind of
integration between the two functions but have been too lazy... :)

Anyone else doing the same thinking? It would have been really cool to
have something like this. Maybe some "magical" character that
`find-file' reacts to and switch to using bookmarks, or something like
that.

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: find-file, default path
       [not found] ` <mailman.1008.1121788609.20277.help-gnu-emacs@gnu.org>
@ 2005-07-20  9:08   ` Jan Guido Donath
  0 siblings, 0 replies; 8+ messages in thread
From: Jan Guido Donath @ 2005-07-20  9:08 UTC (permalink / raw)


Am 19.07.2005 schrieb Joe Corneli:

> (defun find-file-home-directory ()
>   (interactive)
>   (find-file (read-file-name "File: " "/Users/arided/")))

That was what I was looking for!
Thanks!

Guido

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: find-file + bookmarks = true? (was: find-file, default path)
  2005-07-20  6:58   ` find-file + bookmarks = true? (was: find-file, default path) Mathias Dahl
@ 2005-07-20 10:54     ` Emilio Lopes
  0 siblings, 0 replies; 8+ messages in thread
From: Emilio Lopes @ 2005-07-20 10:54 UTC (permalink / raw)


Mathias Dahl <brakjoller <at> gmail.com> writes:

> Kevin Rodgers <ihs_4664 <at> yahoo.com> writes:
> 
> > If typing that directory name even once is too much, try setting an
> > environment variable to it so you can reference it: C-x C-f
> > $CERTAIN_DIR <tab>
> 
> [...]
> Anyone else doing the same thinking? It would have been really cool to
> have something like this. Maybe some "magical" character that
> `find-file' reacts to and switch to using bookmarks, or something like
> that.

I like the "named dirs" feature of ZSH (http://www.zsh.org).  You can given a
directory a name using the `hash' command, like this:

   % hash -d emacs-cvs=/home/ecl/Emacs/emacs-cvs

Later you can switch to that directory by using:

   % cd ~emacs-cvs

But note that bookmarks can have more complicated names, which might contain
spaces.

Maybe also of interest:

;; From http://www.emacswiki.org/cgi-bin/wiki.pl/GraphicalBookmarkJump
(defun iswitchb-bookmark-jump (bname)
  "*Switch to bookmark interactively using `iswitchb'."
  (interactive 
   (list
    (flet
        ((iswitchb-make-buflist (default)
                                (require 'bookmark)
                                (setq iswitchb-buflist (bookmark-all-names))))
           (iswitchb-read-buffer "Jump to bookmark: "))))
  (bookmark-jump bname))

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-07-20 10:54 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-19 12:35 find-file, default path Jan Guido Donath
2005-07-19 15:46 ` Joe Corneli
2005-07-19 16:05 ` Alex Schroeder
2005-07-19 16:23   ` Lennart Borgman
2005-07-19 16:40 ` Kevin Rodgers
     [not found] ` <mailman.1014.1121792292.20277.help-gnu-emacs@gnu.org>
2005-07-20  6:58   ` find-file + bookmarks = true? (was: find-file, default path) Mathias Dahl
2005-07-20 10:54     ` Emilio Lopes
     [not found] ` <mailman.1008.1121788609.20277.help-gnu-emacs@gnu.org>
2005-07-20  9:08   ` find-file, default path Jan Guido Donath

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.