21 Nov

Tabbed Emacs

Tuesday November 21st 2006, 10:29 am
Tags: , ,

You like Firefox’s tabs to clean up your screen and keep an overview of which pages are open? Of course Emacs can do that as well: elscreen.
With the following code you can open new tabs with C-t and close them with C-x C-c (yes, the way you normally quit your Emacs; Firefox uses C-w which is used in Emacs for cutting text though). Every tab can be split into windows as you like of course.

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Elscreen - http://www.emacswiki.org/cgi-bin/wiki/EmacsLispScreen
(load "elscreen" "ElScreen" t)
(global-set-key (kbd "<C-tab>") ‘elscreen-toggle)
(global-set-key [(control shift right)] ‘elscreen-next)
(global-set-key [(control shift left)] ‘elscreen-previous)
(global-set-key [(control t)] ‘elscreen-create)
(elscreen-set-prefix-key "\C-j")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;; C-x C-c closes frame or tab
(global-set-key "\C-x\C-c" ‘intelligent-kill)

(defun intelligent-kill ()
  "quit the same way no matter what kind of window you are on"
  (interactive)
;  (kill-buffer (buffer-name))
  (if (and (not (elscreen-one-screen-p)) (elscreen-kill))
      (message "Killed screen")
    (if (eq (car (visible-frame-list)) (selected-frame))
        ;;for parent/master frame…
        (if (> (length (visible-frame-list)) 1)
            ;;a parent with children present
            (delete-frame (selected-frame))
          ;;a parent with no children present
          (save-buffers-kill-emacs))
      ;;a child frame
      (delete-frame (selected-frame)))))

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • bodytext
  • del.icio.us
  • Reddit

No Comments »

No comments yet.

 

RSS feed for comments on this post. TrackBack Website

Leave a comment

(required)

(required)

Line and paragraph breaks automatic, e-mail address never displayed, HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>