Created
July 13, 2016 14:33
-
-
Save itorres/b3054204614b96c08e8d86bab468486b to your computer and use it in GitHub Desktop.
Emacs function to rename shell buffer based on path and tramp host (if this is a tramp buffer)
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 my-rename-shell-buffer () | |
"Rename the current shell buffer name." | |
(interactive) | |
(let ((candidate-name | |
(concat | |
(if (string-prefix-p "/ssh:" default-directory) | |
(concat tramp-current-host ":") | |
"") | |
(file-name-base (directory-file-name default-directory))))) | |
(rename-buffer (format "*shell* <%s>" candidate-name)))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment