emacs-diffs
[Top][All Lists]
Advanced

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

master 1c70458519b: Do interactive tagging for dired commands


From: Eli Zaretskii
Subject: master 1c70458519b: Do interactive tagging for dired commands
Date: Sat, 18 Nov 2023 03:43:33 -0500 (EST)

branch: master
commit 1c70458519b324c9403e8a9f57bd695fe39e8d2c
Author: Visuwesh <visuweshm@gmail.com>
Commit: Eli Zaretskii <eliz@gnu.org>

    Do interactive tagging for dired commands
    
    * lisp/dired-aux.el (dired-diff, dired-backup-diff)
    (dired-compare-directories, dired-do-chmod, dired-do-chgrp)
    (dired-do-chown, dired-do-touch, dired-do-print, dired-clean-directory)
    (dired-do-async-shell-command, dired-do-shell-command, dired-kill-line)
    (dired-do-kill-lines, dired-do-compress-to, dired-do-compress)
    (dired-do-byte-compile, dired-do-load, dired-do-redisplay)
    (dired-reset-subdir-switches, dired-create-directory)
    (dired-create-empty-file, dired-do-copy, dired-do-symlink)
    (dired-do-relsymlink, dired-do-hardlink, dired-do-rename)
    (dired-do-rename-regexp, dired-do-copy-regexp, dired-do-hardlink-regexp)
    (dired-do-symlink-regexp, dired-do-relsymlink-regexp, dired-upcase)
    (dired-downcase, dired-maybe-insert-subdir, dired-insert-subdir)
    (dired-kill-tree, dired-prev-subdir, dired-mark-subdir-files)
    (dired-kill-subdir, dired-tree-up, dired-tree-down, dired-hide-subdir)
    (dired-hide-all, dired-isearch-filenames, dired-isearch-filenames-regexp)
    (dired-do-isearch, dired-do-isearch-regexp, dired-do-search)
    (dired-do-query-replace-regexp, dired-do-find-regexp)
    (dired-do-find-regexp-and-replace, dired-show-file-type)
    (dired-vc-next-action):
    * lisp/dired-x.el (dired-mark-extension, dired-mark-suffix)
    (dired-flag-extension, dired-clean-patch, dired-clean-tex)
    (dired-very-clean-tex, dired-mark-omitted, dired-omit-expunge)
    (dired-mark-unmarked-files, dired-do-find-marked-files, dired-vm)
    (dired-rmail, dired-do-run-mail, dired-mark-sexp,
    dired-x-bind-find-file):
    * lisp/dired.el (dired-mouse-drag, dired-undo, dired-toggle-read-only)
    (dired-next-line, dired-previous-line, dired-next-dirline)
    (dired-prev-dirline, dired-up-directory, dired-get-file-for-visit)
    (dired-find-file, dired-find-alternate-file, dired-mouse-find-file)
    (dired-mouse-find-file-other-window, dired-mouse-find-file-other-frame)
    (dired-view-file, dired-find-file-other-window, dired-display-file)
    (dired-copy-filename-as-kill, dired-next-subdir)
    (dired-build-subdir-alist, dired-goto-file, dired-do-flagged-delete)
    (dired-do-delete, dired-next-marked-file, dired-prev-marked-file)
    (dired-mark, dired-unmark, dired-flag-file-deletion)
    (dired-unmark-backward, dired-toggle-marks, dired-mark-files-regexp)
    (dired-number-of-marked-files, dired-mark-files-containing-regexp)
    (dired-flag-files-regexp, dired-mark-symlinks, dired-mark-directories)
    (dired-mark-executables, dired-flag-auto-save-files)
    (dired-flag-garbage-files, dired-flag-backup-files, dired-change-marks)
    (dired-unmark-all-marks, dired-unmark-all-files)
    (dired-sort-toggle-or-edit, dired-mark-for-click)
    (dired-enable-click-to-select-mode): Tag commands as applicable only
    for dired-mode.
---
 lisp/dired-aux.el | 117 +++++++++++++++++++++++++++++-------------------------
 lisp/dired-x.el   |  32 ++++++++-------
 lisp/dired.el     |  97 +++++++++++++++++++++++---------------------
 3 files changed, 132 insertions(+), 114 deletions(-)

diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el
index e0bcae6b005..02194e6ff45 100644
--- a/lisp/dired-aux.el
+++ b/lisp/dired-aux.el
@@ -264,7 +264,8 @@ the string of command switches used as the third argument 
of `diff'."
          (read-string "Options for diff: "
                       (if (stringp diff-switches)
                           diff-switches
-                        (mapconcat #'identity diff-switches " ")))))))
+                        (mapconcat #'identity diff-switches " "))))))
+   dired-mode)
   (let ((current (dired-get-filename t)))
     (when (or (equal (expand-file-name file)
                     (expand-file-name current))
@@ -290,7 +291,8 @@ With prefix arg, prompt for argument SWITCHES which is 
options for `diff'."
                          (if (stringp diff-switches)
                              diff-switches
                            (mapconcat #'identity diff-switches " "))))
-     nil))
+     nil)
+   dired-mode)
   (diff-backup (dired-get-filename) switches))
 
 ;;;###autoload
@@ -336,7 +338,8 @@ only in the active region if `dired-mark-region' is 
non-nil."
        (read-directory-name (format "Compare %s with: "
                                     (dired-current-directory))
                             target-dir target-dir t)))
-    (read-from-minibuffer "Mark if (lisp expr or RET): " nil nil t nil "nil")))
+    (read-from-minibuffer "Mark if (lisp expr or RET): " nil nil t nil "nil"))
+   dired-mode)
   (let* ((dir1 (dired-current-directory))
          (file-alist1 (dired-files-attributes dir1))
          (file-alist2 (dired-files-attributes dir2))
@@ -497,7 +500,7 @@ 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
 has no effect on MS-Windows."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (let* ((files (dired-get-marked-files t arg nil nil t))
         ;; The source of default file attributes is the file at point.
         (default-file (dired-get-filename t t))
@@ -541,7 +544,7 @@ has no effect on MS-Windows."
 Type \\<minibuffer-local-completion-map>\\[next-history-element] \
 to pull the file attributes of the file at point
 into the minibuffer."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (if (and (memq system-type '(ms-dos windows-nt))
            (not (file-remote-p default-directory)))
       (error "chgrp not supported on this system"))
@@ -553,7 +556,7 @@ into the minibuffer."
 Type \\<minibuffer-local-completion-map>\\[next-history-element] \
 to pull the file attributes of the file at point
 into the minibuffer."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (if (and (memq system-type '(ms-dos windows-nt))
            (not (file-remote-p default-directory)))
       (error "chown not supported on this system"))
@@ -566,7 +569,7 @@ This calls touch.
 Type Type \\<minibuffer-local-completion-map>\\[next-history-element] \
 to pull the file attributes of the file at point
 into the minibuffer."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (dired-do-chxxx "Timestamp" dired-touch-program 'touch arg))
 
 ;; Process all the files in FILES in batches of a convenient size,
@@ -618,7 +621,7 @@ into the minibuffer."
   "Print the marked (or next ARG) files.
 Uses the shell command coming from variables `lpr-command' and
 `lpr-switches' as default."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (require 'lpr)
   (let* ((file-list (dired-get-marked-files t arg nil nil t))
         (lpr-switches
@@ -674,7 +677,7 @@ Negative prefix arg KEEP overrides `kept-old-versions' with 
KEEP made positive.
 
 To clear the flags on these files, you can use \\[dired-flag-backup-files]
 with a prefix argument."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (setq keep (if keep (prefix-numeric-value keep) dired-kept-versions))
   (let ((early-retention (if (< keep 0) (- keep) kept-old-versions))
        (late-retention (if (<= keep 0) dired-kept-versions keep))
@@ -828,7 +831,8 @@ Commands that are run asynchronously do not accept user 
input."
       ;; Want to give feedback whether this file or marked files are used:
       (dired-read-shell-command "& on %s: " current-prefix-arg files)
       current-prefix-arg
-      files)))
+      files))
+   dired-mode)
   (unless (string-match-p "&[ \t]*\\'" command)
     (setq command (concat command " &")))
   (dired-do-shell-command command arg file-list))
@@ -895,7 +899,8 @@ Also see the `dired-confirm-shell-command' variable."
       ;; Want to give feedback whether this file or marked files are used:
       (dired-read-shell-command "! on %s: " current-prefix-arg files)
       current-prefix-arg
-      files)))
+      files))
+   dired-mode)
   (let* ((on-each (not (dired--star-or-qmark-p command "*" 'keep)))
         (no-subst (not (dired--star-or-qmark-p command "?" 'keep)))
          (confirmations nil)
@@ -1342,7 +1347,7 @@ See `dired-guess-shell-alist-user'."
   "Kill the current line (not the files).
 With a prefix argument, kill that many lines starting with the current line.
 (A negative argument kills backward.)"
-  (interactive "P")
+  (interactive "P" dired-mode)
   (setq arg (prefix-numeric-value arg))
   (let (buffer-read-only file)
     (while (/= 0 arg)
@@ -1383,7 +1388,7 @@ lines removed by this invocation, for the reporting 
message.
 
 A FMT of \"\" will suppress the messaging."
   ;; Returns count of killed lines.
-  (interactive "P")
+  (interactive "P" dired-mode)
   (if arg
       (if (dired-get-subdir)
           (dired-kill-subdir)
@@ -1520,7 +1525,7 @@ output file.  %i path(s) are relative, while %o is 
absolute.")
 Prompt for the archive file name.
 Choose the archiving command based on the archive file-name extension
 and `dired-compress-files-alist'."
-  (interactive)
+  (interactive nil dired-mode)
   (let* ((in-files (dired-get-marked-files nil nil nil nil t))
          (out-file (expand-file-name (read-file-name "Compress to: ")))
          (rule (cl-find-if
@@ -1758,7 +1763,7 @@ the directory and all of its subdirectories, recursively,
 into a .tar.gz archive.
 If invoked on a .tar.gz or a .tgz or a .zip or a .7z archive,
 uncompress and unpack all the files in the archive."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (dired-map-over-marks-check #'dired-compress arg 'compress t))
 
 
@@ -1787,7 +1792,7 @@ uncompress and unpack all the files in the archive."
 ;;;###autoload
 (defun dired-do-byte-compile (&optional arg)
   "Byte compile marked (or next ARG) Emacs Lisp files."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (dired-map-over-marks-check #'dired-byte-compile arg 'byte-compile t))
 
 (defun dired-load ()
@@ -1804,7 +1809,7 @@ uncompress and unpack all the files in the archive."
 ;;;###autoload
 (defun dired-do-load (&optional arg)
   "Load the marked (or next ARG) Emacs Lisp files."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (dired-map-over-marks-check #'dired-load arg 'load t))
 
 ;;;###autoload
@@ -1821,7 +1826,7 @@ You can reset all subdirectory switches to the default 
using
 \\<dired-mode-map>\\[dired-reset-subdir-switches].
 See Info node `(emacs)Subdir switches' for more details."
   ;; Moves point if the next ARG files are redisplayed.
-  (interactive "P\np")
+  (interactive "P\np" dired-mode)
   (if (and test-for-subdir (dired-get-subdir))
       (let* ((dir (dired-get-subdir))
             (switches (cdr (assoc-string dir dired-switches-alist))))
@@ -1851,7 +1856,7 @@ See Info node `(emacs)Subdir switches' for more details."
 
 (defun dired-reset-subdir-switches ()
   "Set `dired-switches-alist' to nil and revert Dired buffer."
-  (interactive)
+  (interactive nil dired-mode)
   (setq dired-switches-alist nil)
   (revert-buffer))
 
@@ -2691,7 +2696,8 @@ FILENAME is a full file name."
 Parent directories of DIRECTORY are created as needed.
 If DIRECTORY already exists, signal an error."
   (interactive
-   (list (read-file-name "Create directory: " (dired-current-directory))))
+   (list (read-file-name "Create directory: " (dired-current-directory)))
+   dired-mode)
   (let* ((expanded (directory-file-name (expand-file-name directory)))
         new)
     (if (file-exists-p expanded)
@@ -2708,7 +2714,7 @@ If DIRECTORY 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: ")))
+  (interactive (list (read-file-name "Create empty file: ")) dired-mode)
   (let* ((expanded (expand-file-name file))
          new)
     (if (file-exists-p expanded)
@@ -2771,7 +2777,7 @@ element 4 (`\\[universal-argument]'), the inverted value 
of
 `dired-copy-dereference' will be used.
 
 Also see `dired-do-revert-buffer'."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (let ((dired-recursive-copies dired-recursive-copies)
         (dired-copy-dereference (if (equal arg '(4))
                                     (not dired-copy-dereference)
@@ -2794,7 +2800,7 @@ suggested for the target directory depends on the value of
 For relative symlinks, use \\[dired-do-relsymlink].
 
 Also see `dired-do-revert-buffer'."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (dired-do-create-files 'symlink #'make-symbolic-link
                          "Symlink" arg dired-keep-marker-symlink))
 
@@ -2811,7 +2817,7 @@ not absolute ones like
     foo -> /ugly/file/name/that/may/change/any/day/bar/foo
 
 For absolute symlinks, use \\[dired-do-symlink]."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (dired-do-create-files 'relsymlink #'dired-make-relative-symlink
                          "RelSymLink" arg dired-keep-marker-relsymlink))
 
@@ -2876,7 +2882,7 @@ suggested for the target directory depends on the value of
 `dired-dwim-target', which see.
 
 Also see `dired-do-revert-buffer'."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (dired-do-create-files 'hardlink #'dired-hardlink
                          "Hardlink" arg dired-keep-marker-hardlink))
 
@@ -2897,7 +2903,7 @@ The default suggested for the target directory depends on 
the value
 of `dired-dwim-target', which see.
 
 Also see `dired-do-revert-buffer'."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (when (seq-find (lambda (file)
                     (member (file-name-nondirectory file) '("." "..")))
                   (dired-get-marked-files nil arg))
@@ -2996,7 +3002,7 @@ REGEXP defaults to the last regexp used.
 
 With a zero prefix arg, renaming by regexp affects the absolute file name.
 Normally, only the non-directory part of the file name is used and changed."
-  (interactive (dired-mark-read-regexp "Rename"))
+  (interactive (dired-mark-read-regexp "Rename") dired-mode)
   (dired-do-create-files-regexp
    #'dired-rename-file
    "Rename" arg regexp newname whole-name dired-keep-marker-rename))
@@ -3005,7 +3011,7 @@ Normally, only the non-directory part of the file name is 
used and changed."
 (defun dired-do-copy-regexp (regexp newname &optional arg whole-name)
   "Copy selected files whose names match REGEXP to NEWNAME.
 See function `dired-do-rename-regexp' for more info."
-  (interactive (dired-mark-read-regexp "Copy"))
+  (interactive (dired-mark-read-regexp "Copy") dired-mode)
   (let ((dired-recursive-copies nil))  ; No recursive copies.
     (dired-do-create-files-regexp
      #'dired-copy-file
@@ -3016,7 +3022,7 @@ See function `dired-do-rename-regexp' for more info."
 (defun dired-do-hardlink-regexp (regexp newname &optional arg whole-name)
   "Hardlink selected files whose names match REGEXP to NEWNAME.
 See function `dired-do-rename-regexp' for more info."
-  (interactive (dired-mark-read-regexp "HardLink"))
+  (interactive (dired-mark-read-regexp "HardLink") dired-mode)
   (dired-do-create-files-regexp
    #'add-name-to-file
    "HardLink" arg regexp newname whole-name dired-keep-marker-hardlink))
@@ -3025,7 +3031,7 @@ See function `dired-do-rename-regexp' for more info."
 (defun dired-do-symlink-regexp (regexp newname &optional arg whole-name)
   "Symlink selected files whose names match REGEXP to NEWNAME.
 See function `dired-do-rename-regexp' for more info."
-  (interactive (dired-mark-read-regexp "SymLink"))
+  (interactive (dired-mark-read-regexp "SymLink") dired-mode)
   (dired-do-create-files-regexp
    #'make-symbolic-link
    "SymLink" arg regexp newname whole-name dired-keep-marker-symlink))
@@ -3035,7 +3041,7 @@ See function `dired-do-rename-regexp' for more info."
   "RelSymlink all marked files containing REGEXP to NEWNAME.
 See functions `dired-do-rename-regexp' and `dired-do-relsymlink'
 for more info."
-  (interactive (dired-mark-read-regexp "RelSymLink"))
+  (interactive (dired-mark-read-regexp "RelSymLink") dired-mode)
   (dired-do-create-files-regexp
    #'dired-make-relative-symlink
    "RelSymLink" arg regexp newname whole-name dired-keep-marker-relsymlink))
@@ -3080,13 +3086,13 @@ Type \\`SPC' or \\`y' to %s one file, \\`DEL' or \\`n' 
to skip to next,
 ;;;###autoload
 (defun dired-upcase (&optional arg)
   "Rename all marked (or next ARG) files to upper case."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (dired-rename-non-directory #'upcase "Rename upcase" arg))
 
 ;;;###autoload
 (defun dired-downcase (&optional arg)
   "Rename all marked (or next ARG) files to lower case."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (dired-rename-non-directory #'downcase "Rename downcase" arg))
 
 
@@ -3114,7 +3120,8 @@ See Info node `(emacs)Subdir switches' for more details."
    (list (dired-get-filename)
         (if current-prefix-arg
             (read-string "Switches for listing: "
-                         (or dired-subdir-switches dired-actual-switches)))))
+                         (or dired-subdir-switches dired-actual-switches))))
+   dired-mode)
   (let ((opoint (point)))
     ;; We don't need a marker for opoint as the subdir is always
     ;; inserted *after* opoint.
@@ -3146,7 +3153,8 @@ This function takes some pains to conform to `ls -lR' 
output."
    (list (dired-get-filename)
         (if current-prefix-arg
             (read-string "Switches for listing: "
-                         (or dired-subdir-switches dired-actual-switches)))))
+                         (or dired-subdir-switches dired-actual-switches))))
+   dired-mode)
   (setq dirname (file-name-as-directory (expand-file-name dirname)))
   (or no-error-if-not-dir-p
       (file-directory-p dirname)
@@ -3223,7 +3231,7 @@ In interactive use, the command prompts for DIRNAME.
 
 When called from Lisp, if REMEMBER-MARKS is non-nil, return an alist
 of marked files.  If KILL-ROOT is non-nil, kill DIRNAME as well."
-  (interactive "DKill tree below directory: \ni\nP")
+  (interactive "DKill tree below directory: \ni\nP" dired-mode)
   (setq dirname (file-name-as-directory (expand-file-name dirname)))
   (let ((s-alist dired-subdir-alist) dir m-alist)
     (while s-alist
@@ -3377,7 +3385,8 @@ When called interactively and not on a subdir line, go to 
this subdir's line."
    (list (if current-prefix-arg
             (prefix-numeric-value current-prefix-arg)
           ;; if on subdir start already, don't stay there!
-          (if (dired-get-subdir) 1 0))))
+          (if (dired-get-subdir) 1 0)))
+   dired-mode)
   (dired-next-subdir (- arg) no-error-if-not-found no-skip))
 
 ;;;###autoload
@@ -3410,7 +3419,7 @@ The next char is \\n."
   "Mark all files except `.' and `..' in current subdirectory.
 If the Dired buffer shows multiple directories, this command
 marks the files listed in the subdirectory that point is in."
-  (interactive)
+  (interactive nil dired-mode)
   (let ((p-min (dired-subdir-min)))
     (dired-mark-files-in-region p-min (dired-subdir-max))))
 
@@ -3419,7 +3428,7 @@ marks the files listed in the subdirectory that point is 
in."
   "Remove all lines of current subdirectory.
 Lower levels are unaffected."
   ;; With optional REMEMBER-MARKS, return a mark-alist.
-  (interactive)
+  (interactive nil dired-mode)
   (let* ((beg (dired-subdir-min))
         (end (dired-subdir-max))
         (modflag (buffer-modified-p))
@@ -3446,7 +3455,7 @@ Lower levels are unaffected."
 ;;;###autoload
 (defun dired-tree-up (arg)
   "Go up ARG levels in the Dired tree."
-  (interactive "p")
+  (interactive "p" dired-mode)
   (let ((dir (dired-current-directory)))
     (while (>= arg 1)
       (setq arg (1- arg)
@@ -3458,7 +3467,7 @@ Lower levels are unaffected."
 ;;;###autoload
 (defun dired-tree-down ()
   "Go down in the Dired tree."
-  (interactive)
+  (interactive nil dired-mode)
   (let ((dir (dired-current-directory)) ; has slash
        pos case-fold-search)           ; filenames are case sensitive
     (let ((rest (reverse dired-subdir-alist)) elt)
@@ -3480,7 +3489,7 @@ Lower levels are unaffected."
   "Hide or unhide the current subdirectory and move to next directory.
 Optional prefix arg is a repeat factor.
 Use \\[dired-hide-all] to (un)hide all directories."
-  (interactive "p")
+  (interactive "p" dired-mode)
   (with-silent-modifications
     (while (>=  (setq arg (1- arg)) 0)
       (let* ((cur-dir (dired-current-directory))
@@ -3501,7 +3510,7 @@ Use \\[dired-hide-all] to (un)hide all directories."
   "Hide all subdirectories, leaving only their header lines.
 If there is already something hidden, make everything visible again.
 Use \\[dired-hide-subdir] to (un)hide a particular subdirectory."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (with-silent-modifications
     (if (text-property-any (point-min) (point-max) 'invisible 'dired)
        (dired--unhide (point-min) (point-max))
@@ -3577,14 +3586,14 @@ It's intended to override the default search function."
 ;;;###autoload
 (defun dired-isearch-filenames ()
   "Search for a string using Isearch only in file names in the Dired buffer."
-  (interactive)
+  (interactive nil dired-mode)
   (setq-local dired-isearch-filenames t)
   (isearch-forward nil t))
 
 ;;;###autoload
 (defun dired-isearch-filenames-regexp ()
   "Search for a regexp using Isearch only in file names in the Dired buffer."
-  (interactive)
+  (interactive nil dired-mode)
   (setq-local dired-isearch-filenames t)
   (isearch-forward-regexp nil t))
 
@@ -3594,7 +3603,7 @@ It's intended to override the default search function."
 ;;;###autoload
 (defun dired-do-isearch ()
   "Search for a string through all marked files using Isearch."
-  (interactive)
+  (interactive nil dired-mode)
   (multi-isearch-files
    (prog1 (dired-get-marked-files nil nil
                                   #'dired-nondirectory-p nil t)
@@ -3603,7 +3612,7 @@ It's intended to override the default search function."
 ;;;###autoload
 (defun dired-do-isearch-regexp ()
   "Search for a regexp through all marked files using Isearch."
-  (interactive)
+  (interactive nil dired-mode)
   (prog1 (multi-isearch-files-regexp
           (dired-get-marked-files nil nil
                                   'dired-nondirectory-p nil t))
@@ -3619,7 +3628,7 @@ If no files are marked, search through the file under 
point.
 Stops when a match is found.
 
 To continue searching for next match, use command \\[fileloop-continue]."
-  (interactive "sSearch marked files (regexp): ")
+  (interactive "sSearch marked files (regexp): " dired-mode)
   (fileloop-initialize-search
    regexp
    (dired-get-marked-files nil nil #'dired-nondirectory-p)
@@ -3642,7 +3651,8 @@ resume the query replace with the command 
\\[fileloop-continue]."
    (let ((common
          (query-replace-read-args
           "Query replace regexp in marked files" t t)))
-     (list (nth 0 common) (nth 1 common) (nth 2 common))))
+     (list (nth 0 common) (nth 1 common) (nth 2 common)))
+   dired-mode)
   (dolist (file (dired-get-marked-files nil nil #'dired-nondirectory-p nil t))
     (let ((buffer (get-file-buffer file)))
       (if (and buffer (with-current-buffer buffer
@@ -3686,7 +3696,7 @@ matching `grep-find-ignored-directories' are skipped in 
the marked
 directories.
 
 REGEXP should use constructs supported by your local `grep' command."
-  (interactive "sSearch marked files (regexp): ")
+  (interactive "sSearch marked files (regexp): " dired-mode)
   (require 'grep)
   (require 'xref)
   (defvar grep-find-ignored-files)
@@ -3741,7 +3751,8 @@ function works."
    (let ((common
           (query-replace-read-args
            "Query replace regexp in marked files" t t)))
-     (list (nth 0 common) (nth 1 common))))
+     (list (nth 0 common) (nth 1 common)))
+   dired-mode)
   (require 'xref)
   (defvar xref-show-xrefs-function)
   (defvar xref-auto-jump-to-first-xref)
@@ -3763,7 +3774,7 @@ function works."
 If you give a prefix argument \\[universal-argument] to this command, and
 FILE is a symbolic link, then the command will print the type
 of the target of the link instead."
-  (interactive (list (dired-get-filename t) current-prefix-arg))
+  (interactive (list (dired-get-filename t) current-prefix-arg) dired-mode)
   (let (process-file-side-effects)
     (with-temp-buffer
       (if deref-symlinks
@@ -3796,7 +3807,7 @@ the same files/directories marked in the VC-Directory 
buffer that were
 marked in the original Dired buffer.  If the current directory doesn't
 belong to a VCS repository, prompt for a repository directory.  In this
 case, the VERBOSE argument is ignored."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (let* ((marked-files
           (dired-get-marked-files nil nil nil nil t))
          (mark-files
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index b7824fa81bd..04b3c783084 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -299,7 +299,7 @@ Optional MARKER-CHAR is marker to use.
 Interactively, ask for EXTENSION.
 Prefixed with one \\[universal-argument], unmark files instead.
 Prefixed with two \\[universal-argument]'s, prompt for MARKER-CHAR and mark 
files with it."
-  (interactive (dired--mark-suffix-interactive-spec))
+  (interactive (dired--mark-suffix-interactive-spec) dired-mode)
   (setq extension (ensure-list extension))
   (dired-mark-files-regexp
    (concat ".";; don't match names with nothing but an extension
@@ -323,7 +323,7 @@ Optional MARKER-CHAR is marker to use.
 Interactively, ask for SUFFIX.
 Prefixed with one \\[universal-argument], unmark files instead.
 Prefixed with two \\[universal-argument]'s, prompt for MARKER-CHAR and mark 
files with it."
-  (interactive (dired--mark-suffix-interactive-spec))
+  (interactive (dired--mark-suffix-interactive-spec) dired-mode)
   (setq suffix (ensure-list suffix))
   (dired-mark-files-regexp
    (concat ".";; don't match names with nothing but an extension
@@ -335,7 +335,7 @@ Prefixed with two \\[universal-argument]'s, prompt for 
MARKER-CHAR and mark file
 (defun dired-flag-extension (extension)
   "In Dired, flag all files with a certain EXTENSION for deletion.
 A `.' is *not* automatically prepended to the string entered."
-  (interactive "sFlagging extension: ")
+  (interactive "sFlagging extension: " dired-mode)
   (dired-mark-extension extension dired-del-marker))
 
 ;; Define some unpopular file extensions.  Used for cleaning and omitting.
@@ -364,7 +364,7 @@ A `.' is *not* automatically prepended to the string 
entered."
 (defun dired-clean-patch ()
   "Flag dispensable files created by patch for deletion.
 See variable `dired-patch-unclean-extensions'."
-  (interactive)
+  (interactive nil dired-mode)
   (dired-flag-extension dired-patch-unclean-extensions))
 
 (defun dired-clean-tex ()
@@ -372,7 +372,7 @@ See variable `dired-patch-unclean-extensions'."
 See variables `dired-tex-unclean-extensions',
 `dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions' and
 `dired-texinfo-unclean-extensions'."
-  (interactive)
+  (interactive nil dired-mode)
   (dired-flag-extension (append dired-texinfo-unclean-extensions
                                 dired-latex-unclean-extensions
                                 dired-bibtex-unclean-extensions
@@ -383,7 +383,7 @@ See variables `dired-tex-unclean-extensions',
 See variables `dired-texinfo-unclean-extensions',
 `dired-latex-unclean-extensions', `dired-bibtex-unclean-extensions' and
 `dired-texinfo-unclean-extensions'."
-  (interactive)
+  (interactive nil dired-mode)
   (dired-flag-extension (append dired-texinfo-unclean-extensions
                                 dired-latex-unclean-extensions
                                 dired-bibtex-unclean-extensions
@@ -419,7 +419,7 @@ Should never be used as marker by the user or other 
packages.")
 
 (defun dired-mark-omitted ()
   "Mark files matching `dired-omit-files' and `dired-omit-extensions'."
-  (interactive)
+  (interactive nil dired-mode)
   (let ((dired-omit-mode nil)) (revert-buffer)) ;; Show omitted files
   (dired-mark-unmarked-files (dired-omit-regexp) nil nil dired-omit-localp
                              (dired-omit-case-fold-p (if (stringp 
dired-directory)
@@ -455,7 +455,7 @@ if called from Lisp and buffer is bigger than 
`dired-omit-size-limit'.
 Optional arg INIT-COUNT is an initial count tha'is added to the number
 of lines omitted by this invocation of `dired-omit-expunge', in the
 status message."
-  (interactive "sOmit files (regexp): \nP")
+  (interactive "sOmit files (regexp): \nP" dired-mode)
   ;; Bind `dired-marker-char' to `dired-omit-marker-char',
   ;; then call `dired-do-kill-lines'.
   (if (and dired-omit-mode
@@ -531,7 +531,8 @@ files in the active region if `dired-mark-region' is 
non-nil."
    (list (read-regexp
           (format-prompt "Mark unmarked files matching regexp" "all")
           nil 'dired-regexp-history)
-        nil current-prefix-arg nil))
+        nil current-prefix-arg nil)
+   dired-mode)
   (let ((dired-marker-char (if unflag-p ?\s dired-marker-char)))
     (dired-mark-if
      (and
@@ -736,7 +737,7 @@ displayed this way is restricted by the height of the 
current window and
 
 To keep Dired buffer displayed, type \\[split-window-below] first.
 To display just marked files, type \\[delete-other-windows] first."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (dired-simultaneous-find-file (dired-get-marked-files nil nil nil nil t)
                                 noselect))
 
@@ -780,7 +781,7 @@ NOSELECT the files are merely found but not selected."
   "Run VM on this file.
 With optional prefix argument, visits the folder read-only.
 Otherwise obeys the value of `dired-vm-read-only-folders'."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (let ((dir (dired-current-directory))
         (fil (dired-get-filename)))
     (vm-visit-folder fil (or read-only
@@ -792,7 +793,7 @@ Otherwise obeys the value of `dired-vm-read-only-folders'."
 
 (defun dired-rmail ()
   "Run RMAIL on this file."
-  (interactive)
+  (interactive nil dired-mode)
   (rmail (dired-get-filename)))
 
 (defun dired-do-run-mail ()
@@ -800,7 +801,7 @@ Otherwise obeys the value of `dired-vm-read-only-folders'."
 Prompt for confirmation first; if the user says yes, call
 `dired-vm' if `dired-bind-vm' is non-nil, `dired-rmail'
 otherwise."
-  (interactive)
+  (interactive nil dired-mode)
   (let ((file (dired-get-filename t)))
     (if dired-bind-vm
        (if (y-or-n-p (format-message
@@ -886,7 +887,8 @@ only in the active region if `dired-mark-region' is 
non-nil."
                   (if current-prefix-arg
                       "UNmark"
                     "Mark")))
-         current-prefix-arg))
+         current-prefix-arg)
+   dired-mode)
   (message "%s" predicate)
   (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char))
         inode s mode nlink uid gid size time name sym)
@@ -1012,7 +1014,7 @@ is loaded then call \\[dired-x-bind-find-file]."
   "Bind `dired-x-find-file' in place of `find-file' (or vice-versa).
 Similarly for `dired-x-find-file-other-window' and `find-file-other-window'.
 Binding direction based on `dired-x-hands-off-my-keys'."
-  (interactive)
+  (interactive nil)
   (if (called-interactively-p 'interactive)
       (setq dired-x-hands-off-my-keys
             (not (y-or-n-p (format-message
diff --git a/lisp/dired.el b/lisp/dired.el
index 8919d2c223f..583cb2475e2 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1823,7 +1823,7 @@ see `dired-use-ls-dired' for more details.")
   "Begin a drag-and-drop operation for the file at EVENT.
 If there are marked files and that file is marked, drag every
 other marked file as well.  Otherwise, unmark all files."
-  (interactive "e")
+  (interactive "e" dired-mode)
   (when mark-active
     (deactivate-mark))
   (let* ((modifiers (event-modifiers event))
@@ -2662,7 +2662,7 @@ Keybindings:
   "Undo in a Dired buffer.
 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)
+  (interactive nil dired-mode)
   (let ((inhibit-read-only t))
     (undo))
   (dired-build-subdir-alist)
@@ -2674,7 +2674,7 @@ Actual changes in files cannot be undone by Emacs."))
 If the current buffer can be edited with Wdired, (i.e. the major
 mode is `dired-mode'), call `wdired-change-to-wdired-mode'.
 Otherwise, toggle `read-only-mode'."
-  (interactive)
+  (interactive nil dired-mode)
   (unless (file-exists-p default-directory)
     (user-error "The current directory no longer exists"))
   (when (and (not (file-writable-p default-directory))
@@ -2703,7 +2703,7 @@ to move; the default is one line.
 
 Whether to skip empty lines and how to move from last line
 is controlled by `dired-movement-style'."
-  (interactive "^p")
+  (interactive "^p" dired-mode)
   (if dired-movement-style
       (let ((old-position (progn
                             ;; It's always true that we should move
@@ -2750,12 +2750,12 @@ to move; the default is one line.
 
 Whether to skip empty lines and how to move from first line
 is controlled by `dired-movement-style'."
-  (interactive "^p")
+  (interactive "^p" dired-mode)
   (dired-next-line (- (or arg 1))))
 
 (defun dired-next-dirline (arg &optional opoint)
   "Goto ARGth next directory file line."
-  (interactive "p")
+  (interactive "p" dired-mode)
   (or opoint (setq opoint (point)))
   (if (if (> arg 0)
          (re-search-forward dired-re-dir nil t arg)
@@ -2767,7 +2767,7 @@ is controlled by `dired-movement-style'."
 
 (defun dired-prev-dirline (arg)
   "Goto ARGth previous directory file line."
-  (interactive "p")
+  (interactive "p" dired-mode)
   (dired-next-dirline (- arg)))
 
 (defun dired-up-directory (&optional other-window)
@@ -2776,7 +2776,7 @@ Find the parent directory either in this buffer or 
another buffer.
 Creates a buffer if necessary.
 If OTHER-WINDOW (the optional prefix arg), display the parent
 directory in another window."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (let* ((dir (dired-current-directory))
         (up (file-name-directory (directory-file-name dir))))
     (or (dired-goto-file (directory-file-name dir))
@@ -2791,7 +2791,7 @@ directory in another window."
 
 (defun dired-get-file-for-visit ()
   "Get the current line's file name, with an error if file does not exist."
-  (interactive)
+  (interactive nil dired-mode)
   ;; We pass t for second arg so that we don't get error for `.' and `..'.
   (let ((raw (dired-get-filename nil t))
        file-name)
@@ -2811,7 +2811,7 @@ directory in another window."
   #'dired-find-file "23.2")
 (defun dired-find-file ()
   "In Dired, visit the file or directory named on this line."
-  (interactive)
+  (interactive nil dired-mode)
   (dired--find-possibly-alternative-file (dired-get-file-for-visit)))
 
 (defun dired--find-possibly-alternative-file (file)
@@ -2843,7 +2843,7 @@ directory in another window."
 (defun dired-find-alternate-file ()
   "In Dired, visit file or directory on current line via `find-alternate-file'.
 This kills the Dired buffer, then visits the current line's file or directory."
-  (interactive)
+  (interactive nil dired-mode)
   (set-buffer-modified-p nil)
   (find-alternate-file (dired-get-file-for-visit)))
 ;; Don't override the setting from .emacs.
@@ -2857,7 +2857,7 @@ omitted or nil, these arguments default to `find-file' 
and `dired',
 respectively.  If `dired-kill-when-opening-new-dired-buffer' is
 non-nil, FIND-DIR-FUNC defaults to `find-alternate-file' instead,
 so that the original Dired buffer is not kept."
-  (interactive "e")
+  (interactive "e" dired-mode)
   (or find-file-func (setq find-file-func 'find-file))
   (let (window pos file)
     (save-excursion
@@ -2885,19 +2885,19 @@ so that the original Dired buffer is not kept."
 
 (defun dired-mouse-find-file-other-window (event)
   "In Dired, visit the file or directory name you click on in another window."
-  (interactive "e")
+  (interactive "e" dired-mode)
   (dired-mouse-find-file event 'find-file-other-window 'dired-other-window))
 
 (defun dired-mouse-find-file-other-frame (event)
   "In Dired, visit the file or directory name you click on in another frame."
-  (interactive "e")
+  (interactive "e" dired-mode)
   (dired-mouse-find-file event 'find-file-other-frame 'dired-other-frame))
 
 (defun dired-view-file ()
   "In Dired, examine a file in view mode, returning to Dired when done.
 When file is a directory, show it in this buffer if it is inserted.
 Otherwise, display it in another buffer."
-  (interactive)
+  (interactive nil dired-mode)
   (let ((file (dired-get-file-for-visit)))
     (if (file-directory-p file)
        (or (and (cdr dired-subdir-alist)
@@ -2907,12 +2907,12 @@ Otherwise, display it in another buffer."
 
 (defun dired-find-file-other-window ()
   "In Dired, visit this file or directory in another window."
-  (interactive)
+  (interactive nil dired-mode)
   (dired--find-file #'find-file-other-window (dired-get-file-for-visit)))
 
 (defun dired-display-file ()
   "In Dired, display this file or directory in another window."
-  (interactive)
+  (interactive nil dired-mode)
   (display-buffer (find-file-noselect (dired-get-file-for-visit))
                  t))
 
@@ -3249,7 +3249,7 @@ If on a subdir headerline, use absolute subdirname 
instead;
 prefix arg and marked files are ignored in this case.
 
 You can then feed the file name(s) to other commands with \\[yank]."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (let* ((files
           (or (ensure-list (dired-get-subdir))
               (if arg
@@ -3435,7 +3435,7 @@ As a side effect, killed dired buffers for DIR are 
removed from
   ;; Use 0 arg to go to this directory's header line.
   ;; NO-SKIP prevents moving to end of header line, returning whatever
   ;; position was found in dired-subdir-alist.
-  (interactive "p")
+  (interactive "p" dired-mode)
   (let ((this-dir (dired-current-directory))
        pos index)
     ;; nth with negative arg does not return nil but the first element
@@ -3456,7 +3456,7 @@ As a side effect, killed dired buffers for DIR are 
removed from
 Returns the new value of the alist.
 If optional arg SWITCHES is non-nil, use its value
 instead of `dired-actual-switches'."
-  (interactive)
+  (interactive nil dired-mode)
   (dired-clear-alist)
   (save-excursion
     (let* ((count 0)
@@ -3560,7 +3560,8 @@ instead of `dired-actual-switches'."
        (list (expand-file-name
              (read-file-name "Goto file: "
                              (dired-current-directory))))
-     (push-mark)))
+     (push-mark))
+   dired-mode)
   (unless (file-name-absolute-p file)
     (error "File name `%s' is not absolute" file))
   (setq file (directory-file-name file)) ; does no harm if not a directory
@@ -3759,7 +3760,7 @@ If NOMESSAGE is non-nil, we don't display any message
 if there are no flagged files.
 `dired-recursive-deletes' controls whether deletion of
 non-empty directories is allowed."
-  (interactive)
+  (interactive nil dired-mode)
   (let* ((dired-marker-char dired-del-marker)
         (regexp (dired-marker-regexp))
         case-fold-search markers)
@@ -3789,7 +3790,7 @@ non-empty directories is allowed."
 non-empty directories is allowed."
   ;; This is more consistent with the file marking feature than
   ;; dired-do-flagged-delete.
-  (interactive "P")
+  (interactive "P" dired-mode)
   (let (markers)
     (dired-internal-do-deletions
      (nreverse
@@ -4093,7 +4094,7 @@ marked file is found after this line.
 Optional argument OPOINT specifies the buffer position to
 return to if no ARGth marked file is found; it defaults to
 the position where this command was invoked."
-  (interactive "p\np")
+  (interactive "p\np" dired-mode)
   (or opoint (setq opoint (point)));; return to where interactively started
   (if (if (> arg 0)
          (re-search-forward dired-re-mark nil t arg)
@@ -4114,7 +4115,7 @@ ARG is the numeric prefix argument and defaults to 1.
 If WRAP is non-nil, which happens interactively, wrap around
 to the end of the buffer and search backwards from there, if
 no ARGth marked file is found before this line."
-  (interactive "p\np")
+  (interactive "p\np" dired-mode)
   (dired-next-marked-file (- arg) wrap))
 
 (defun dired-file-marker (file)
@@ -4153,7 +4154,7 @@ If on a subdir headerline, mark all its files except `.' 
and `..'.
 Use \\[dired-unmark-all-files] to remove all marks
 and \\[dired-unmark] on a subdir to remove the marks in
 this subdir."
-  (interactive (list current-prefix-arg t))
+  (interactive (list current-prefix-arg t) dired-mode)
   (cond
    ;; Mark files in the active region.
    ((and interactive dired-mark-region
@@ -4192,7 +4193,7 @@ Otherwise, with a prefix arg, unmark files on the next 
ARG lines.
 If looking at a subdir, unmark all its files except `.' and `..'.
 If the region is active in Transient Mark mode, unmark all files
 in the active region."
-  (interactive (list current-prefix-arg t))
+  (interactive (list current-prefix-arg t) dired-mode)
   (let ((dired-marker-char ?\s))
     (dired-mark arg interactive)))
 
@@ -4204,7 +4205,7 @@ Otherwise, with a prefix arg, flag files on the next ARG 
lines.
 If on a subdir headerline, flag all its files except `.' and `..'.
 If the region is active in Transient Mark mode, flag all files
 in the active region."
-  (interactive (list current-prefix-arg t))
+  (interactive (list current-prefix-arg t) dired-mode)
   (let ((dired-marker-char dired-del-marker))
     (dired-mark arg interactive)))
 
@@ -4214,7 +4215,7 @@ Optional prefix ARG says how many lines to unmark/unflag; 
default
 is one line.
 If the region is active in Transient Mark mode, unmark all files
 in the active region."
-  (interactive "p")
+  (interactive "p" dired-mode)
   (dired-unmark (- arg) t))
 
 (defun dired-toggle-marks ()
@@ -4226,7 +4227,7 @@ As always, hidden subdirs are not affected.
 In Transient Mark mode, if the mark is active, operate on the contents
 of the region if `dired-mark-region' is non-nil.  Otherwise, operate
 on the whole buffer."
-  (interactive)
+  (interactive nil dired-mode)
   (save-excursion
     (let ((inhibit-read-only t)
           (beg (dired-mark--region-beginning))
@@ -4277,7 +4278,8 @@ object files--just `.o' will mark more than you might 
think."
                                                      (dired-get-filename nil 
t) t))
                                                    "\\'"))))
                       'dired-regexp-history)
-        (if current-prefix-arg ?\s)))
+        (if current-prefix-arg ?\s))
+   dired-mode)
   (let ((dired-marker-char (or marker-char dired-marker-char)))
     (dired-mark-if
      (and (not (looking-at-p dired-re-dot))
@@ -4288,7 +4290,7 @@ object files--just `.o' will mark more than you might 
think."
 
 (defun dired-number-of-marked-files ()
   "Display the number and total size of the marked files."
-  (interactive)
+  (interactive nil dired-mode)
   (let* ((files (dired-get-marked-files nil nil nil t))
          (nmarked
           (cond ((null (cdr files))
@@ -4327,7 +4329,8 @@ since it was last visited."
    (list (read-regexp (concat (if current-prefix-arg "Unmark" "Mark")
                               " files containing (regexp): ")
                       nil 'dired-regexp-history)
-        (if current-prefix-arg ?\s)))
+        (if current-prefix-arg ?\s))
+   dired-mode)
   (let ((dired-marker-char (or marker-char dired-marker-char)))
     (dired-mark-if
      (and (not (looking-at-p dired-re-dot))
@@ -4356,7 +4359,8 @@ 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 (read-regexp "Flag for deletion (regexp): "
-                                  nil 'dired-regexp-history)))
+                                  nil 'dired-regexp-history))
+               dired-mode)
   (dired-mark-files-regexp regexp dired-del-marker))
 
 (defun dired-mark-symlinks (unflag-p)
@@ -4364,7 +4368,7 @@ The match is against the non-directory part of the 
filename.  Use `^'
 With prefix argument, unmark or unflag all those files.
 If the region is active in Transient Mark mode, mark files
 only in the active region if `dired-mark-region' is non-nil."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (let ((dired-marker-char (if unflag-p ?\s dired-marker-char)))
     (dired-mark-if (looking-at-p dired-re-sym) "symbolic link")))
 
@@ -4373,7 +4377,7 @@ only in the active region if `dired-mark-region' is 
non-nil."
 With prefix argument, unmark or unflag all those files.
 If the region is active in Transient Mark mode, mark files
 only in the active region if `dired-mark-region' is non-nil."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (let ((dired-marker-char (if unflag-p ?\s dired-marker-char)))
     (dired-mark-if (and (looking-at-p dired-re-dir)
                        (not (looking-at-p dired-re-dot)))
@@ -4384,7 +4388,7 @@ only in the active region if `dired-mark-region' is 
non-nil."
 With prefix argument, unmark or unflag all those files.
 If the region is active in Transient Mark mode, mark files
 only in the active region if `dired-mark-region' is non-nil."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (let ((dired-marker-char (if unflag-p ?\s dired-marker-char)))
     (dired-mark-if (looking-at-p dired-re-exe) "executable file")))
 
@@ -4396,7 +4400,7 @@ only in the active region if `dired-mark-region' is 
non-nil."
 A prefix argument says to unmark or unflag those files instead.
 If the region is active in Transient Mark mode, flag files
 only in the active region if `dired-mark-region' is non-nil."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (let ((dired-marker-char (if unflag-p ?\s dired-del-marker)))
     (dired-mark-if
      ;; It is less than general to check for # here,
@@ -4430,7 +4434,7 @@ only in the active region if `dired-mark-region' is 
non-nil."
 
 (defun dired-flag-garbage-files ()
   "Flag for deletion all files that match `dired-garbage-files-regexp'."
-  (interactive)
+  (interactive nil dired-mode)
   (dired-flag-files-regexp dired-garbage-files-regexp))
 
 (defun dired-flag-backup-files (&optional unflag-p)
@@ -4438,7 +4442,7 @@ only in the active region if `dired-mark-region' is 
non-nil."
 With prefix argument, unmark or unflag these files.
 If the region is active in Transient Mark mode, flag files
 only in the active region if `dired-mark-region' is non-nil."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (let ((dired-marker-char (if unflag-p ?\s dired-del-marker)))
     (dired-mark-if
      ;; Don't call backup-file-name-p unless the last character looks like
@@ -4466,7 +4470,8 @@ OLD and NEW are both characters used to mark files."
          (old (progn (message "Change (old mark): ") (read-char)))
          (new (progn (message  "Change %c marks to (new mark): " old)
                      (read-char))))
-     (list old new)))
+     (list old new))
+   dired-mode)
   (dolist (c (list new old))
     (if (or (not (char-displayable-p c))
             (eq c ?\r))
@@ -4485,7 +4490,7 @@ OLD and NEW are both characters used to mark files."
 
 (defun dired-unmark-all-marks ()
   "Remove all marks from all files in the Dired buffer."
-  (interactive)
+  (interactive nil dired-mode)
   (dired-unmark-all-files ?\r))
 
 ;; Bound in dired-unmark-all-files
@@ -4497,7 +4502,7 @@ After this command, type the mark character to remove,
 or type RET to remove all marks.
 With prefix arg, query for each marked file.
 Type \\[help-command] at that time for help."
-  (interactive "cRemove marks (RET means all): \nP")
+  (interactive "cRemove marks (RET means all): \nP" dired-mode)
   (save-excursion
     (let* ((count 0)
           (inhibit-read-only t) case-fold-search
@@ -4674,7 +4679,7 @@ Possible values:
 (defun dired-sort-toggle-or-edit (&optional arg)
   "Toggle sorting by date, and refresh the Dired buffer.
 With a prefix argument, edit the current listing switches instead."
-  (interactive "P")
+  (interactive "P" dired-mode)
   (when dired-sort-inhibit
     (error "Cannot sort this Dired buffer"))
   (if arg
@@ -5044,7 +5049,7 @@ Interactively with prefix argument, read FILE-NAME."
 (defun dired-mark-for-click (event)
   "Mark or unmark the file underneath the mouse click at EVENT.
 See `dired-click-to-select-mode' for more details."
-  (interactive "e")
+  (interactive "e" dired-mode)
   (let ((posn (event-start event))
         (inhibit-read-only t))
     (with-selected-window (posn-window posn)
@@ -5067,7 +5072,7 @@ See `dired-click-to-select-mode' for more details."
   "Enable `dired-click-to-select-mode' and mark the file under EVENT.
 If there is no file under EVENT, call `touch-screen-hold' with
 EVENT instead."
-  (interactive "e")
+  (interactive "e" dired-mode)
   (let* ((posn (event-start event))
          (window (posn-window posn))
          (point (posn-point posn)))



reply via email to

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