Übersicht Letzte Änderungen Neuigkeiten Suchen ElispSektion KurzAnleitung Impressum
Argentinien: Tag des Vaterlandes (Sturz des spanischen Vizekönigs 1810), Jordanien: Erlangung der Unabhängigkeit 1946

DiredIsearch

Letzte Änderung

Zusammenfassung: only show matched lines in dired buffer

Eingefügt:

> [new:Joseph:2011-09-05 02:57 UTC]
> I don't use Isearch ,I use this function . -- [[Joseph]]
> (defun dired-name-filter-only-show-matched-lines(filter-regexp)
> (interactive "s(only show matched):")
> (let ((dired-marker-char 16)
> (files (directory-files default-directory t)))
> ;;(dired-unmark-all-files dired-marker-char)
> (save-excursion
> (dolist (file files)
> (when (and (dired-goto-file (expand-file-name file))
> (not (string= "" filter-regexp))
> (string-match filter-regexp (file-name-nondirectory file)))
> (dired-mark 1)
> )))
> (dired-toggle-marks)
> (dired-do-kill-lines nil (concat "Filter:'" filter-regexp "' omitted %d line%s"))
> (dired-move-to-filename)
> )
> )
> (define-key dired-mode-map "z" 'dired-name-filter-only-show-matched-lines)


Library Lisp:dired-isearch.el lets you isearch in DiredMode matching only file names.

Recommended keybindings:

    (define-key dired-mode-map (kbd "C-s") 'dired-isearch-forward)
    (define-key dired-mode-map (kbd "C-r") 'dired-isearch-backward)
    (define-key dired-mode-map (kbd "ESC C-s") 'dired-isearch-forward-regexp)
    (define-key dired-mode-map (kbd "ESC C-r") 'dired-isearch-backward-regexp)

Download: Lisp:dired-isearch.el.

See also: DiredLis.

Emacs 23 has built-in Isearch for Dired. You might want to mention how dired-lis.el differs. – DrewAdams

Another way to find only file (and directory) names in Dired: Hide everything but the file names, using ‘dired-details-toggle’ (in Lisp:dired-details+.el). When the details are hidden, search doesn’t find them. See DiredDetails. – DrewAdams

I don’t use Isearch ,I use this function . – Joseph

     (defun dired-name-filter-only-show-matched-lines(filter-regexp)
       (interactive "s(only show matched):")
       (let ((dired-marker-char 16)
             (files (directory-files default-directory t)))
         ;;(dired-unmark-all-files dired-marker-char)
         (save-excursion
           (dolist (file files)
             (when (and (dired-goto-file  (expand-file-name file))
                        (not (string= "" filter-regexp))
                        (string-match filter-regexp (file-name-nondirectory file)))
               (dired-mark 1)
               )))
         (dired-toggle-marks)
         (dired-do-kill-lines nil (concat "Filter:'" filter-regexp "' omitted %d line%s"))
         (dired-move-to-filename)
         )
       )
     (define-key dired-mode-map  "z" 'dired-name-filter-only-show-matched-lines)

CategoryDirectories CategorySearchAndReplace