Open an Emacs shell in the current directory
Emacs Lisp
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
README.org
shell-here.el

README.org

Shell-here

Open a shell buffer in (or relative to) default-directory, e.g. whatever directory the current buffer is in. If you have projectile or find-file-in-project installed, you can also move around relative to the root of the current project.

I use Emacs shell buffers for everything, and shell-here is great for getting where you need to quickly. Projectile / FFIP integration makes it very easy to manage multiple shells and maintain your path / history / scrollback when switching between projects.

Installation

Use Marmalade and ELPA / package.el.

Recommended binding: C-c !

(require 'shell-here)
(define-key (current-global-map) "\C-c!" 'shell-here)

Usage

C-c !Open a shell in the current directory
C-1 C-c !Open a shell one level up from current
C-2 C-c !Open a shell two levels up from current (etc)
C-u C-c !Open a new shell in the current directory
C-- C-c !Open a shell in the current project root
C-- C-1 C-c !Open a shell one level up from root
C-- C-2 C-c !Open a shell two levels up from root (etc)
C-- C-u C-c !Open a new shell in the project root

Configuration

There are two things you can configure, both dealing with how shell-here determines the root of the project you’re in.

  1. shell-here-project-root-functions. This variable contains a list of functions to determine the root of the project. The first one that’s bound will be called with no arguments. The first truthy value returned will be the root.
  2. shell-here-project-root-files. If shell-here-project-root-functions is nil or doesn’t produce a truthy value, locate-dominating-file will be called for each entry in this variable, until one returns a truthy value.

License

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.