Last active
April 14, 2018 23:31
-
-
Save jidaikobo-shibata/54dab2fc5f2e278833f5 to your computer and use it in GitHub Desktop.
Emacs(Elisp): move current tab (buffer) to top at tabbar-mode. tabbarで選択中のタブ(バッファ)を左端に移動します。
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
;; move-current-tab-to-top | |
;; gist-description: Emacs(Elisp): move current tab (buffer) to top at tabbar-mode. tabbarで選択中のタブ(バッファ)を左端に移動します。 | |
;; gist-id: 54dab2fc5f2e278833f5 | |
;; gist-name: move-current-tab-to-top.el | |
;; gist-private: nil | |
(defun move-current-tab-to-top () | |
"Move current tab to top." | |
(interactive) | |
(let* ((bufset (tabbar-current-tabset t)) | |
(bufs (tabbar-tabs bufset)) | |
(car-bufs (list)) | |
(cdr-bufs (list))) | |
;; 現在のバッファと一致するものを探して先頭へ | |
(dolist (buf bufs) | |
(if (string= (buffer-name) (format "%s" (car buf))) | |
(add-to-list 'car-bufs buf) | |
(add-to-list 'cdr-bufs buf))) | |
(setq cdr-bufs (reverse cdr-bufs)) | |
(set bufset (append car-bufs cdr-bufs)) | |
;; タブバー書き換え | |
(tabbar-set-template bufset nil) | |
(tabbar-display-update))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Very nice. Thanks for this.