Fix eshell banner when directory is not a git project
This commit is contained in:
parent
e5891170a0
commit
105a97250c
1 changed files with 12 additions and 12 deletions
|
@ -1502,8 +1502,7 @@ Whenever I open a shell, I instinctively type =ls= … so why not do that automa
|
||||||
(let ((fg (face-attribute 'default :background))
|
(let ((fg (face-attribute 'default :background))
|
||||||
(bg (face-attribute 'default :foreground))
|
(bg (face-attribute 'default :foreground))
|
||||||
(bg "#c09644")
|
(bg "#c09644")
|
||||||
(dd (thread-last default-directory
|
(dd (replace-regexp-in-string (getenv "HOME") "~" default-directory))
|
||||||
(replace-regexp-in-string (getenv "HOME") "~")))
|
|
||||||
(gs (or (ha-eshell-banner-git-branch) "")))
|
(gs (or (ha-eshell-banner-git-branch) "")))
|
||||||
(condition-case err
|
(condition-case err
|
||||||
(concat
|
(concat
|
||||||
|
@ -1519,16 +1518,17 @@ Whenever I open a shell, I instinctively type =ls= … so why not do that automa
|
||||||
|
|
||||||
(defun ha-eshell-banner-git-branch ()
|
(defun ha-eshell-banner-git-branch ()
|
||||||
"Return simplified Git branch for current directory."
|
"Return simplified Git branch for current directory."
|
||||||
(thread-last "git status --short --branch --ahead-behind 2>/dev/null"
|
(ignore-errors
|
||||||
(shell-command-to-list)
|
(thread-last "git status --short --branch --ahead-behind 2>/dev/null"
|
||||||
(first)
|
(shell-command-to-list)
|
||||||
(replace-regexp-in-string
|
(first)
|
||||||
(rx "## "
|
(replace-regexp-in-string
|
||||||
(group (zero-or-more not-newline))
|
(rx "## "
|
||||||
(zero-or-more anychar))
|
(group (zero-or-more not-newline))
|
||||||
"\\1")
|
(zero-or-more anychar))
|
||||||
(replace-regexp-in-string
|
"\\1")
|
||||||
(rx "...") " → ")))
|
(replace-regexp-in-string
|
||||||
|
(rx "...") " → "))))
|
||||||
#+end_src
|
#+end_src
|
||||||
* Shell Windows
|
* Shell Windows
|
||||||
Now that I often need to pop into remote systems to run a shell or commands, I create helper functions to create those buffer windows. Each buffer begins with =eshell=: allowing me to have more than one eshells, typically, one per project.
|
Now that I often need to pop into remote systems to run a shell or commands, I create helper functions to create those buffer windows. Each buffer begins with =eshell=: allowing me to have more than one eshells, typically, one per project.
|
||||||
|
|
Loading…
Reference in a new issue