Skip to content

Instantly share code, notes, and snippets.

@AloisJanicek
Created November 29, 2020 22:44
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save AloisJanicek/942b93feb7ca3683ce666c913ce56672 to your computer and use it in GitHub Desktop.
Save AloisJanicek/942b93feb7ca3683ce666c913ce56672 to your computer and use it in GitHub Desktop.
Org-protocol setup with emacs inside WSL
REGEDIT4
[HKEY_CLASSES_ROOT\org-protocol]
@="URL:Org Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\org-protocol\shell]
[HKEY_CLASSES_ROOT\org-protocol\shell\open]
[HKEY_CLASSES_ROOT\org-protocol\shell\open\command]
@="\"C:\\BIN\\org-protocol-to-wsl-helper.bat\" \"%1\""
@echo off
@REM C:\BIN\org-protocol-to-wsl-helper.bat
@REM Genie example https://github.com/arkane-systems/genie
@REM wsl.exe genie -c "/usr/bin/bash --login emacsclient" %1
@REM Default WSL distribution example
wsl.exe emacsclient %1
@AloisJanicek
Copy link
Author

Assuming you have working emacs setup on WSL.
If not, this blogpost called The Ultimate Emacs Hacking Tutorial in Windows 10 WSL 2 (archive.is) by DAMON CHAN is an excellent resource

  1. Save org-protocol-to-wsl-helper.bat as C:\BIN\org-protocol-to-wsl-helper.bat
  2. Save org-protocol-to-wsl-emacs.reg and run it (double-click) if you trust me. As you should not trust me, alternatively register org-protocol protocol in Windows manually using tutorial from README of sprig/org-capture-extension

(note: @REM are comments in .bat files, weird, I know)

@Spauldo
Copy link

Spauldo commented Nov 30, 2020

REM is short for REMARK. I believe it comes from the original Dartmouth BASIC. All of the microcomputer BASICs I used back in the 80s used it for comments, and since knowledge of BASIC was fairly widespread back then it made sense for Microsoft to use it for commenting batch files.

The @ just turns off echo for that line. Since your first line is @echo off, you probably don't need it for the REM statements.

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