phs@lifia.imag.fr (Philippe Schnoebelen) (02/13/89)
Is there any hook, regexp, alist or whatever trick available to tell Dired not to list files such and such ? [ For example, I can imagine situations where I would like the *.c and *.h files to be displayed (with also core and Makefile :-) but not the *.o. Similarly when editing TeX files, I do not need the *.aux, *.log, *.blg, ... to be listed. This is just a matter of having everything fitting in the window for easy selection. ] Surely, there must exist something like that ! --Philippe
mesard@bbn.com (Wayne Mesard) (02/14/89)
In article <5318@lifia.imag.fr> phs@lifia.imag.fr (Philippe Schnoebelen) writes: > >Is there any hook, regexp, alist or whatever trick available to tell Dired >not to list files such and such ? How about the more straight-forward approach: ask and you shall receive. > [ For example, I can imagine situations >where I would like the *.c and *.h files to be displayed (with also core >and Makefile :-) but not the *.o. M-x dired {core,Makefile,*.[ch]} If you looked in dired.el, you'd see that dired calls the shell specified in the variable shell-file-name to expand the specified file name(s) and then invoke ls(1) on them. So if your usual shell is the C-shell or one of its derivatives, the above will work. If you use a dain-bramaged shell like /bin/sh [[oh no, not another shell war, "They're shelling us from being those Vaxen, sir!" That was a Korny joke, I must say.]] you can tell Emacs to use the C-shell by putting the following line in your ~/.emacs [[uh, sorry, that's $HOME/.emacs]] file: (setq shell-file-name "/bin/csh") -- unsigned *Wayne_Mesard(); MESARD@BBN.COM BBN, Cambridge, MA
Ram-Ashwin@cs.yale.edu (Ashwin Ram) (02/15/89)
In article <35981@bbn.COM>, mesard@bbn.com (Wayne Mesard) writes: > In article <5318@lifia.imag.fr> phs@lifia.imag.fr (Philippe Schnoebelen) writes: > >Is there any hook, regexp, alist or whatever trick available to tell Dired > >not to list files such and such ? > > How about the more straight-forward approach: ask and you shall receive. > > > [ For example, I can imagine situations > >where I would like the *.c and *.h files to be displayed (with also core > >and Makefile :-) but not the *.o. > > M-x dired {core,Makefile,*.[ch]} I think I would prefer the less straight-forward approach :-). I would prefer to be able to specify a list of dired-ignored-extensions, similar to completion-ignored-extensions, once and for all. It's easier to ^X^F a directory to enter dired instead of typing M-x dired {core,Makefile,*.[ch]} each time. Come to think of it, one would usually want dired-ignored-extensions to be the same as completion-ignored-extensions, no? -- Ashwin.
mesard@bbn.com (Wayne Mesard) (02/15/89)
In article <50608@yale-celray.yale.UUCP> Ram-Ashwin@cs.yale.edu (Ashwin Ram) writes: > I would >prefer to be able to specify a list of dired-ignored-extensions, similar to >completion-ignored-extensions, once and for all. It's easier to ^X^F a >directory to enter dired instead of typing M-x dired {core,Makefile,*.[ch]} >each time. > Agreed, but would you really want to ignore the same exact file name patterns *all the time*? Or more would you have two or three complex patterns which are each called for fairly frequently (as is implied by the original article)? If the latter, then it would be trivial to define one line functions which call dired with the appropriate complex pattern. Heck, you can even bind them to keys, thus restoring the ease of control key invocation. >Come to think of it, one would usually want dired-ignored-extensions to be >the same as completion-ignored-extensions, no? Not if I was dired'ing in order to, for example, delete backup (tilde) files. [And no, I don't know why I'm fighting about this.] -- unsigned *Wayne_Mesard(); MESARD@BBN.COM BBN, Cambridge, MA
Ram-Ashwin@cs.yale.edu (Ashwin Ram) (02/15/89)
In article <36009@bbn.COM>, mesard@bbn.com (Wayne Mesard) writes: > In article <50608@yale-celray.yale.UUCP> Ram-Ashwin@cs.yale.edu (Ashwin Ram) writes: > >prefer to be able to specify a list of dired-ignored-extensions, similar to > >completion-ignored-extensions, once and for all. It's easier to ^X^F a > >directory to enter dired instead of typing M-x dired {core,Makefile,*.[ch]} > >each time. > > Agreed, but would you really want to ignore the same exact file name > patterns *all the time*? Or more would you have two or three complex > patterns which are each called for fairly frequently (as is implied by > the original article)? Probably the former in my case. I can't see any harm in adding dired-ignored-extensions -- if you prefer not to use this feature, you can just let this list be nil. -- Ashwin.
gudeman@arizona.edu (David Gudeman) (02/15/89)
In article <5318@lifia.imag.fr> phs@lifia.imag.fr (Philippe Schnoebelen) writes: > >Is there any hook, regexp, alist or whatever trick available to tell Dired >not to list files such and such ? ... Surely, >there must exist something like that ! I don't think there was. But here is something you can use: ---------------------------------------------------------------- ;; David Gudeman gudeman@arizona.edu (define-key dired-mode-map "l" 'dired-erase-extensions) ;; Uncomment this if you want dired-erase-extensions to work ;; automatically when you call dired. ;(fset 'dired-readin ; (append (symbol-function 'dired-readin) ; (cdr (cdr (cdr (symbol-function 'dired-erase-extensions)))))) (defun dired-erase-extensions () "Remove all files that match completion-ignored-extensions. If dired-ignored-extensions is defined, then use that instead." (interactive) (let ((ls (if (boundp 'dired-ignored-extensions) dired-ignored-extensions completion-ignored-extensions)) (buffer-read-only)) (save-excursion (goto-char (point-min)) (while ls (delete-matching-lines (concat (regexp-quote (car ls)) "[*|=/]?$")) (setq ls (cdr ls))))))
rbj@nav.icst.nbs.GOV (Root Boy Jim) (03/11/89)
? From: Philippe Schnoebelen <mcvax!inria!imag!lifia!phs@uunet.uu.net> ? Reply-To: Philippe Schnoebelen <phs@lifia.imag.fr> ? Organization: Lab. LIFIA -- Univ. Grenoble ? Is there any hook, regexp, alist or whatever trick available to tell Dired ? not to list files such and such ? [ For example, I can imagine situations ? where I would like the *.c and *.h files to be displayed (with also core ? and Makefile :-) but not the *.o. Similarly when editing TeX files, I do ? not need the *.aux, *.log, *.blg, ... to be listed. This is just a matter ? of having everything fitting in the window for easy selection. ] Surely, ? there must exist something like that ! ? --Philippe Here is part of my dired-hook.el, loaded from .emacs. (defun dired-mode-hook () "Define dired extensions" (setq case-fold-search t) ; why is this set to nil? (define-key dired-mode-map "k" 'dired-kill-files) (define-key dired-mode-map "K" 'dired-kill-line) (define-key dired-mode-map "l" 'dired-relist) (define-key dired-mode-map "R" 'dired-rmail) (define-key dired-mode-map "j" 'dired-find-file) ; an alias (setq dired-mode-hook nil)) (defun dired-kill-files (regexp) ; k "Kill lines matching REGEXP" (interactive "sRegexp: ") (let ((buffer-read-only nil)) (beginning-of-buffer) ; probably should be (goto-char 1) (delete-matching-lines regexp)) (set-mark-command t)) ; then we wouldn't need this (defun dired-kill-line () ; K from gosmacs "Kill this Line, but not this File." (interactive) (let ((buffer-read-only nil)) (dired-redisplay nil))) (defun dired-relist () ; l "Relist this file" (interactive) (let ((buffer-read-only nil)) (dired-redisplay (dired-get-filename)))) (defun dired-rmail () ; R quite useful! "Run `rmail' on this file" (interactive) (let ((buffer-read-only nil) (buffer (current-buffer)) (file (dired-get-filename))) (rmail file) (recursive-edit) (switch-to-buffer buffer) (dired-redisplay file))) Catman Rshd <rbj@nav.icst.nbs.gov> Author of "The Daemonic Versions"