Skip to content

Instantly share code, notes, and snippets.

@bamanzi
Created November 4, 2013 03:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bamanzi/7297757 to your computer and use it in GitHub Desktop.
Save bamanzi/7297757 to your computer and use it in GitHub Desktop.
anything-tab-list
(defun anything-c-tab-list ()
"Return a list of buffer names of current tabbar group. "
(unless (and (featurep 'tabbar)
tabbar-mode)
(error "Error: tabbar-mode not turned on."))
(with-current-buffer anything-c-tab-current-buffer
(mapcar #'(lambda (tab) (buffer-name (tabbar-tab-value tab)))
(tabbar-tabs (tabbar-current-tabset t)))))
(setq anything-c-tab-current-buffer nil)
(defvar anything-c-source-tabs
'((name . "Buffers of current Tabbar Group")
(candidates . anything-c-tab-list)
(type . buffer)))
;;FIXED: this implementation would change current buffer (to '*anything-tabs*')
;; thus leads to wrong group
(defun anything-tab-list ()
"Preconfigured `anything' to list buffers.
It is an enhanced version of `anything-for-buffers'."
(interactive)
(setq anything-c-tab-current-buffer (current-buffer))
(anything :sources '(anything-c-source-tabs
anything-c-source-buffer-not-found)
:buffer "*anything tabs*"
:keymap anything-c-buffer-map))
(global-set-key (kbd "<f5> TAB") 'anything-tab-list)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment