nameframe icon indicating copy to clipboard operation
nameframe copied to clipboard

Manage Emacs frames by name

  • Nameframe

Nameframe provides utility functions to manage frames by their names.

It's primary goal is to be used with project.el (or Projectile) and/or [[https://github.com/nex3/perspective-el][perspective.el]]. When opening a project, it will either switch to an existing frame of the project, or create a new frame for the project.

** Installation

*** MELPA

Nameframe is now available on [[http://melpa.org/#/?q=nameframe][MELPA]]. The project.el and perspective.el integrations are distributed separately (and thus will need to be installed separately).

  • ~M-x package-install~ =RET= ~nameframe~ =RET=
  • ~M-x package-install~ =RET= ~nameframe-project~ =RET=
  • ~M-x package-install~ =RET= ~nameframe-perspective~ =RET=

*** Manual install

Copy ~nameframe.el~ into your Emacs load path.

Optionally, copy ~nameframe-project.el~ and ~nameframe-perspective.el~ into your load path as well. See Usage section below for details.

** Usage

*** Vanilla

| symbol | description | |--------------------------+------------------------------------------------------------------| | ~nameframe-switch-frame~ | (interactive) function to switch between existing frames by name | | ~nameframe-create-frame~ | (interactive) function to create a new frame |

*** Project.el

Nameframe provides project.el integration to open projects in their own frames. To enable project.el integration, add the following line to your init file:

#+BEGIN_SRC emacs-lisp (nameframe-project-mode t) #+END_SRC

With project.el integration enabled, an =advice= is added to create/switch to a project's frame when switching projects with =project-switch-project=.

*** Projectile

Nameframe provides Projectile integration to open projects in their own frames. To enable Projectile integration, add the following line to your init file:

#+BEGIN_SRC emacs-lisp (nameframe-projectile-mode t) #+END_SRC

With Projectile integration enabled, a hook is added to create/switch to a project's frame when switching projects.

*** Perspective

Nameframe also provides ~perspective.el~ integration, so each frame has its own perspective (and thus have its own list of buffers).

To enable perspective integration, add the following line to your init file:

#+BEGIN_SRC emacs-lisp (nameframe-perspective-mode t) #+END_SRC

With perspective integration enabled, calling ~nameframe-create-frame~ will now create a perspective.

*** Recommended setup

Although the ~project.el~ and ~perspective.el~ integrations are optional, nameframe really shines when used in conjunction with both packages. Here is a snippet on how to use nameframe to its full potential:

#+BEGIN_SRC emacs-lisp ;; Assuming project.el and perspective.el are already installed

(persp-mode)

(nameframe-project-mode t) (nameframe-perspective-mode t)

;; If your OS can't switch between applications windows by default cough OS X cough ;; you can have a shortcut to switch between existing frames by name (global-set-key (kbd "M-P") 'nameframe-switch-frame)

#+END_SRC

With this setup, switching to a project will open it in its own dedicated frame with isolated buffers.

** Caveats

  • Only (thoroughly) tested on GUI Emacs 24.5 on OS X
    • but seems to work fine on terminal Emacs
  • Does not work with Helm (I personally don't use Helm. Pull-requests welcome.)

** Demo with Projectile

[[https://raw.githubusercontent.com/john2x/nameframe/master/nameframe-demo.gif]]

** License

See ~LICENSE.txt~.