home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / gnu / emacs / help / 5076 < prev    next >
Encoding:
Text File  |  1992-12-14  |  1.3 KB  |  39 lines

  1. Newsgroups: gnu.emacs.help
  2. Path: sparky!uunet!stanford.edu!CSD-NewsHost.Stanford.EDU!times!wmesard
  3. From: wmesard@cs.stanford.edu (Wayne Mesard)
  4. Subject: Re: DIRED Help
  5. In-Reply-To: theobald@ucunix.san.uc.edu's message of Mon, 14 Dec 1992 17:48:59 GMT
  6. Message-ID: <WMESARD.92Dec14121927@Waimea.Stanford.EDU>
  7. Sender: news@CSD-NewsHost.Stanford.EDU
  8. Organization: Distributed Systems Group, Stanford University
  9. References: <Bz9G5o.5BB@ucunix.san.uc.edu>
  10. Distribution: usa
  11. Date: 14 Dec 92 12:19:27
  12. Lines: 25
  13.  
  14. theobald@ucunix.san.uc.edu (Allen M. Theobald) writes:
  15. > What i'd like to know is if there is a[n]... option to run dired
  16. > when [find-file] is given a wildcard in the filename.
  17.  
  18. Well, you could load something like this:
  19.  
  20.   (defun wsm-find-file (filename)
  21.     "Just like find-file, except use dired if FILENAME contains wildcards 
  22.   and specifies a file that doesn't exist."
  23.     (interactive "FFind file: ")
  24.     (if (and (string-match "[*?]" filename) (not (file-exists-p filename)))
  25.     (dired filename)
  26.       (find-file filename)))
  27.  
  28. and bind it in your ~/.emacs file:
  29.  
  30.   (global-set-key "\C-x\C-f" 'wsm-find-file)
  31.  
  32. You may want to add more characters to the reg-exp above depending on
  33. how generously you want to define "wildcard".
  34.  
  35. Disclaimer: minimally tested.  caveat emptor, bonus agricola, etc.
  36. --
  37. Wayne();
  38. WMesard@cs.Stanford.edu
  39.