28 Feb

Open in new tab in running Carbon Emacs

Wednesday February 28th 2007, 12:13 pm
Tags: , , ,

Carbon Emacs acts like emacsclient or gnuserv by itself, i.e. it only runs one instance and opens files in this instance from Finder automatically.

A drawback of this behaviour is that the usual server-window variable of gnuserv has no effect. When using elscreen to get tabs into Emacs the desired behaviour might be to open a new tab in the running Emacs when you open a file from Finder. This can easily be done, using my intelligent-kill command (see my elscreen posting) such that files from Finder are opened in a new tab, and you can close this tab with the usual C-x C-c:

(defun create-new-tab-and-switch-to ()
  (message "New tab")
  (elscreen-create))

(defadvice mac-ae-open-documents (before mac-ae-open-documents-advice activate)
  "Create new tab before" (create-new-tab-and-switch-to))
(ad-activate ‘mac-ae-open-documents)

0 Comments