all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Looking for CDPATH functionality in emacs.
@ 2011-01-03 18:55 Steven W. Orr
  2011-01-03 19:08 ` Thien-Thi Nguyen
                   ` (5 more replies)
  0 siblings, 6 replies; 9+ messages in thread
From: Steven W. Orr @ 2011-01-03 18:55 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 2388 bytes --]

This is a bit long, so all I can do is apologise.

I have a number of directories that I use frequently. From the bash side of
things I set the CDPATH variable in bash to :d1:d2:d3 and then I can just go
to places inside d[123] and it just works. I also have the bash variable
cdable_vars set to allow me to say

d4=/path/to/d4

followed by

cd d4

and it all works peachy keen.

What I'd like to do in emacs is to be able to visit a file in some directory
that I favor (somehow) so that it will automagically find it without having to
slog through the whole path to get there.

I did find file-cache-find-directory which looks like it's half of what I
want. But that has two problems:

1. I added this to my .emacs

(file-cache-add-directory "/path/to/special/dir")

I saw no special behavior when I ran this, either from my .emacs or interactively.

2. I normally visit files using my own my-visit-file function:

(defun my-visit-file (arg)
  "Visit a file using completion. If there is only one window with
nothing in it, then do not split the current window. "
  (interactive "Fmy-visit-file :")
  (if (and (one-window-p) (zerop (buffer-size)))
      (find-file arg t)
      (find-file-other-window arg t)))

I use this function so that if I visit a file from an empty buffer, I won't
end up with two windows.

The problem is that if I had run file-cache-add-directory, the find-file
function starts in the directory of where the current buffer is. I'd like to
make it so that if I supplied a C-u to my-visit-file then it would *not* start
from that current directory. Instead, it should give me a prompt as if I had
done a C-a C-k to get rid of the directory.

So, if you made it this far, here's the recap:

1. Does anything already exist that smells like what I want?
2. Can I fix my-visit-file so that a C-u will prevent the default prompt from
being the current directory of the file I'm starting from? (But I do still
want filename completion.)
3. Does anyone have a better idea?

MTIA :-)

-- 
Time flies like the wind. Fruit flies like a banana. Stranger things have  .0.
happened but none stranger than this. Does your driver's license say Organ ..0
Donor?Black holes are where God divided by zero. Listen to me! We are all- 000
individuals! What if this weren't a hypothetical question?
steveo at syslang.net


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 261 bytes --]

^ permalink raw reply	[flat|nested] 9+ messages in thread
[parent not found: <mailman.12.1294080915.3992.help-gnu-emacs@gnu.org>]

end of thread, other threads:[~2011-01-06  9:40 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-03 18:55 Looking for CDPATH functionality in emacs Steven W. Orr
2011-01-03 19:08 ` Thien-Thi Nguyen
2011-01-03 19:20 ` Drew Adams
2011-01-03 20:16 ` Peter Dyballa
2011-01-04  4:42 ` Le Wang
2011-01-04  9:43   ` Le Wang
2011-01-04  5:55 ` Kevin Rodgers
2011-01-06  0:37 ` DevZero
     [not found] <mailman.12.1294080915.3992.help-gnu-emacs@gnu.org>
2011-01-06  9:40 ` Stefan Kamphausen

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.