[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: find-alternate-file from dired wildcard dir

From: Kevin Rodgers
Subject: Re: find-alternate-file from dired wildcard dir
Date: Fri, 12 Apr 2002 10:07:17 -0600

Dan Jacobson wrote:
> find-alternate-file prompts with the current filename -- quite
> helpful.  However if it is in a dired wildcard directory, e,g, from C-x d
> *.c then this doesn't work.  The *.c isn't even available from M-n either.

Here's a workaround to make it available via `M-n':

(defadvice find-alternate-file (around dired-directory activate)
  "Use `dired-directory' as `buffer-file-name' when called interactively."
  (let ((buffer-file-name (and (interactive-p)
                               (stringp dired-directory)

To automatically insert it in the minibuffer, you'd have to copy the entire
9-line `interactive' form from files.el to the advice and add the same
buffer-file-name binding to its `let' form as above.  But then you may as
well just modify files.el instead.

This doesn't handle the case where `dired-directory' is a list, which I
think only occurs when dired is called programmatically anyway.

Kevin Rodgers <address@hidden>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]