Skip to content

Commit

Permalink
Merge branch 'pr-58'
Browse files Browse the repository at this point in the history
  • Loading branch information
syohex committed Mar 15, 2020
2 parents 4a3a9d0 + d467135 commit 4b43940
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ After saving the customized values, your .emacs file will be like as follows.
'(shell-pop-universal-key "C-t")
'(shell-pop-window-size 30)
'(shell-pop-full-span t)
'(shell-pop-window-position "bottom"))
'(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")
Expand Down Expand Up @@ -74,6 +77,10 @@ This hook runs after shell buffer pop-up.

This hook runs before shell buffer pop-out.

#### `shell-pop-process-exit-hook`

This hook runs when the shell's process exits.


## Usage

Expand Down
13 changes: 13 additions & 0 deletions shell-pop.el
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,11 @@ effect when `shell-pop-window-position' value is \"full\"."
:type 'boolean
:group 'shell-pop)

(defcustom shell-pop-cleanup-buffer-at-process-exit t
"If non-nil, cleanup the shell's buffer after its process exits."
:type 'boolean
:group 'shell-pop)

(defun shell-pop--set-universal-key (symbol value)
(set-default symbol value)
(when value (global-set-key (read-kbd-macro value) 'shell-pop))
Expand Down Expand Up @@ -185,6 +190,11 @@ The input format is the same as that of `kbd'."
:type 'hook
:group 'shell-pop)

(defcustom shell-pop-process-exit-hook nil
"Hook run when the shell's process exits."
:type 'hook
:group 'shell-pop)

(defun shell-pop--shell-buffer-name (index)
(if (string-match-p "*\\'" shell-pop-internal-mode-buffer)
(replace-regexp-in-string
Expand Down Expand Up @@ -266,6 +276,9 @@ The input format is the same as that of `kbd'."
process
(lambda (_proc change)
(when (string-match-p "\\(?:finished\\|exited\\)" change)
(run-hooks 'shell-pop-process-exit-hook)
(when shell-pop-cleanup-buffer-at-process-exit
(kill-buffer))
(if (one-window-p)
(switch-to-buffer shell-pop-last-buffer)
(delete-window)))))))))
Expand Down

0 comments on commit 4b43940

Please sign in to comment.