summaryrefslogtreecommitdiff
path: root/lisp/dired-x.el
diff options
context:
space:
mode:
authorTino Calancha <tino.calancha@gmail.com>2016-10-03 20:02:54 +0900
committerTino Calancha <tino.calancha@gmail.com>2016-10-03 20:02:54 +0900
commit3b6eb9489d03e5ecc60e487e8eb340e34942825c (patch)
treecb05f5d954356415d15e9065fa5cdde2c0b1f91d /lisp/dired-x.el
parent8cd975cebd588d5435fa2b333dba6c526e602933 (diff)
downloademacs-3b6eb9489d03e5ecc60e487e8eb340e34942825c.tar.gz
dired-mark-extension: Unmark if called with C-u prefix
See discussion in #Bug2518 and: https://lists.gnu.org/archive/html/emacs-devel/2016-09/msg00711.html * lisp/dired-x.el (dired-mark-extension): Update interactive calls: a prefix arg C-u unmark files; a prefix C-u C-u prompt for MARKER-CHAR and mark files with it. (dired-mark-sexp): Show in the prompt that we are unmarking if called with a prefix argument. * doc/misc/dired-x.texi (Advanced Mark Commands): Update documentation for 'dired-mark-extension'.
Diffstat (limited to 'lisp/dired-x.el')
-rw-r--r--lisp/dired-x.el38
1 files changed, 27 insertions, 11 deletions
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 7d73c42befb..83139057659 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -334,17 +334,27 @@ See also the functions:
A `.' is *not* automatically prepended to the string entered.
EXTENSION may also be a list of extensions instead of a single one.
Optional MARKER-CHAR is marker to use.
-Interactively, ask for EXTENSION, and if invoked with a prefix
-argument, for MARKER-CHAR as well."
+Interactively, ask for EXTENSION.
+Prefixed with one C-u, unmark files instead.
+Prefixed with two C-u's, prompt for MARKER-CHAR and mark files with it."
(interactive
- (list (read-string "Marking extension: ")
- (and current-prefix-arg
- (let* ((dflt (char-to-string dired-marker-char))
- (input (read-string
- (format
- "Marker character to use (default %s): " dflt)
- nil nil dflt)))
- (aref input 0)))))
+ (let ((suffix
+ (read-string (format "%s extension: "
+ (if (equal current-prefix-arg '(4))
+ "UNmarking"
+ "Marking"))))
+ (marker
+ (pcase current-prefix-arg
+ ('(4) ?\s)
+ ('(16)
+ (let* ((dflt (char-to-string dired-marker-char))
+ (input (read-string
+ (format
+ "Marker character to use (default %s): " dflt)
+ nil nil dflt)))
+ (aref input 0)))
+ (_ dired-marker-char))))
+ (list suffix marker)))
(or (listp extension)
(setq extension (list extension)))
(dired-mark-files-regexp
@@ -1470,7 +1480,13 @@ refer at all to the underlying file system. Contrast this with
;; (string-match "foo" sym) into which a user would soon fall.
;; Give `equal' instead of `=' in the example, as this works on
;; integers and strings.
- (interactive "xMark if (lisp expr): \nP")
+ (interactive
+ (list (read--expression
+ (format "%s if (lisp expr): "
+ (if current-prefix-arg
+ "UNmark"
+ "Mark")))
+ current-prefix-arg))
(message "%s" predicate)
(let ((dired-marker-char (if unflag-p ?\040 dired-marker-char))
inode s mode nlink uid gid size time name sym)