changeset 94889:e80a3956601b

(dired-read-dir-and-switches): Ignore ., .., and completion-ignored-extension directories if there's something else. (dired-mark-if, dired-map-over-marks, dired-readin, dired-revert) (dired-remember-marks, dired-undo, dired-build-subdir-alist) (dired-internal-do-deletions, dired-mark-files-in-region, dired-mark) (dired-toggle-marks, dired-change-marks, dired-unmark-all-files): buffer-read-only -> inhibit-read-only.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Tue, 13 May 2008 05:15:57 +0000
parents 77013c501e34
children 907ac6ecef89
files lisp/ChangeLog lisp/dired.el
diffstat 2 files changed, 34 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Tue May 13 04:39:32 2008 +0000
+++ b/lisp/ChangeLog	Tue May 13 05:15:57 2008 +0000
@@ -1,3 +1,13 @@
+2008-05-13  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+	* dired.el (dired-read-dir-and-switches): Ignore ., .., and
+	completion-ignored-extension directories if there's something else.
+	(dired-mark-if, dired-map-over-marks, dired-readin, dired-revert)
+	(dired-remember-marks, dired-undo, dired-build-subdir-alist)
+	(dired-internal-do-deletions, dired-mark-files-in-region, dired-mark)
+	(dired-toggle-marks, dired-change-marks, dired-unmark-all-files):
+	buffer-read-only -> inhibit-read-only.
+
 2008-05-12  Eric S. Raymond  <esr@snark.thyrsus.com>
 
 	* vc.el (vc-expand-dirs): Stop this function from tossing out
