Update renaming, move and/or rename messages
problem: the rename command shows the same message: "File 'old-file-name' successfully renamed to 'new-file-name'" (without the directory path) for all three file operations: move, rename and both move & rename solution: show messages that fit the rename operation, and align the from and to path/file names, to make it easier to see what changed. And use the same message format when renaming a buffer.
This commit is contained in:
parent
5fdb89d61d
commit
8fbdd61e1e
|
@ -1088,6 +1088,8 @@ Other:
|
|||
(thanks to Dominik Schrempf)
|
||||
- Switch recreated messages buffer to =evil-normal-state= (thanks to duianto)
|
||||
- Fixed =spacemacs/layouts-ts-close-other= with =ivy= (thanks to duianto)
|
||||
- Fixed =spacemacs/rename-current-buffer-file=, separate messages for
|
||||
move & rename, just move and just rename (thanks to duianto)
|
||||
*** Layer changes and fixes
|
||||
**** Agda
|
||||
- Fixes
|
||||
|
|
|
@ -353,7 +353,11 @@ initialized with the current directory instead of filename."
|
|||
(if (and filename (file-exists-p filename))
|
||||
;; the buffer is visiting a file
|
||||
(let* ((dir (file-name-directory filename))
|
||||
(new-name (read-file-name "New name: " (if arg dir filename))))
|
||||
(new-name (read-file-name "New name: " (if arg dir filename)))
|
||||
(new-dir (file-name-directory new-name))
|
||||
(new-short-name (file-name-nondirectory new-name))
|
||||
(file-moved-p (not (string-equal new-dir dir)))
|
||||
(file-renamed-p (not (string-equal new-short-name name))))
|
||||
(cond ((get-buffer new-name)
|
||||
(error "A buffer named '%s' already exists!" new-name))
|
||||
(t
|
||||
|
@ -372,8 +376,18 @@ initialized with the current directory instead of filename."
|
|||
(when (and (configuration-layer/package-used-p 'projectile)
|
||||
(projectile-project-p))
|
||||
(call-interactively #'projectile-invalidate-cache))
|
||||
(message "File '%s' successfully renamed to '%s'"
|
||||
name (file-name-nondirectory new-name)))))
|
||||
(message (cond ((and file-moved-p file-renamed-p)
|
||||
(concat "File Moved & Renamed\n"
|
||||
"From: " filename "\n"
|
||||
"To: " new-name))
|
||||
(file-moved-p
|
||||
(concat "File Moved\n"
|
||||
"From: " filename "\n"
|
||||
"To: " new-name))
|
||||
(file-renamed-p
|
||||
(concat "File Renamed\n"
|
||||
"From: " name "\n"
|
||||
"To: " new-short-name)))))))
|
||||
;; the buffer is not visiting a file
|
||||
(let ((key))
|
||||
(while (not (memq key '(?s ?r)))
|
||||
|
@ -398,8 +412,9 @@ initialized with the current directory instead of filename."
|
|||
(setq new-name (read-string "New buffer name: "))
|
||||
(keyboard-quit)))
|
||||
(rename-buffer new-name)
|
||||
(message "Buffer '%s' successfully renamed to '%s'"
|
||||
name new-name)))
|
||||
(message (concat "Buffer Renamed\n"
|
||||
"From: " name "\n"
|
||||
"To: " new-name))))
|
||||
;; ?\a = C-g, ?\e = Esc and C-[
|
||||
((memq key '(?\a ?\e)) (keyboard-quit))))))))
|
||||
|
||||
|
|
Loading…
Reference in a new issue