Skip to content

Instantly share code, notes, and snippets.

@Johniel
Created April 7, 2012 09:00
Show Gist options
  • Save Johniel/2326684 to your computer and use it in GitHub Desktop.
Save Johniel/2326684 to your computer and use it in GitHub Desktop.
;; remove left/right tabs
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(defun tabbar-tab-index(ctabs ctab)
(let ((index 0)
(head '())
(rest ctabs))
(while (not (eq ctab (car rest)))
(incf index)
(setq head (append head (list (car rest))))
(setq rest (cdr rest)))
index))
(defun tabbar-remove (fn)
(let* ((ctabset (tabbar-current-tabset 't))
(ctabs (tabbar-tabs ctabset))
(ctab (tabbar-selected-tab ctabset)))
(if (and ctabset ctabs ctab (or (eq fn 'nthcar) (eq fn 'nthcdr)))
(mapcar (lambda (tab)
(kill-buffer (car tab)))
(funcall fn (+ (if (eq fn 'nthcdr) +1 0)
(tabbar-tab-index ctabs ctab))
ctabs)))))
(defun tabbar-remove-right ()
(interactive)
(tabbar-remove 'nthcdr))
(defun tabbar-remove-left ()
(interactive)
(tabbar-remove 'nthcar))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment