emacs-devel
[Top][All Lists]
Advanced

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

dired-omit-files-p


From: Juri Linkov
Subject: dired-omit-files-p
Date: Sun, 30 May 2004 23:44:52 +0300
User-agent: Gnus/5.110002 (No Gnus v0.2) Emacs/21.3.50 (gnu/linux)

When `dired-omit-files-p' is t, calling `recover-session' displays an
empty buffer.  This is because auto save files match a regexp in
`dired-omit-extensions'.  This is misleading and causes a false feeling
that no session is available for recovering.

The following patch don't hide files if after hiding no files will be
visible in the dired buffer.

This is useful for any directory, not only for auto-save directory,
because when the user sees no files, he might think that directory
is empty and delete it.

Index: emacs/lisp/dired-x.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/dired-x.el,v
retrieving revision 1.54
diff -u -r1.54 dired-x.el
--- emacs/lisp/dired-x.el       31 Mar 2004 16:09:18 -0000      1.54
+++ emacs/lisp/dired-x.el       30 May 2004 18:08:33 -0000
@@ -545,7 +545,20 @@
             (let ((dired-marker-char dired-omit-marker-char))
               (message "Omitting...")
               (if (dired-mark-unmarked-files omit-re nil nil dired-omit-localp)
-                  (progn
+                  (if (save-excursion
+                        (goto-char (point-min))
+                        (while (and (not (eobp))
+                                    (or (dired-between-files)
+                                        (looking-at
+                                         (concat "^[" (char-to-string
+                                                       dired-omit-marker-char) 
"]"))))
+                          (forward-line 1))
+                        (eobp))
+                      ;; Unmark if all files are to be omitted.
+                      (progn
+                        (dired-mark-unmarked-files omit-re nil t 
dired-omit-localp)
+                        (message "Not omitting all files.")
+                        (setq dired-omit-files-p nil))
                     (setq count (dired-do-kill-lines nil "Omitted %d line%s."))
                     (force-mode-line-update))
                 (message "(Nothing to omit)"))))
@@ -579,7 +592,8 @@
     (dired-mark-if
      (and
       ;; not already marked
-      (looking-at " ")
+      (or (looking-at " ")
+          (and unflag-p (looking-at (char-to-string dired-omit-marker-char))))
       ;; uninteresting
       (let ((fn (dired-get-filename localp t)))
         (and fn (string-match regexp fn))))

-- 
Juri Linkov
http://www.jurta.org/emacs/





reply via email to

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