Pages

Tuesday, September 14, 2010

Multiple Tabs (Elscreen)

(require 'elscreen) ;; C-z n for new screen or next etc.
(require 'elscreen-gf) ;; C-z n for new screen or next etc.

(defmacro elscreen-create-automatically (ad-do-it)
`(if (not (elscreen-one-screen-p))
,ad-do-it
(elscreen-create)
(elscreen-notify-screen-modification 'force-immediately)
(elscreen-message "New screen is automatically created")))

(defadvice elscreen-jump (before elscreen-jump-create activate)
(let ((next-screen (string-to-number (string last-command-event))))
(when (and (<= 0 next-screen)
(<= next-screen 9)
(not (elscreen-screen-live-p next-screen)))
(elscreen-set-window-configuration
(elscreen-get-current-screen)
(elscreen-current-window-configuration))
(elscreen-set-window-configuration
next-screen (elscreen-default-window-configuration))
(elscreen-append-screen-to-history next-screen)
(elscreen-notify-screen-modification 'force))))

(defadvice elscreen-next (around elscreen-create-automatically activate)
(elscreen-create-automatically ad-do-it))

(defadvice elscreen-previous (around elscreen-create-automatically activate)
(elscreen-create-automatically ad-do-it))

(defadvice elscreen-toggle (around elscreen-create-automatically activate)
(elscreen-create-automatically ad-do-it))




No comments:

Post a Comment