--- a/lisp/dired.el	Tue May 13 04:39:32 2008 +0000
+++ b/lisp/dired.el	Tue May 13 05:15:57 2008 +0000
@@ -464,7 +464,7 @@
 MSG is a noun phrase for the type of files being marked.
 It should end with a noun that can be pluralized by adding `s'.
 Return value is the number of files marked, or nil if none were marked."
-  `(let (buffer-read-only count)
+  `(let ((inhibit-read-only t) count)
     (save-excursion
       (setq count 0)
       (if ,msg (message "Marking %ss..." ,msg))
@@ -510,7 +510,7 @@
   ;;endless loop.
   ;;This warning should not apply any longer, sk  2-Sep-1991 14:10.
   `(prog1
-       (let (buffer-read-only case-fold-search found results)
+       (let ((inhibit-read-only t) case-fold-search found results)
 	 (if ,arg
 	     (if (integerp ,arg)
 		 (progn	;; no save-excursion, want to move point.
@@ -600,7 +600,11 @@
                              nil default-directory nil)
       (lexical-let ((default (and buffer-file-name
                                   (abbreviate-file-name buffer-file-name)))
-                    (defdir default-directory))
+                    (defdir default-directory)
+                    (cie ()))
+        (dolist (ext completion-ignored-extensions)
+          (if (eq ?/ (aref ext (1- (length ext)))) (push ext cie)))
+        (setq cie (concat (regexp-opt cie "\\(?:") "\\'"))
         (minibuffer-with-setup-hook
             (lambda ()
               (setq minibuffer-default default)
@@ -625,7 +629,11 @@
             ;; does not obey its `predicate' argument.
             (completion-table-in-turn
              (lambda (str pred action)
-               (let ((read-file-name-predicate 'file-directory-p))
+               (let ((read-file-name-predicate
+                      (lambda (f) (and (not (member f '("./" "../")))
+                                  ;; Hack! Faster than file-directory-p!
+                                  (eq (aref f (1- (length f))) ?/)
+                                  (not (string-match cie f))))))
                  (complete-with-action
                   action 'read-file-name-internal str nil)))
              'read-file-name-internal)
@@ -838,7 +846,7 @@
       (make-local-variable 'file-name-coding-system)
       (setq file-name-coding-system
 	    (or coding-system-for-read file-name-coding-system))
-      (let (buffer-read-only
+      (let ((inhibit-read-only t)
 	    ;; Don't make undo entries for readin.
 	    (buffer-undo-list t))
 	(widen)
@@ -1082,7 +1090,7 @@
 	(hidden-subdirs (dired-remember-hidden))
 	(old-subdir-alist (cdr (reverse dired-subdir-alist))) ; except pwd
 	(case-fold-search nil)		; we check for upper case ls flags
-	buffer-read-only)
+	(inhibit-read-only t))
     (goto-char (point-min))
     (setq mark-alist;; only after dired-remember-hidden since this unhides:
 	  (dired-remember-marks (point-min) (point-max)))
@@ -1116,7 +1124,7 @@
 (defun dired-remember-marks (beg end)
   "Return alist of files and their marks, from BEG to END."
   (if selective-display			; must unhide to make this work.
-      (let (buffer-read-only)
+      (let ((inhibit-read-only t))
 	(subst-char-in-region beg end ?\r ?\n)))
   (let (fil chr alist)
     (save-excursion
@@ -1725,7 +1733,7 @@
 This doesn't recover lost files, it just undoes changes in the buffer itself.
 You can use it to recover marks, killed lines or subdirs."
   (interactive)
-  (let (buffer-read-only)
+  (let ((inhibit-read-only t))
     (undo))
   (dired-build-subdir-alist)
   (message "Change in dired buffer undone.
@@ -2278,7 +2286,7 @@
   (dired-clear-alist)
   (save-excursion
     (let* ((count 0)
-	   (buffer-read-only nil)
+	   (inhibit-read-only t)
 	   (buffer-undo-list t)
 	   (switches (or switches dired-actual-switches))
 	   new-dir-name
@@ -2546,7 +2554,7 @@
 	  (let (failures);; files better be in reverse order for this loop!
 	    (while l
 	      (goto-char (cdr (car l)))
-	      (let (buffer-read-only)
+	      (let ((inhibit-read-only t))
 		(condition-case err
 		    (let ((fn (car (car l))))
 		      (dired-delete-file fn dired-recursive-deletes)
@@ -2588,7 +2596,7 @@
 (defun dired-delete-entry (file)
   (save-excursion
     (and (dired-goto-file file)
-	 (let (buffer-read-only)
+	 (let ((inhibit-read-only t))
 	   (delete-region (progn (beginning-of-line) (point))
 			  (save-excursion (forward-line 1) (point))))))
   (dired-clean-up-after-deletion file))
@@ -2779,7 +2787,7 @@
 	       (following-char))))))
 
 (defun dired-mark-files-in-region (start end)
-  (let (buffer-read-only)
+  (let ((inhibit-read-only t))
     (if (> start end)
 	(error "start > end"))
     (goto-char start)			; assumed at beginning of line
@@ -2804,7 +2812,7 @@
   (interactive "P")
   (if (dired-get-subdir)
       (save-excursion (dired-mark-subdir-files))
-    (let (buffer-read-only)
+    (let ((inhibit-read-only t))
       (dired-repeat-over-lines
        (prefix-numeric-value arg)
        (function (lambda () (delete-char 1) (insert dired-marker-char)))))))
@@ -2839,7 +2847,7 @@
   (interactive)
   (save-excursion
     (goto-char (point-min))
-    (let (buffer-read-only)
+    (let ((inhibit-read-only t))
       (while (not (eobp))
         (or (dired-between-files)
             (looking-at dired-re-dot)
@@ -3019,7 +3027,7 @@
   (if (or (eq old ?\r) (eq new ?\r))
       (ding)
     (let ((string (format "\n%c" old))
-	  (buffer-read-only))
+	  (inhibit-read-only t))
       (save-excursion
 	(goto-char (point-min))
 	(while (search-forward string nil t)
@@ -3044,7 +3052,7 @@
   (interactive "cRemove marks (RET means all): \nP")
   (save-excursion
     (let* ((count 0)
-	   buffer-read-only case-fold-search query
+	   (inhibit-read-only t) case-fold-search query
 	   (string (format "\n%c" mark))
 	   (help-form "\
 Type SPC or `y' to unmark one file, DEL or `n' to skip to next,