🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.help
Article #1946

Re: DIRED Help

#1946
From: Wayne Mesard
Date: Mon, 14 Dec 1992 12:19
25 lines
1376 bytes
theobald@ucunix.san.uc.edu (Allen M. Theobald) writes:
> What i'd like to know is if there is a[n]... option to run dired
> when [find-file] is given a wildcard in the filename.

Well, you could load something like this:

  (defun wsm-find-file (filename)
    "Just like find-file, except use dired if FILENAME contains wildcards 
  and specifies a file that doesn't exist."
    (interactive "FFind file: ")
    (if (and (string-match "[*?]" filename) (not (file-exists-p filename)))
	(dired filename)
      (find-file filename)))

and bind it in your ~/.emacs file:

  (global-set-key "\C-x\C-f" 'wsm-find-file)

You may want to add more characters to the reg-exp above depending on
how generously you want to define "wildcard".

Disclaimer: minimally tested.  caveat emptor, bonus agricola, etc.
--
Wayne();
WMesard@cs.Stanford.edu
Technical Details
Message-ID: <WMESARD.92Dec14121927@Waimea.Stanford.EDU>
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!CSD-NewsHost.Stanford.EDU!times!wmesard
References: <Bz9G5o.5BB@ucunix.san.uc.edu>

Show Full Headers
Complete Article Headers
Newsgroups: gnu.emacs.help
Path: arc1-ca.pugleaf.net!sparky!uunet!stanford.edu!CSD-NewsHost.Stanford.EDU!times!wmesard
From: wmesard@cs.stanford.edu (Wayne Mesard)
Subject: Re: DIRED Help
In-Reply-To: theobald@ucunix.san.uc.edu's message of Mon, 14 Dec 1992 17:48:59 GMT
Message-ID: <WMESARD.92Dec14121927@Waimea.Stanford.EDU>
Sender: news@CSD-NewsHost.Stanford.EDU
Organization: Distributed Systems Group, Stanford University
References: <Bz9G5o.5BB@ucunix.san.uc.edu>
Distribution: usa
Date: 14 Dec 92 12:19:27
Lines: 25