aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTino Calancha2016-10-03 20:02:54 +0900
committerTino Calancha2016-10-03 20:02:54 +0900
commit3b6eb9489d03e5ecc60e487e8eb340e34942825c (patch)
treecb05f5d954356415d15e9065fa5cdde2c0b1f91d
parent8cd975cebd588d5435fa2b333dba6c526e602933 (diff)
downloademacs-3b6eb9489d03e5ecc60e487e8eb340e34942825c.tar.gz
emacs-3b6eb9489d03e5ecc60e487e8eb340e34942825c.zip
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'.
-rw-r--r--doc/misc/dired-x.texi6
-rw-r--r--lisp/dired-x.el38
2 files changed, 31 insertions, 13 deletions
diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi
index 2391852ca0f..db01896095c 100644
--- a/doc/misc/dired-x.texi
+++ b/doc/misc/dired-x.texi
@@ -710,8 +710,10 @@ variable @code{window-min-height}.
710@findex dired-mark-extension 710@findex dired-mark-extension
711Mark all files with a certain extension for use in later commands. A @samp{.} 711Mark all files with a certain extension for use in later commands. A @samp{.}
712is not automatically prepended to the string entered, you must type it 712is not automatically prepended to the string entered, you must type it
713explicitly. If invoked with a prefix argument, this command asks for 713explicitly.
714a character to use as the marker. 714If invoked with prefix argument @kbd{C-u}, this command unmark files instead.
715If called with the @kbd{C-u C-u} prefix, asks for a character to use
716as the marker, and marks files with it.
715 717
716When called from Lisp, @var{extension} may also be a list of extensions 718When called from Lisp, @var{extension} may also be a list of extensions
717and an optional argument @var{marker-char} specifies the marker used. 719and an optional argument @var{marker-char} specifies the marker used.
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:
334A `.' is *not* automatically prepended to the string entered. 334A `.' is *not* automatically prepended to the string entered.
335EXTENSION may also be a list of extensions instead of a single one. 335EXTENSION may also be a list of extensions instead of a single one.
336Optional MARKER-CHAR is marker to use. 336Optional MARKER-CHAR is marker to use.
337Interactively, ask for EXTENSION, and if invoked with a prefix 337Interactively, ask for EXTENSION.
338argument, for MARKER-CHAR as well." 338Prefixed with one C-u, unmark files instead.
339Prefixed with two C-u's, prompt for MARKER-CHAR and mark files with it."
339 (interactive 340 (interactive
340 (list (read-string "Marking extension: ") 341 (let ((suffix
341 (and current-prefix-arg 342 (read-string (format "%s extension: "
342 (let* ((dflt (char-to-string dired-marker-char)) 343 (if (equal current-prefix-arg '(4))
343 (input (read-string 344 "UNmarking"
344 (format 345 "Marking"))))
345 "Marker character to use (default %s): " dflt) 346 (marker
346 nil nil dflt))) 347 (pcase current-prefix-arg
347 (aref input 0))))) 348 ('(4) ?\s)
349 ('(16)
350 (let* ((dflt (char-to-string dired-marker-char))
351 (input (read-string
352 (format
353 "Marker character to use (default %s): " dflt)
354 nil nil dflt)))
355 (aref input 0)))
356 (_ dired-marker-char))))
357 (list suffix marker)))
348 (or (listp extension) 358 (or (listp extension)
349 (setq extension (list extension))) 359 (setq extension (list extension)))
350 (dired-mark-files-regexp 360 (dired-mark-files-regexp
@@ -1470,7 +1480,13 @@ refer at all to the underlying file system. Contrast this with
1470 ;; (string-match "foo" sym) into which a user would soon fall. 1480 ;; (string-match "foo" sym) into which a user would soon fall.
1471 ;; Give `equal' instead of `=' in the example, as this works on 1481 ;; Give `equal' instead of `=' in the example, as this works on
1472 ;; integers and strings. 1482 ;; integers and strings.
1473 (interactive "xMark if (lisp expr): \nP") 1483 (interactive
1484 (list (read--expression
1485 (format "%s if (lisp expr): "
1486 (if current-prefix-arg
1487 "UNmark"
1488 "Mark")))
1489 current-prefix-arg))
1474 (message "%s" predicate) 1490 (message "%s" predicate)
1475 (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char)) 1491 (let ((dired-marker-char (if unflag-p ?\040 dired-marker-char))
1476 inode s mode nlink uid gid size time name sym) 1492 inode s mode nlink uid gid size time name sym)