Giter Site home page Giter Site logo

shell-pop-el's Introduction

shell-pop-el melpa badge melpa stable badge

shell-pop.el helps you to use shell easily on Emacs. Only one key action to work.

Installation

You can install shell-pop.el from MELPA and Marmalade with package.el.

 M-x package-install shell-pop

Manual Install

Make sure to place shell-pop.el somewhere in the load-path and add the following lines to your init file(~/.emacs.d/init.el, ~/.emacs etc).

(add-to-list 'load-path "somewhere")
(require 'shell-pop)

Customization

Use M-x customize-variable RET shell-pop-shell-type RET to customize the shell to use. Four pre-set options are: shell, terminal, ansi-term, and eshell. You can also set your custom shell if you use other configuration.

For terminal and ansi-term options, you can set the underlying shell by customizing shell-pop-term-shell. By default, shell-file-name is used, but you can also use /bin/tcsh, /bin/zsh or others.

Use M-x customize-group RET shell-pop RET to set further options such as hotkey, window height and position. You can get a full frame layout by setting full to shell-pop-window-position.

After saving the customized values, your .emacs file will be like as follows.

(custom-set-variables
 ;; custom-set-variables was added by Custom.
 ;; If you edit it by hand, you could mess it up, so be careful.
 ;; Your init file should contain only one such instance.
 ;; If there is more than one, they won't work right.
 '(shell-pop-default-directory "/Users/kyagi/git")
 '(shell-pop-shell-type (quote ("ansi-term" "*ansi-term*" (lambda nil (ansi-term shell-pop-term-shell)))))
 '(shell-pop-term-shell "/bin/bash")
 '(shell-pop-universal-key "C-t")
 '(shell-pop-window-size 30)
 '(shell-pop-full-span t)
 '(shell-pop-window-position "bottom")
 '(shell-pop-autocd-to-working-dir t)
 '(shell-pop-restore-window-configuration t)
 '(shell-pop-cleanup-buffer-at-process-exit t))

shell-pop-window-position(Default: "bottom")

Position of popup window. You can choose "bottom", "top", "right", "left" and "full". Use entire frame when this value is "full".

shell-pop-window-size(Default: 30)

Percentage for shell-buffer window size.

shell-pop-full-span

This option allows you to generate the shell window with the same width as the current Emacs frame. It is beneficial when you are always using multiple windows on Emacs. In detail, see #21 (comment)

shell-pop-in-hook

This hook runs before shell buffer pop-up.

shell-pop-in-after-hook

This hook runs after shell buffer pop-up.

shell-pop-out-hook

This hook runs before shell buffer pop-out.

shell-pop-process-exit-hook

This hook runs when the shell's process exits.

Usage

Just hit the hot key you customized for shell-pop-universal-key. For example, C-t for the above case.

You can have multiple shell buffers if you run shell-pop with universal-arguments. For example, C-u 2 C-t. You can increase the number(2, 3, 4, ...) as much as you want for different shell buffers.

Screenshot

screenshot

EmacsWiki (No longer updated)

http://www.emacswiki.org/emacs/ShellPop

shell-pop-el's People

Contributors

bcc32 avatar bmag avatar fuco1 avatar kyagi avatar lululau avatar myrjola avatar swsnr avatar syohex avatar tom-tan avatar y2q-actionman avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

shell-pop-el's Issues

Eshell not working on windows

I use the same config on windows and linux:

(use-package shell-pop
  :config
  (setq shell-pop-shell-type '("eshell" "*eshell*" (lambda () (eshell))))
  (setq shell-pop-default-directory "~/")
  (setq shell-pop-autocd-to-working-dir t)
  (setq shell-pop-full-span t)
  :bind ("C-M-S-s" . shell-pop))

On linux this works and opens eshell, but on windows it opens the windows command line. Not sure whats going on, I can open eshell fine manually with M-x eshell on windows, too.

How To see History output

I use shell-pop to run a gcc compile command, but compile failed and there are a long output more than 30 lines, I want to see all the output after I run the gcc command. In the shell-pop window, I try M-v, C-p, up, C-x [, Page Up, but no command is available. then I try to read the shell-pop source code, but find nothing to help me solve the problem.

I try both '(shell-pop-term-shell "/bin/bash") and '(shell-pop-term-shell "/bin/fish"), the result is same.

So, Is there a way to see the shell-pop's history output? Thanks for any suggestions.

Strange ^L?

image

Every time I open shell-pop (trigger by default keybind ), there is a ^L character in the prompt.

What is the meaning of this line in shell-pop.el? Has something to do with this?

image

Environment:
Ubuntu 16.04,
Emacs 24.5.1

Switch the display logic to `display-buffer`

I think rolling our own is not the correct way to integrate with the rest of Emacs. There are packages out there to manage window layout (such as the amazing shackle) which won't work with this package because it bypasses the display-buffer logic.

I think I can make it such that it behaves the same as now or very closely but using display-buffer internally. This allows users to either use some other package to manage the layout or write their own rules in display-buffer-alist.

For example, I would like the popped buffer to take over the selected window, but I don't see an option for it currently. But I can write a simple rule for display-buffer-alist to do that. This way users can customize the look&feel without shell-pop-el needing to add all the different switches.

@kyagi @syohex as you two seem to be most active here, what do you think?

wish: make shell-pop usable with several named shell buffers

Since it is possible to have several differently named shell buffers it would be helpful if shell-pop would

a) maintain a stack for each shell buffer

b) ask for a buffer name when invoked with universal argument.

shell-pop could be used until now until say in buffer-2 the user executes shell-pop with the universal-argument, is asked for a shell buffer name and from this moment on shell-pop in buffer-1 would take the user to eshell (and vice versa)) while shell-pop in buffer-2 would take the user to the named eshell buffer. Later the user might execute shell-pop in buffer-2 with the universal argument, provode eshell as the buffer name and the behavior would be the same as today again.

Document the proper way to set the shell type

Despite the amount of good documentation for this package I still had basic trouble even getting it to work.

(use-package shell-pop :ensure t :custom (shell-pop-shell-type '("eshell" "eshell" (lambda () (eshell)))) (shell-pop-full-span t))

Was where I ended up.

The fundamental issue was that shell-pop-shell-type doesn't take "eshell" or 'eshell but instead that full chunk of code but that didn't seem clear to me from reading the documentation.

I would ask that you add the eshell line in its entirety (and the other shells) explicitly in the documentation.

I also think adding the use-package boilerplate would be a nice thing to add these days. A small note that using ":custom" is important since shell-pop uses customize.

Using prefix argument to create a new shell buffer

With C-u N M-x shell-pop I can create a new buffer called shell-N. Would be great if with `C-u M-x shell-pop' (without prefixing a number) I could create a new shell buffer.

So for example: if I have the shells shell-1 and shell-3, with C-u M-x shell-pop I could get shell-4 without the needing of type a number.

Popping out shell window changes other buffer

If I pop up a shell, switch the buffer in the non-shell window, and then pop out the shell, the buffer in the non-shell window is switched back to the original one. Is this the desired behavior, or is it a bug?

Reproduction recipe:

  • emacs -Q -l /path/to/shell-pop.el - start emacs and load shell-pop.el
  • C-x b foo RET - switch to buffer "foo"
  • M-x shell-pop - pop up a shell
  • C-x o - select original window
  • C-x b bar RET - switch to buffer "bar"
  • C-x o - select shell window. There are now two windows - one for "bar" buffer, one for shell buffer.
  • M-x shell-pop - pop out the shell

Observed behavior: there is a single window, and it shows buffer "foo".
Expected behavior: there is a single window, and it shows buffer "bar".

Layout breaks in Emacs 25.1

Steps to reproduce:

  • emacs -Q
  • require shell-pop
  • C-x 3 to split into left and right windows
  • M-x shell-pop twice

Expected behavior:

After the first M-x shell-pop, a window appears at the bottom of the frame containing a shell. After the second M-x shell-pop, that window goes away and the layout of the frame returns to what it was previously (two windows side by side).

Actual behavior:

After the first M-x shell-pop, a window appears at the bottom of the frame, but the shell is loaded into the window on the right. After the second M-x shell-pop, the right side window is removed and what remains is a large top window and a small bottom window.

After the first M-x shell-pop:

screenshot from 2016-11-08 10-33-25

After the second M-x shell-pop:

screenshot from 2016-11-08 10-33-30

Full Width when split 2 window with 1 Treemacs

I have 1 Treemacs is opening and 2 window split vertical when i use shell-pop the shell allway full width but only avoid the width of Treemacs

Screen Shot 2019-06-05 at 1 14 43 AM

this what i want (i use demo from vscode)

Screen Shot 2019-06-05 at 1 23 48 AM

this what i get i hope i can have some custom for this

Your work is very great i hope you build more something great in the future :)
Thanks

When user types `exit` or press `C-d`, shell close but leave a window behind

To reproduce:

  • Pop an eshell window.
  • Type exit.
  • Now we have a useless window.

The way that multi-term handles this issue is like this:

(defun ansi-term-handle-close ()
  "Close current term buffer when `exit' from term buffer."
  (when (ignore-errors (get-buffer-process (current-buffer)))
    (set-process-sentinel (get-buffer-process (current-buffer))
                          (lambda (proc change)
                            (when (string-match "\\(finished\\|exited\\)" change)
                              (kill-buffer (process-buffer proc))
                              (delete-window))))))
(add-hook 'term-mode-hook 'ansi-term-handle-close)

So, we create a process watching for our shell buffer. When it sees exited or finished, the shell buffer and window are deleted. I think we could use this method for all the shells managed by shell-pop.

Set the shell type in dot-emacs.

Setup:

GUI version GNU Emacs 25.0.50.1 (x86_64-w64-mingw32)
of 2015-07-25 on KAEL

Compiled from EmacsW64.

Shell-pop, using the latest version of shell-pop from MELPA

Windows 7 x64 bit.

Situation:

How could I set up the type of shell in my Dot-emacs?

When I run M-x eshell, the eshell pop ups and is working fine.

When I set it up in my dot-Emacs with the following:

(setq shell-pop-shell-type '("eshell" "*eshell*" (lambda () (eshell))))

And I call M-x shell-pop, I get the default shell instead Eshell.

When I do C-h v shell-pop-shell-type, then I get the following:

shell-pop-shell-type is a variable defined in ‘shell-pop.el’.
Its value is ("eshell" "*eshell*" (lambda nil (eshell)))
Original value was 
("shell" "*shell*"
(lambda nil
(shell)))

So somewhere the Eshell configuration didn't get applied. Any suggestion to debug this?

First invocation always in wrong position

GNU Emacs 26.3 (build 1, x86_64-apple-darwin18.7.0, NS appkit-1671.60 Version 10.14.6 (Build 18G103))
 of 2019-12-02

Every time I start a shell with shell pop, it starts the window in the wrong region. Once I close the window I'm able to use my keys to start it again and then it's in the right position. No idea how to debug here. Any help is appreciated.

Support login shell

(setq shell-pop-term-shell "/usr/local/bin/bash -l") doesn't seem to source my ~/.bash_profile. Is there some other way to get shell-pop to use a login shell?

add-hook for eshell-exit-hook causes eshell to not write history out.

There was a bug filed for spacemacs. I think that shell-pop-el is the source of the problem.
syl20bnr/spacemacs#8538

In shell-pop.el in the function shell-pop--set-exit-action it checks if the shell is eshell or not. If it is a eshell then it runs the add-hook function:

(add-hook 'eshell-exit-hook 'shell-pop--kill-and-delete-window nil t)

I think this causes eshell to exit before history gets written out. Changing the 'nil' to 't' appends the hook so the history gets saved.

(add-hook 'eshell-exit-hook 'shell-pop--kill-and-delete-window t t)

I am not a elisp programmer so I don't know if this is a 100% correct solution, but it works for me.

shell-pop-default-directory changes buffer default-directory

When I invoke shell-pop, it changes the default-directory of the current buffer to shell-pop-default-directory.

Is it possible to just have shell-pop-default-directory apply to the pop up shell, and not to the previously selected buffer?

This is with Emacs 26.2 on Linux 5.2.5, x86_64.

Following is my config:

(use-package shell-pop
  :bind (("C-s-t" . shell-pop)
         ("C-x t" . shell-pop))
  :ensure t
  :custom
  (shell-pop-shell-type
   '("eshell" "*eshell*" (lambda nil (interactive) (eshell))))
  :config
  (setq shell-pop-window-size 30)
  (setq shell-pop-full-span nil)
  (setq shell-pop-default-directory "~")
  (setq shell-pop-universal-key "C-s-t")
  (setq shell-pop-window-position "bottom")
  (setq shell-pop-in-after-hook 'end-of-buffer))

Add full frame layout

There is only the options to put the shell on bottom or top. Would be great if had a option to it close all other windows and show only the shell (on quit it restore the windows configuration).

Thanks.

Setting shell-pop-universal-key does not work without (require 'shell-pop)

Now shell-pop is autoloaded if it is installed via package.el.
So I think this package should work without require statement.
But in the following case, it does not work.

How to reproduce:

  • install shell-pop via list-packages
  • evaluate the following expression:
(custom-set-variables
 '(shell-pop-universal-key "\C-c;"))
  • type C-c ;

Expected:
We can see a shell buffer.

Occured:
We saw a message "C-c ; is undefined" in minibuffer and shell-pop was not invoked.

(require 'shell-pop) fails with the message "(void-function shell-pop--set-universal-key)"

(require 'shell-pop) fails in my system.

I use shell-pop.el with commit hash 27d9bbaee43c2a573605e744a8e6c011fd1343d6 and the output of M-x emacs-version in my emacs is:

GNU Emacs 24.3.1 (x86_64-unknown-linux-gnu, GTK+ Version 3.8.1)
 of 2013-04-30 on eric

How to reproduce:

  • start Emacs without loading configuration files:
$ emacs -q
  • evaluate (require 'shell-pop) in the scratch buffer (I put shell-pop.el in /home/tom-tan/repos/shell-pop-el).
(require 'shell-pop "/home/tom-tan/repos/shell-pop-el/shell-pop.el")

Expected:
shell-pop.el is loaded without error messages.

Occured:
Emacs fails to load shell-pop.el with the following message in "Backtrace" buffer:

Debugger entered--Lisp error: (void-function shell-pop--set-universal-key)
  shell-pop--set-universal-key(shell-pop-universal-key nil)
  custom-initialize-reset(shell-pop-universal-key nil)
  custom-declare-variable(shell-pop-universal-key nil "Key binding used to pop in and out of the shell.\n\nThe input format is the same as that of `kbd'." :type (choice string (const nil)) :set shell-pop--set-universal-key :group shell-pop)
  eval-buffer(#<buffer  *load*> nil "/home/tom-tan/repos/shell-pop-el/shell-pop.el" nil t)  ; Reading at buffer position 2680
  load-with-code-conversion("/home/tom-tan/repos/shell-pop-el/shell-pop.el" "/home/tom-tan/repos/shell-pop-el/shell-pop.el" nil t)
  require(shell-pop "/home/tom-tan/repos/shell-pop-el/shell-pop.el")
  eval((require (quote shell-pop) "/home/tom-tan/repos/shell-pop-el/shell-pop.el") nil)
  eval-last-sexp-1(t)
  eval-last-sexp(t)
  eval-print-last-sexp()
  call-interactively(eval-print-last-sexp nil nil)

popwin integration

Hi,
Thanks for this nice mode.

I'd be appreciate if you can provide integration with popwin mode which is another quite nice mode to show pop window.

Thanks.

shell-pop-universal-key not working

I have the following confisguration in my init.el.

(use-package shell-pop                  ; Pop up shell/terminal window.
  :defer 2)

And I have set the following via the customize interface.

 '(shell-pop-shell-type
   (quote
    ("ansi-term" "*ansi-term*"
     (lambda nil
       (ansi-term shell-pop-term-shell)))))
 '(shell-pop-universal-key "C-S-t")

However, despite setting what universal key to use via the Customize interface when C-h v shell-pop-universal-key it says the value is nil but that it's value was changed outside Customize. I use the helpful package which shows further down that the saved value is indeed C-S-t so I don't understand why the setting doesn't stick. If I M-x shell-pop then subsequent invocations of C-S-t will pop the terminal as expected.

This happens with 26.2. Oddly, on another machine where I'm using 27.1 and vterm instead of ansi-term it works though my keybinding is s-t. On the machine running 26.2, I cannot use vterm and cannot set the super key. Hence, why I'm using ansi-term and C-S-t. But otherwise the rest of my configuration on both machines is identical.

orinigal *eshell* buffer disappeared

Hi,

In the case that there is already *eshell* buffer before executing shell-pop,
a new *eshell-1* buffer seems to 'kill' the *eshell* buffer after executing it,
where my shell-pop-type is "eshell".

I guess the essence of this problem is that a newly created *eshell* buffer override the old one and is renamed as eshell-1.

Is this a inevitable problem?
I want to keep the original *eshell* buffer unchanged.

Regards,
Akira

Full Span and Neotree

When I have neotree and shell-pop I do the following:

  1. M-: (setq shell-pop-full-span t) to enable full span.
  2. M-x neotree-toggle to toggle Neotree to be visible.
  3. M-x shell-pop to try and open shell.

For step 3, the shell does not pop up and instead I get the error message Cannot split side window or parent of side window. This is counterintuitive because I can only have one or the other but not both.

shell-pop-shell change directory with dired

When shell-pop-shell is called in a dired buffer, the resultant pop-up shell doesn't cd correctly for paths containing the user's home directory:

# Example opening popup shell in dired buffer /home/bob/foo
$ cd \~/foo/
cd: no such file or directory: ~/foo

EDIT: shell-pop-shell is shell-pop with the shell type set to "shell".

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.