X-Git-Url: http://git.hcoop.net/bpt/emacs.git/blobdiff_plain/72962dd88224fe01ea392482017bbf179a621a8e..fa8678ebb05c28c54f114727a0bec7453903dbf0:/lisp/dired.el diff --git a/lisp/dired.el b/lisp/dired.el index 3b986e99f6..a241fb3b33 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1,7 +1,7 @@ ;;; dired.el --- directory-browsing commands -*- lexical-binding: t -*- -;; Copyright (C) 1985-1986, 1992-1997, 2000-2014 Free Software -;; Foundation, Inc. +;; Copyright (C) 1985-1986, 1992-1997, 2000-2014 +;; Free Software Foundation, Inc. ;; Author: Sebastian Kremer ;; Maintainer: emacs-devel@gnu.org @@ -1142,10 +1142,22 @@ BEG..END is the line where the file info is located." (defvar ls-lisp-use-insert-directory-program) +(defun dired-check-switches (switches short &optional long) + "Return non-nil if the string SWITCHES matches LONG or SHORT format." + (let (case-fold-search) + (and (stringp switches) + (string-match-p (concat "\\(\\`\\| \\)-[[:alnum:]]*" short + (if long (concat "\\|--" long "\\>") "")) + switches)))) + (defun dired-switches-escape-p (switches) "Return non-nil if the string SWITCHES contains -b or --escape." ;; Do not match things like "--block-size" that happen to contain "b". - (string-match-p "\\(\\`\\| \\)-[[:alnum:]]*b\\|--escape\\>" switches)) + (dired-check-switches switches "b" "escape")) + +(defun dired-switches-recursive-p (switches) + "Return non-nil if the string SWITCHES contains -R or --recursive." + (dired-check-switches switches "R" "recursive")) (defun dired-insert-directory (dir switches &optional file-list wildcard hdr) "Insert a directory listing of DIR, Dired style. @@ -1402,7 +1414,7 @@ Each element of ALIST looks like (FILE . MARKERCHAR)." (defun dired-insert-old-subdirs (old-subdir-alist) "Try to insert all subdirs that were displayed before. Do so according to the former subdir alist OLD-SUBDIR-ALIST." - (or (string-match-p "R" dired-actual-switches) + (or (dired-switches-recursive-p dired-actual-switches) (let (elt dir) (while old-subdir-alist (setq elt (car old-subdir-alist) @@ -1900,7 +1912,7 @@ Type \\[dired-mark] to Mark a file or subdirectory for later commands. to see why something went wrong. Type \\[dired-unmark] to Unmark a file or all files of an inserted subdirectory. Type \\[dired-unmark-backward] to back up one line and unmark or unflag. -Type \\[dired-do-flagged-delete] to delete (eXecute) the files flagged `D'. +Type \\[dired-do-flagged-delete] to delete (eXpunge) the files flagged `D'. Type \\[dired-find-file] to Find the current line's file (or dired it in another buffer, if it is a directory). Type \\[dired-find-file-other-window] to find file or Dired directory in Other window. @@ -2349,9 +2361,8 @@ Return the position of the beginning of the filename, or nil if none found." ;; This is the UNIX version. (if (get-text-property (point) 'dired-filename) (goto-char (next-single-property-change (point) 'dired-filename)) - (let (opoint file-type executable symlink hidden case-fold-search used-F eol) - ;; case-fold-search is nil now, so we can test for capital F: - (setq used-F (string-match-p "F" dired-actual-switches) + (let (opoint file-type executable symlink hidden used-F eol) + (setq used-F (dired-check-switches dired-actual-switches "F" "classify") opoint (point) eol (line-end-position) hidden (and selective-display @@ -2613,7 +2624,7 @@ instead of `dired-actual-switches'." (R-ftp-base-dir-regex ;; Used to expand subdirectory names correctly in recursive ;; ange-ftp listings. - (and (string-match-p "R" switches) + (and (dired-switches-recursive-p switches) (string-match "\\`/.*:\\(/.*\\)" default-directory) (concat "\\`" (match-string 1 default-directory))))) (goto-char (point-min)) @@ -3088,7 +3099,10 @@ argument or confirmation)." ;; If FILES defaulted to the current line's file. (= (length files) 1)) (apply function args) - (let ((buffer (get-buffer-create (or buffer-or-name " *Marked Files*")))) + (let ((buffer (get-buffer-create (or buffer-or-name " *Marked Files*"))) + ;; Mark *Marked Files* window as softly-dedicated, to prevent + ;; other buffers e.g. *Completions* from reusing it (bug#17554). + (display-buffer-mark-dedicated 'soft)) (with-current-buffer buffer (with-current-buffer-window buffer @@ -3288,6 +3302,7 @@ As always, hidden subdirs are not affected." (defun dired-read-regexp (prompt &optional default history) "Read a regexp using `read-regexp'." + (declare (obsolete read-regexp "24.5")) (read-regexp prompt default (or history 'dired-regexp-history))) (defun dired-mark-files-regexp (regexp &optional marker-char) @@ -3298,8 +3313,9 @@ A prefix argument means to unmark them instead. REGEXP is an Emacs regexp, not a shell wildcard. Thus, use `\\.o$' for object files--just `.o' will mark more than you might think." (interactive - (list (dired-read-regexp (concat (if current-prefix-arg "Unmark" "Mark") - " files (regexp): ")) + (list (read-regexp (concat (if current-prefix-arg "Unmark" "Mark") + " files (regexp): ") + nil 'dired-regexp-history) (if current-prefix-arg ?\040))) (let ((dired-marker-char (or marker-char dired-marker-char))) (dired-mark-if @@ -3314,8 +3330,9 @@ object files--just `.o' will mark more than you might think." A prefix argument means to unmark them instead. `.' and `..' are never marked." (interactive - (list (dired-read-regexp (concat (if current-prefix-arg "Unmark" "Mark") - " files containing (regexp): ")) + (list (read-regexp (concat (if current-prefix-arg "Unmark" "Mark") + " files containing (regexp): ") + nil 'dired-regexp-history) (if current-prefix-arg ?\040))) (let ((dired-marker-char (or marker-char dired-marker-char))) (dired-mark-if @@ -3345,7 +3362,8 @@ A prefix argument means to unmark them instead. The match is against the non-directory part of the filename. Use `^' and `$' to anchor matches. Exclude subdirs by hiding them. `.' and `..' are never flagged." - (interactive (list (dired-read-regexp "Flag for deletion (regexp): "))) + (interactive (list (read-regexp "Flag for deletion (regexp): " + nil 'dired-regexp-history))) (dired-mark-files-regexp regexp dired-del-marker)) (defun dired-mark-symlinks (unflag-p) @@ -3688,12 +3706,12 @@ Saves `dired-subdir-alist' when R is set and restores saved value minus any directories explicitly deleted when R is cleared. To be called first in body of `dired-sort-other', etc." (cond - ((and (string-match-p "R" switches) - (not (string-match-p "R" dired-actual-switches))) + ((and (dired-switches-recursive-p switches) + (not (dired-switches-recursive-p dired-actual-switches))) ;; Adding -R to ls switches -- save `dired-subdir-alist': (setq dired-subdir-alist-pre-R dired-subdir-alist)) - ((and (string-match-p "R" dired-actual-switches) - (not (string-match-p "R" switches))) + ((and (dired-switches-recursive-p dired-actual-switches) + (not (dired-switches-recursive-p switches))) ;; Deleting -R from ls switches -- revert to pre-R subdirs ;; that are still present: (setq dired-subdir-alist @@ -3865,7 +3883,7 @@ Ask means pop up a menu for the user to select one of copy, move or link." ;;; Start of automatically extracted autoloads. -;;;### (autoloads nil "dired-aux" "dired-aux.el" "1a8e2a4a9117ab3a2586aa001358d3fb") +;;;### (autoloads nil "dired-aux" "dired-aux.el" "1448837b5f3e2b9ad63f723361f1e32e") ;;; Generated autoloads from dired-aux.el (autoload 'dired-diff "dired-aux" "\ @@ -4368,7 +4386,7 @@ instead. ;;;*** -;;;### (autoloads nil "dired-x" "dired-x.el" "291bc6e869bf72c900604c45d40f45ed") +;;;### (autoloads nil "dired-x" "dired-x.el" "994b5d9fc38059ab641ec271c728e56f") ;;; Generated autoloads from dired-x.el (autoload 'dired-jump "dired-x" "\