diff options
Diffstat (limited to 'lisp/dired-aux.el')
-rw-r--r-- | lisp/dired-aux.el | 64 |
1 files changed, 37 insertions, 27 deletions
diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 060f3a84111..7d81d45326f 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -444,10 +444,10 @@ List has a form of (file-name full-file-name (attribute-list))." ((eq op-symbol 'chgrp) (file-attribute-group-id (file-attributes default-file 'string)))))) - (prompt (concat "Change " attribute-name " of %s to" - (if (eq op-symbol 'touch) - " (default now): " - ": "))) + (prompt (format-prompt "Change %s of %%s to" + (when (eq op-symbol 'touch) + "now") + attribute-name)) (new-attribute (dired-mark-read-string prompt nil op-symbol arg files default (cond ((eq op-symbol 'chown) @@ -493,8 +493,7 @@ are supported. Type M-n to pull the file attributes of the file at point into the minibuffer. See Info node `(coreutils)File permissions' for more information. -Alternatively, see the man page for \"chmod\", using the command -\\[man] in Emacs. +Alternatively, see the man page for \"chmod(1)\". Note that on MS-Windows only the `w' (write) bit is meaningful: resetting it makes the file read-only. Changing any other bit @@ -508,7 +507,7 @@ has no effect on MS-Windows." (default (and (stringp modestr) (string-match "^.\\(...\\)\\(...\\)\\(...\\)$" modestr) - (replace-regexp-in-string + (string-replace "-" "" (format "u=%s,g=%s,o=%s" (match-string 1 modestr) @@ -1137,12 +1136,12 @@ present. A FMT of \"\" will suppress the messaging." ("\\.tar\\.gz\\'" "" "gzip -dc %i | tar -xf -") ("\\.tar\\.xz\\'" "" "xz -dc %i | tar -xf -") ("\\.tgz\\'" "" "gzip -dc %i | tar -xf -") - ("\\.gz\\'" "" "gunzip") + ("\\.gz\\'" "" "gzip -d") ("\\.lz\\'" "" "lzip -d") ("\\.Z\\'" "" "uncompress") ;; For .z, try gunzip. It might be an old gzip file, ;; or it might be from compact? pack? (which?) but gunzip handles both. - ("\\.z\\'" "" "gunzip") + ("\\.z\\'" "" "gzip -d") ("\\.dz\\'" "" "dictunzip") ("\\.tbz\\'" ".tar" "bunzip2") ("\\.bz2\\'" "" "bunzip2") @@ -1245,7 +1244,7 @@ and `dired-compress-files-alist'." (?i . ,(mapconcat (lambda (in-file) (shell-quote-argument - (file-name-nondirectory in-file))) + (file-relative-name in-file))) in-files " ")))))) (message (ngettext "Compressed %d file to %s" "Compressed %d files to %s" @@ -1288,7 +1287,7 @@ Return nil if no change in files." nil t) nil t))) ;; We found an uncompression rule. - (let ((match (string-match " " command)) + (let ((match (string-search " " command)) (msg (concat "Uncompressing " file))) (unless (if match (dired-check-process msg @@ -1326,7 +1325,7 @@ Return nil if no change in files." (user-error "No compression rule found for \ `dired-compress-directory-default-suffix' %s, see `dired-compress-files-alist' for\ - the supported suffixes list." + the supported suffixes list" dired-compress-directory-default-suffix))) (let* ((suffix (or dired-compress-file-default-suffix ".gz")) (out-name (concat file suffix)) @@ -1335,7 +1334,7 @@ Return nil if no change in files." dired-compress-file-alist))) (if (not rule) (user-error "No compression rule found for suffix %s, \ -see `dired-compress-file-alist' for the supported suffixes list." +see `dired-compress-file-alist' for the supported suffixes list" dired-compress-file-default-suffix) (and (file-exists-p file) (or (not (file-exists-p out-name)) @@ -2340,9 +2339,9 @@ If DIRECTORY already exists, signal an error." ;;;###autoload (defun dired-create-empty-file (file) "Create an empty file called FILE. - Add a new entry for the new file in the Dired buffer. - Parent directories of FILE are created as needed. - If FILE already exists, signal an error." +Add a new entry for the new file in the Dired buffer. +Parent directories of FILE are created as needed. +If FILE already exists, signal an error." (interactive (list (read-file-name "Create empty file: "))) (let* ((expanded (expand-file-name file)) new) @@ -2399,7 +2398,9 @@ But if `dired-copy-dereference' is non-nil, the symbolic links are dereferenced and then copied, similar to the \"-L\" option for the \"cp\" shell command. If ARG is a cons with element 4 (`\\[universal-argument]'), the inverted value of -`dired-copy-dereference' will be used." +`dired-copy-dereference' will be used. + +Also see `dired-do-revert-buffer'." (interactive "P") (let ((dired-recursive-copies dired-recursive-copies) (dired-copy-dereference (if (equal arg '(4)) @@ -2420,7 +2421,9 @@ with the same names that the files currently have. The default suggested for the target directory depends on the value of `dired-dwim-target', which see. -For relative symlinks, use \\[dired-do-relsymlink]." +For relative symlinks, use \\[dired-do-relsymlink]. + +Also see `dired-do-revert-buffer'." (interactive "P") (dired-do-create-files 'symlink #'make-symbolic-link "Symlink" arg dired-keep-marker-symlink)) @@ -2433,7 +2436,9 @@ When operating on multiple or marked files, you specify a directory and new hard links are made in that directory with the same names that the files currently have. The default suggested for the target directory depends on the value of -`dired-dwim-target', which see." +`dired-dwim-target', which see. + +Also see `dired-do-revert-buffer'." (interactive "P") (dired-do-create-files 'hardlink #'dired-hardlink "Hardlink" arg dired-keep-marker-hardlink)) @@ -2452,7 +2457,9 @@ When renaming just the current file, you specify the new name. When renaming multiple or marked files, you specify a directory. This command also renames any buffers that are visiting the files. The default suggested for the target directory depends on the value -of `dired-dwim-target', which see." +of `dired-dwim-target', which see. + +Also see `dired-do-revert-buffer'." (interactive "P") (dired-do-create-files 'move #'dired-rename-file "Move" arg dired-keep-marker-rename "Rename")) @@ -2729,7 +2736,7 @@ This function takes some pains to conform to `ls -lR' output." ;; Check that it is valid to insert DIRNAME with SWITCHES. ;; Signal an error if invalid (e.g. user typed `i' on `..'). (or (file-in-directory-p dirname (expand-file-name default-directory)) - (error "%s: not in this directory tree" dirname)) + (error "%s: Not in this directory tree" dirname)) (let ((real-switches (or switches dired-subdir-switches))) (when real-switches (let (case-fold-search) @@ -2769,7 +2776,7 @@ of marked files. If KILL-ROOT is non-nil, kill DIRNAME as well." (setq dir (car (car s-alist)) s-alist (cdr s-alist)) (and (or kill-root (not (string-equal dir dirname))) - (file-in-directory-p dir dirname) + (dired-in-this-tree-p dir dirname) (dired-goto-subdir dir) (setq m-alist (nconc (dired-kill-subdir remember-marks) m-alist)))) m-alist)) @@ -2853,8 +2860,8 @@ of marked files. If KILL-ROOT is non-nil, kill DIRNAME as well." ;; if dired-actual-switches contained t. (setq dir1 (file-name-as-directory dir1) dir2 (file-name-as-directory dir2)) - (let ((components-1 (dired-split "/" dir1)) - (components-2 (dired-split "/" dir2))) + (let ((components-1 (split-string dir1 "/")) + (components-2 (split-string dir2 "/"))) (while (and components-1 components-2 (equal (car components-1) (car components-2))) @@ -2873,7 +2880,6 @@ of marked files. If KILL-ROOT is non-nil, kill DIRNAME as well." nil) (t (error "This can't happen")))))) -;; There should be a builtin split function - inverse to mapconcat. (defun dired-split (pat str &optional limit) "Splitting on regexp PAT, turn string STR into a list of substrings. Optional third arg LIMIT (>= 1) is a limit to the length of the @@ -2883,6 +2889,7 @@ Thus, if SEP is a regexp that only matches itself, (mapconcat #'identity (dired-split SEP STRING) SEP) is always equal to STRING." + (declare (obsolete split-string "29.1")) (let* ((start (string-match pat str)) (result (list (substring str 0 start))) (count 1) @@ -3002,7 +3009,7 @@ Lower levels are unaffected." (while rest (setq elt (car rest) rest (cdr rest)) - (if (file-in-directory-p (directory-file-name (car elt)) dir) + (if (dired-in-this-tree-p (directory-file-name (car elt)) dir) (setq rest nil pos (dired-goto-subdir (car elt)))))) (if pos @@ -3245,10 +3252,13 @@ REGEXP should use constructs supported by your local `grep' command." (list (nth 0 common) (nth 1 common)))) (require 'xref) (defvar xref-show-xrefs-function) + (defvar xref-auto-jump-to-first-xref) (with-current-buffer (let ((xref-show-xrefs-function ;; Some future-proofing (bug#44905). - (custom--standard-value 'xref-show-xrefs-function))) + (custom--standard-value 'xref-show-xrefs-function)) + ;; Disable auto-jumping, it will mess up replacement logic. + xref-auto-jump-to-first-xref) (dired-do-find-regexp from)) (xref-query-replace-in-results from to))) |