~idmyn/dotfiles

6c4f2c11861a38088354fb12d020d9adda1f60b6 — David Mynors a month ago 68e288c
Improve k8s prompt and use new emacs build
3 files changed, 5 insertions(+), 5 deletions(-)

M macOS/phoenix/phoenix.js
M shell/elvish/lib/k8s.elv
M shell/elvish/rc.elv
M macOS/phoenix/phoenix.js => macOS/phoenix/phoenix.js +2 -2
@@ 57,11 57,11 @@ const showOrOpenEmacs = new Key('e', ['alt', 'ctrl'], () => {
    if (App.get('Emacs').windows().length > 0) {
      App.get('Emacs').focus()
    } else {
      Task.run('/bin/sh', ['-c', '/usr/local/bin/emacsclient -nc'])
      Task.run('/bin/sh', ['-c', '/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -nc'])
      App.get('Emacs').focus()
    }
  } else {
    Task.run('/bin/sh', ['-c', '/usr/local/bin/emacs --daemon && /usr/local/bin/emacsclient -nc'])
    Task.run('/bin/sh', ['-c', '/Applications/Emacs.app/Contents/MacOS/Emacs --daemon && /Applications/Emacs.app/Contents/MacOS/bin/emacsclient  -nc'])
  }
})


M shell/elvish/lib/k8s.elv => shell/elvish/lib/k8s.elv +2 -2
@@ 6,11 6,11 @@ fn toggle-prompt {
    edit:rprompt = { put "" }
  } else {
    SHOW_PROMPT = $true
    HAS_CONTEXT = ?(kubectl config current-context >/dev/null)
    HAS_CONTEXT = ?(kubectl config current-context 1>&- 2>&-)
    if $HAS_CONTEXT {
      edit:rprompt = { put (kubectl config current-context):(kubectl config view --minify --output 'jsonpath={..namespace}') }
    } else {
      edit:rprompt = { put "no k8s context" }
      edit:rprompt = { put "no context" }
    }
  }
}

M shell/elvish/rc.elv => shell/elvish/rc.elv +1 -1
@@ 42,7 42,7 @@ fn emacs [@a]{ /Applications/Emacs.app/Contents/MacOS/Emacs $@a }
fn emacsclient [@a]{ /Applications/Emacs.app/Contents/MacOS/bin/emacsclient $@a }

fn e [@a]{
  if (> (ps -ax | rg -c emacs) 1) {
  if (> (ps -ax | rg -c -i emacs) 1) {
    if (> (emacsclient -e '(length (frame-list))') 1) {
      osascript -e 'tell application "emacs" to activate first window'
      emacsclient -n $@a