diff options
| author | Stefan Monnier | 2008-05-13 05:15:57 +0000 |
|---|---|---|
| committer | Stefan Monnier | 2008-05-13 05:15:57 +0000 |
| commit | f836b98e3139ff39834ceb2dcc4852c1c3e068c9 (patch) | |
| tree | e73d10263976b815f98749b694c825344dda7c04 | |
| parent | 01bb4018866f2a6d3211a4b8e1ca38bc1f2c194b (diff) | |
| download | emacs-f836b98e3139ff39834ceb2dcc4852c1c3e068c9.tar.gz emacs-f836b98e3139ff39834ceb2dcc4852c1c3e068c9.zip | |
(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.
| -rw-r--r-- | lisp/ChangeLog | 10 | ||||
| -rw-r--r-- | lisp/dired.el | 40 |
2 files changed, 34 insertions, 16 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bd621914fe8..d290e1bbea0 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2008-05-13 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * dired.el (dired-read-dir-and-switches): Ignore ., .., and | ||
| 4 | completion-ignored-extension directories if there's something else. | ||
| 5 | (dired-mark-if, dired-map-over-marks, dired-readin, dired-revert) | ||
| 6 | (dired-remember-marks, dired-undo, dired-build-subdir-alist) | ||
| 7 | (dired-internal-do-deletions, dired-mark-files-in-region, dired-mark) | ||
| 8 | (dired-toggle-marks, dired-change-marks, dired-unmark-all-files): | ||
| 9 | buffer-read-only -> inhibit-read-only. | ||
| 10 | |||
| 1 | 2008-05-12 Eric S. Raymond <esr@snark.thyrsus.com> | 11 | 2008-05-12 Eric S. Raymond <esr@snark.thyrsus.com> |
| 2 | 12 | ||
| 3 | * vc.el (vc-expand-dirs): Stop this function from tossing out | 13 | * vc.el (vc-expand-dirs): Stop this function from tossing out |
diff --git a/lisp/dired.el b/lisp/dired.el index 65728abb58d..e5e3dd2358b 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -464,7 +464,7 @@ PREDICATE is evaluated on each line, with point at beginning of line. | |||
| 464 | MSG is a noun phrase for the type of files being marked. | 464 | MSG is a noun phrase for the type of files being marked. |
| 465 | It should end with a noun that can be pluralized by adding `s'. | 465 | It should end with a noun that can be pluralized by adding `s'. |
| 466 | Return value is the number of files marked, or nil if none were marked." | 466 | Return value is the number of files marked, or nil if none were marked." |
| 467 | `(let (buffer-read-only count) | 467 | `(let ((inhibit-read-only t) count) |
| 468 | (save-excursion | 468 | (save-excursion |
| 469 | (setq count 0) | 469 | (setq count 0) |
| 470 | (if ,msg (message "Marking %ss..." ,msg)) | 470 | (if ,msg (message "Marking %ss..." ,msg)) |
| @@ -510,7 +510,7 @@ return (t FILENAME) instead of (FILENAME)." | |||
| 510 | ;;endless loop. | 510 | ;;endless loop. |
| 511 | ;;This warning should not apply any longer, sk 2-Sep-1991 14:10. | 511 | ;;This warning should not apply any longer, sk 2-Sep-1991 14:10. |
| 512 | `(prog1 | 512 | `(prog1 |
| 513 | (let (buffer-read-only case-fold-search found results) | 513 | (let ((inhibit-read-only t) case-fold-search found results) |
| 514 | (if ,arg | 514 | (if ,arg |
| 515 | (if (integerp ,arg) | 515 | (if (integerp ,arg) |
| 516 | (progn ;; no save-excursion, want to move point. | 516 | (progn ;; no save-excursion, want to move point. |
| @@ -600,7 +600,11 @@ Don't use that together with FILTER." | |||
| 600 | nil default-directory nil) | 600 | nil default-directory nil) |
| 601 | (lexical-let ((default (and buffer-file-name | 601 | (lexical-let ((default (and buffer-file-name |
| 602 | (abbreviate-file-name buffer-file-name))) | 602 | (abbreviate-file-name buffer-file-name))) |
| 603 | (defdir default-directory)) | 603 | (defdir default-directory) |
| 604 | (cie ())) | ||
| 605 | (dolist (ext completion-ignored-extensions) | ||
| 606 | (if (eq ?/ (aref ext (1- (length ext)))) (push ext cie))) | ||
| 607 | (setq cie (concat (regexp-opt cie "\\(?:") "\\'")) | ||
| 604 | (minibuffer-with-setup-hook | 608 | (minibuffer-with-setup-hook |
| 605 | (lambda () | 609 | (lambda () |
| 606 | (setq minibuffer-default default) | 610 | (setq minibuffer-default default) |
| @@ -625,7 +629,11 @@ Don't use that together with FILTER." | |||
| 625 | ;; does not obey its `predicate' argument. | 629 | ;; does not obey its `predicate' argument. |
| 626 | (completion-table-in-turn | 630 | (completion-table-in-turn |
| 627 | (lambda (str pred action) | 631 | (lambda (str pred action) |
| 628 | (let ((read-file-name-predicate 'file-directory-p)) | 632 | (let ((read-file-name-predicate |
| 633 | (lambda (f) (and (not (member f '("./" "../"))) | ||
| 634 | ;; Hack! Faster than file-directory-p! | ||
| 635 | (eq (aref f (1- (length f))) ?/) | ||
| 636 | (not (string-match cie f)))))) | ||
| 629 | (complete-with-action | 637 | (complete-with-action |
| 630 | action 'read-file-name-internal str nil))) | 638 | action 'read-file-name-internal str nil))) |
| 631 | 'read-file-name-internal) | 639 | 'read-file-name-internal) |
| @@ -838,7 +846,7 @@ wildcards, erases the buffer, and builds the subdir-alist anew | |||
| 838 | (make-local-variable 'file-name-coding-system) | 846 | (make-local-variable 'file-name-coding-system) |
| 839 | (setq file-name-coding-system | 847 | (setq file-name-coding-system |
| 840 | (or coding-system-for-read file-name-coding-system)) | 848 | (or coding-system-for-read file-name-coding-system)) |
| 841 | (let (buffer-read-only | 849 | (let ((inhibit-read-only t) |
| 842 | ;; Don't make undo entries for readin. | 850 | ;; Don't make undo entries for readin. |
| 843 | (buffer-undo-list t)) | 851 | (buffer-undo-list t)) |
| 844 | (widen) | 852 | (widen) |
| @@ -1082,7 +1090,7 @@ Preserves old cursor, marks/flags, hidden-p." | |||
| 1082 | (hidden-subdirs (dired-remember-hidden)) | 1090 | (hidden-subdirs (dired-remember-hidden)) |
| 1083 | (old-subdir-alist (cdr (reverse dired-subdir-alist))) ; except pwd | 1091 | (old-subdir-alist (cdr (reverse dired-subdir-alist))) ; except pwd |
| 1084 | (case-fold-search nil) ; we check for upper case ls flags | 1092 | (case-fold-search nil) ; we check for upper case ls flags |
| 1085 | buffer-read-only) | 1093 | (inhibit-read-only t)) |
| 1086 | (goto-char (point-min)) | 1094 | (goto-char (point-min)) |
| 1087 | (setq mark-alist;; only after dired-remember-hidden since this unhides: | 1095 | (setq mark-alist;; only after dired-remember-hidden since this unhides: |
| 1088 | (dired-remember-marks (point-min) (point-max))) | 1096 | (dired-remember-marks (point-min) (point-max))) |
| @@ -1116,7 +1124,7 @@ Preserves old cursor, marks/flags, hidden-p." | |||
| 1116 | (defun dired-remember-marks (beg end) | 1124 | (defun dired-remember-marks (beg end) |
| 1117 | "Return alist of files and their marks, from BEG to END." | 1125 | "Return alist of files and their marks, from BEG to END." |
| 1118 | (if selective-display ; must unhide to make this work. | 1126 | (if selective-display ; must unhide to make this work. |
| 1119 | (let (buffer-read-only) | 1127 | (let ((inhibit-read-only t)) |
| 1120 | (subst-char-in-region beg end ?\r ?\n))) | 1128 | (subst-char-in-region beg end ?\r ?\n))) |
| 1121 | (let (fil chr alist) | 1129 | (let (fil chr alist) |
| 1122 | (save-excursion | 1130 | (save-excursion |
| @@ -1725,7 +1733,7 @@ Keybindings: | |||
| 1725 | This doesn't recover lost files, it just undoes changes in the buffer itself. | 1733 | This doesn't recover lost files, it just undoes changes in the buffer itself. |
| 1726 | You can use it to recover marks, killed lines or subdirs." | 1734 | You can use it to recover marks, killed lines or subdirs." |
| 1727 | (interactive) | 1735 | (interactive) |
| 1728 | (let (buffer-read-only) | 1736 | (let ((inhibit-read-only t)) |
| 1729 | (undo)) | 1737 | (undo)) |
| 1730 | (dired-build-subdir-alist) | 1738 | (dired-build-subdir-alist) |
| 1731 | (message "Change in dired buffer undone. | 1739 | (message "Change in dired buffer undone. |
| @@ -2278,7 +2286,7 @@ instead of `dired-actual-switches'." | |||
| 2278 | (dired-clear-alist) | 2286 | (dired-clear-alist) |
| 2279 | (save-excursion | 2287 | (save-excursion |
| 2280 | (let* ((count 0) | 2288 | (let* ((count 0) |
| 2281 | (buffer-read-only nil) | 2289 | (inhibit-read-only t) |
| 2282 | (buffer-undo-list t) | 2290 | (buffer-undo-list t) |
| 2283 | (switches (or switches dired-actual-switches)) | 2291 | (switches (or switches dired-actual-switches)) |
| 2284 | new-dir-name | 2292 | new-dir-name |
| @@ -2546,7 +2554,7 @@ non-empty directories is allowed." | |||
| 2546 | (let (failures);; files better be in reverse order for this loop! | 2554 | (let (failures);; files better be in reverse order for this loop! |
| 2547 | (while l | 2555 | (while l |
| 2548 | (goto-char (cdr (car l))) | 2556 | (goto-char (cdr (car l))) |
| 2549 | (let (buffer-read-only) | 2557 | (let ((inhibit-read-only t)) |
| 2550 | (condition-case err | 2558 | (condition-case err |
| 2551 | (let ((fn (car (car l)))) | 2559 | (let ((fn (car (car l)))) |
| 2552 | (dired-delete-file fn dired-recursive-deletes) | 2560 | (dired-delete-file fn dired-recursive-deletes) |
| @@ -2588,7 +2596,7 @@ non-empty directories is allowed." | |||
| 2588 | (defun dired-delete-entry (file) | 2596 | (defun dired-delete-entry (file) |
| 2589 | (save-excursion | 2597 | (save-excursion |
| 2590 | (and (dired-goto-file file) | 2598 | (and (dired-goto-file file) |
| 2591 | (let (buffer-read-only) | 2599 | (let ((inhibit-read-only t)) |
| 2592 | (delete-region (progn (beginning-of-line) (point)) | 2600 | (delete-region (progn (beginning-of-line) (point)) |
| 2593 | (save-excursion (forward-line 1) (point)))))) | 2601 | (save-excursion (forward-line 1) (point)))))) |
| 2594 | (dired-clean-up-after-deletion file)) | 2602 | (dired-clean-up-after-deletion file)) |
| @@ -2779,7 +2787,7 @@ just the current file." | |||
| 2779 | (following-char)))))) | 2787 | (following-char)))))) |
| 2780 | 2788 | ||
| 2781 | (defun dired-mark-files-in-region (start end) | 2789 | (defun dired-mark-files-in-region (start end) |
| 2782 | (let (buffer-read-only) | 2790 | (let ((inhibit-read-only t)) |
| 2783 | (if (> start end) | 2791 | (if (> start end) |
| 2784 | (error "start > end")) | 2792 | (error "start > end")) |
| 2785 | (goto-char start) ; assumed at beginning of line | 2793 | (goto-char start) ; assumed at beginning of line |
| @@ -2804,7 +2812,7 @@ this subdir." | |||
| 2804 | (interactive "P") | 2812 | (interactive "P") |
| 2805 | (if (dired-get-subdir) | 2813 | (if (dired-get-subdir) |
| 2806 | (save-excursion (dired-mark-subdir-files)) | 2814 | (save-excursion (dired-mark-subdir-files)) |
| 2807 | (let (buffer-read-only) | 2815 | (let ((inhibit-read-only t)) |
| 2808 | (dired-repeat-over-lines | 2816 | (dired-repeat-over-lines |
| 2809 | (prefix-numeric-value arg) | 2817 | (prefix-numeric-value arg) |
| 2810 | (function (lambda () (delete-char 1) (insert dired-marker-char))))))) | 2818 | (function (lambda () (delete-char 1) (insert dired-marker-char))))))) |
| @@ -2839,7 +2847,7 @@ As always, hidden subdirs are not affected." | |||
| 2839 | (interactive) | 2847 | (interactive) |
| 2840 | (save-excursion | 2848 | (save-excursion |
| 2841 | (goto-char (point-min)) | 2849 | (goto-char (point-min)) |
| 2842 | (let (buffer-read-only) | 2850 | (let ((inhibit-read-only t)) |
| 2843 | (while (not (eobp)) | 2851 | (while (not (eobp)) |
| 2844 | (or (dired-between-files) | 2852 | (or (dired-between-files) |
| 2845 | (looking-at dired-re-dot) | 2853 | (looking-at dired-re-dot) |
| @@ -3019,7 +3027,7 @@ OLD and NEW are both characters used to mark files." | |||
| 3019 | (if (or (eq old ?\r) (eq new ?\r)) | 3027 | (if (or (eq old ?\r) (eq new ?\r)) |
| 3020 | (ding) | 3028 | (ding) |
| 3021 | (let ((string (format "\n%c" old)) | 3029 | (let ((string (format "\n%c" old)) |
| 3022 | (buffer-read-only)) | 3030 | (inhibit-read-only t)) |
| 3023 | (save-excursion | 3031 | (save-excursion |
| 3024 | (goto-char (point-min)) | 3032 | (goto-char (point-min)) |
| 3025 | (while (search-forward string nil t) | 3033 | (while (search-forward string nil t) |
| @@ -3044,7 +3052,7 @@ Type \\[help-command] at that time for help." | |||
| 3044 | (interactive "cRemove marks (RET means all): \nP") | 3052 | (interactive "cRemove marks (RET means all): \nP") |
| 3045 | (save-excursion | 3053 | (save-excursion |
| 3046 | (let* ((count 0) | 3054 | (let* ((count 0) |
| 3047 | buffer-read-only case-fold-search query | 3055 | (inhibit-read-only t) case-fold-search query |
| 3048 | (string (format "\n%c" mark)) | 3056 | (string (format "\n%c" mark)) |
| 3049 | (help-form "\ | 3057 | (help-form "\ |
| 3050 | Type SPC or `y' to unmark one file, DEL or `n' to skip to next, | 3058 | Type SPC or `y' to unmark one file, DEL or `n' to skip to next, |