Skip to content

Instantly share code, notes, and snippets.

@cbilson
Created April 21, 2015 19:06
Show Gist options
  • Save cbilson/10be41b98d4550957b57 to your computer and use it in GitHub Desktop.
Save cbilson/10be41b98d4550957b57 to your computer and use it in GitHub Desktop.
function Start-EmacsClient {
[CmdletBinding()]
param(
[switch] $NewWindow,
[switch] $CreateFrame,
[switch] $Wait,
$AlternateEditor = 'notepad',
[Parameter(Position=0, ValueFromRemainingArguments)]
[string[]] $RestArgs)
$argList = @()
if ($NewWindow) { $argList += '-nw' }
if ($CreateFrame) { $argList += '--create-frame' }
if (!$Wait) { $argList += '--no-wait' }
$argList += "--alternate-editor=$AlternateEditor"
if ($RestArgs) { $argList += $RestArgs }
Write-Verbose "Starting: C:\ProgramData\chocolatey\bin\emacsclientw.exe $argList"
Start-Process C:\ProgramData\chocolatey\bin\emacsclientw.exe $argList -NoNewWindow
}
New-Alias ec Start-EmacsClient
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment