Skip to content

Instantly share code, notes, and snippets.

@bjorne
Last active December 23, 2020 07:47
Show Gist options
  • Save bjorne/764a565fed6dc5c8f6af038ba3a0c065 to your computer and use it in GitHub Desktop.
Save bjorne/764a565fed6dc5c8f6af038ba3a0c065 to your computer and use it in GitHub Desktop.
Command-click to open in emacs from iTerm
#!/bin/zsh
export PATH="/Users/bjorne/.evm/bin:$PATH"
export EMACS_HOME="$(dirname $(readlink $(which evm-emacs)))"
export EDITOR="$EMACS_HOME/bin/emacsclient"
pwd=$1
path=$2
lineno=$3
if [[ "$path" =~ ^[^/] ]]; then
path="${pwd}${path}"
fi
if [ -n "$lineno" ]; then
lineno="+$lineno"
fi
$EDITOR --quiet --alternate-editor=nano --no-wait $lineno $path > /tmp/clicklog 2>&1
@mikesdnielsen
Copy link

Thank you! This was a great help for me :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment