Skip to content

Instantly share code, notes, and snippets.

@coldnew
Forked from bamanzi/gist:2250340
Last active August 29, 2015 14:15
Show Gist options
  • Save coldnew/ef66f12e8bc2a4940751 to your computer and use it in GitHub Desktop.
Save coldnew/ef66f12e8bc2a4940751 to your computer and use it in GitHub Desktop.
;; use `frame-bufs.el' to mimic perspective feature
(idle-require 'frame-bufs)
(defun frame-bufs-switch-buffer ()
"Switch buffer, within buffers associated with current frame (`frame-bufs-buffer-list')"
(interactive)
(if (and (fboundp 'frame-bufs-mode)
frame-bufs-mode)
(let* ( (buffers (mapcar 'buffer-name (frame-bufs-buffer-list (selected-frame))))
(buffers-rotated (append (cdr buffers) (cons (car buffers) nil)))
(target (ido-completing-read "Buffer: " buffers-rotated)) )
(switch-to-buffer target))
(call-interactively 'ido-switch-buffer)))
(eval-after-load "frame-bufs"
`(progn
(add-hook 'frame-bufs-mode-on-hook #'(lambda ()
(global-set-key (kbd "C-x b") 'frame-bufs-switch-buffer)
(global-set-key (kbd "C-x B") 'ido-switch-buffer)))
(add-hook 'frame-bufs-mode-off-hook #'(lambda ()
(global-set-key (kbd "C-x b") 'ido-switch-buffer)))
))
;;and you need to modify your 'tabbar-buffer-groups-function'
(defun tabbar-ruler-tabbar-buffer-groups ()
"Return the list of group names the current buffer belongs to.
Return a list of one element based on major mode."
(setq last-tabbar-ruler-tabbar-buffer-groups
(list
(cond
((= (aref (buffer-name) 0) ?*)
"Utils")
(t
"Files"
))))
(if (and (fboundp 'frame-bufs-mode)
frame-bufs-mode
(memq (current-buffer) (frame-bufs-buffer-list (selected-frame))))
(symbol-value 'last-tabbar-ruler-tabbar-buffer-groups)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment