Created
August 2, 2023 21:26
-
-
Save minorugh/861a5abef429b01074fa49afd87ccca2 to your computer and use it in GitHub Desktop.
append [Dir] of dired buffer name
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun dired-my-append-buffer-name-hint () | |
"Append a auxiliary string [Dir] to a name of dired buffer." | |
(when (eq major-mode 'dired-mode) | |
(let* ((dir (expand-file-name list-buffers-directory)) | |
;; Add a drive letter for Windows | |
(drive (if (and (eq 'system-type 'windows-nt) | |
(string-match "^\\([a-zA-Z]:\\)/" dir)) | |
(match-string 1 dir) ""))) | |
(rename-buffer (concat (buffer-name) " [" drive "dir]") t)))) | |
(add-hook 'dired-mode-hook 'dired-my-append-buffer-name-hint) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment