Skip to content

Instantly share code, notes, and snippets.

@woochica
Created April 11, 2023 14:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save woochica/d02b2f1b79d97cc35c6616fa897d48a7 to your computer and use it in GitHub Desktop.
Save woochica/d02b2f1b79d97cc35c6616fa897d48a7 to your computer and use it in GitHub Desktop.
Open file in new Emacs window (supports FILE:LINE:COL schema)
#!/usr/bin/env bash
if [ -z "$1" ] ; then
echo "Open file in Emacs (create new frame)."
echo "Usage: $0 filename"
exit 1
fi
FILE=$(echo $1 | cut -d : -f 1)
POS=$(echo $1 | cut -d : -f 2-)
if [ $FILE = $POS ] ; then
emacsclient -c $FILE
else
emacsclient +$POS -c $FILE
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment