diff options
| author | Chunyang Xu | 2017-02-28 00:41:56 +0200 |
|---|---|---|
| committer | Juri Linkov | 2017-02-28 00:41:56 +0200 |
| commit | 50a2ccd87ec6d1b275f3906cec4ccc28be05c589 (patch) | |
| tree | 1761ab0d6df1d4e04113440e99437343de758fcb | |
| parent | 4daca38d5c673c5b6862e10cfade9559852cce12 (diff) | |
| download | emacs-50a2ccd87ec6d1b275f3906cec4ccc28be05c589.tar.gz emacs-50a2ccd87ec6d1b275f3906cec4ccc28be05c589.zip | |
Prompt default extension in dired-mark-extension
* lisp/dired-x.el (dired-mark-extension): Prompt default extension
based on extension of file at point. (Bug#25578)
Copyright-paperwork-exempt: yes
| -rw-r--r-- | lisp/dired-x.el | 39 |
1 files changed, 23 insertions, 16 deletions
diff --git a/lisp/dired-x.el b/lisp/dired-x.el index 86c95372c25..6c8fb0e7dae 100644 --- a/lisp/dired-x.el +++ b/lisp/dired-x.el | |||
| @@ -342,22 +342,29 @@ Interactively, ask for EXTENSION. | |||
| 342 | Prefixed with one C-u, unmark files instead. | 342 | Prefixed with one C-u, unmark files instead. |
| 343 | Prefixed with two C-u's, prompt for MARKER-CHAR and mark files with it." | 343 | Prefixed with two C-u's, prompt for MARKER-CHAR and mark files with it." |
| 344 | (interactive | 344 | (interactive |
| 345 | (let ((suffix | 345 | (let* ((default |
| 346 | (read-string (format "%s extension: " | 346 | (let ((file (dired-get-filename nil t))) |
| 347 | (if (equal current-prefix-arg '(4)) | 347 | (when file |
| 348 | "UNmarking" | 348 | (file-name-extension file)))) |
| 349 | "Marking")))) | 349 | (suffix |
| 350 | (marker | 350 | (read-string (format "%s extension%s: " |
| 351 | (pcase current-prefix-arg | 351 | (if (equal current-prefix-arg '(4)) |
| 352 | ('(4) ?\s) | 352 | "UNmarking" |
| 353 | ('(16) | 353 | "Marking") |
| 354 | (let* ((dflt (char-to-string dired-marker-char)) | 354 | (if default |
| 355 | (input (read-string | 355 | (format " (default %s)" default) |
| 356 | (format | 356 | "")) nil nil default)) |
| 357 | "Marker character to use (default %s): " dflt) | 357 | (marker |
| 358 | nil nil dflt))) | 358 | (pcase current-prefix-arg |
| 359 | (aref input 0))) | 359 | ('(4) ?\s) |
| 360 | (_ dired-marker-char)))) | 360 | ('(16) |
| 361 | (let* ((dflt (char-to-string dired-marker-char)) | ||
| 362 | (input (read-string | ||
| 363 | (format | ||
| 364 | "Marker character to use (default %s): " dflt) | ||
| 365 | nil nil dflt))) | ||
| 366 | (aref input 0))) | ||
| 367 | (_ dired-marker-char)))) | ||
| 361 | (list suffix marker))) | 368 | (list suffix marker))) |
| 362 | (or (listp extension) | 369 | (or (listp extension) |
| 363 | (setq extension (list extension))) | 370 | (setq extension (list extension))) |