diff options
| author | Paul Eggert | 2017-09-10 22:28:08 -0700 |
|---|---|---|
| committer | Paul Eggert | 2017-09-10 22:31:23 -0700 |
| commit | 2aa028825920207cca2bacb581111ab780e5d9ee (patch) | |
| tree | 14ab0e85762bd65a06258a20789d61efd501c943 | |
| parent | 74b8615fcceba7b92c4938e1bcc92015f10ae899 (diff) | |
| download | emacs-2aa028825920207cca2bacb581111ab780e5d9ee.tar.gz emacs-2aa028825920207cca2bacb581111ab780e5d9ee.zip | |
Adjust thumbs to new rename-file behavior
* etc/NEWS: Mention this.
* lisp/thumbs.el (thumbs-rename-images): Treat the destination
as special only if it is a directory name. When there is
a marked list, turn the destination into a directory name
if it is not already.
| -rw-r--r-- | etc/NEWS | 2 | ||||
| -rw-r--r-- | lisp/thumbs.el | 15 |
2 files changed, 5 insertions, 12 deletions
| @@ -1287,7 +1287,7 @@ can be written as (rename-file C (file-name-as-directory D)), a | |||
| 1287 | formulation portable to both older and newer versions of Emacs. | 1287 | formulation portable to both older and newer versions of Emacs. |
| 1288 | Affected functions include add-name-to-file, copy-directory, | 1288 | Affected functions include add-name-to-file, copy-directory, |
| 1289 | copy-file, format-write-file, gnus-copy-file, make-symbolic-link, | 1289 | copy-file, format-write-file, gnus-copy-file, make-symbolic-link, |
| 1290 | rename-file, and write-file. | 1290 | rename-file, thumbs-rename-images, and write-file. |
| 1291 | 1291 | ||
| 1292 | 1292 | ||
| 1293 | * Lisp Changes in Emacs 26.1 | 1293 | * Lisp Changes in Emacs 26.1 |
diff --git a/lisp/thumbs.el b/lisp/thumbs.el index 0665429246f..d0b5e22414a 100644 --- a/lisp/thumbs.el +++ b/lisp/thumbs.el | |||
| @@ -523,23 +523,16 @@ Open another window." | |||
| 523 | (interactive "FRename to file or directory: ") | 523 | (interactive "FRename to file or directory: ") |
| 524 | (let ((files (or thumbs-marked-list (list (thumbs-current-image)))) | 524 | (let ((files (or thumbs-marked-list (list (thumbs-current-image)))) |
| 525 | failures) | 525 | failures) |
| 526 | (if (and (not (file-directory-p newfile)) | 526 | (when thumbs-marked-list |
| 527 | thumbs-marked-list) | 527 | (make-directory newfile t) |
| 528 | (if (file-exists-p newfile) | 528 | (setq newfile (file-name-as-directory newfile))) |
| 529 | (error "Renaming marked files to file name `%s'" newfile) | ||
| 530 | (make-directory newfile t))) | ||
| 531 | (if (yes-or-no-p (format "Really rename %d files? " (length files))) | 529 | (if (yes-or-no-p (format "Really rename %d files? " (length files))) |
| 532 | (let ((thumbs-file-list (thumbs-file-alist)) | 530 | (let ((thumbs-file-list (thumbs-file-alist)) |
| 533 | (inhibit-read-only t)) | 531 | (inhibit-read-only t)) |
| 534 | (dolist (file files) | 532 | (dolist (file files) |
| 535 | (let (failure) | 533 | (let (failure) |
| 536 | (condition-case () | 534 | (condition-case () |
| 537 | (if (file-directory-p newfile) | 535 | (rename-file file newfile) |
| 538 | (rename-file file | ||
| 539 | (expand-file-name | ||
| 540 | (file-name-nondirectory file) | ||
| 541 | newfile)) | ||
| 542 | (rename-file file newfile)) | ||
| 543 | (file-error (setq failure t) | 536 | (file-error (setq failure t) |
| 544 | (push file failures))) | 537 | (push file failures))) |
| 545 | (unless failure | 538 | (unless failure |