Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Org-protocol setup with emacs inside WSL
@="URL:Org Protocol"
"URL Protocol"=""
@="\"C:\\BIN\\org-protocol-to-wsl-helper.bat\" \"%1\""
@echo off
@REM C:\BIN\org-protocol-to-wsl-helper.bat
@REM Genie example
@REM wsl.exe genie -c "/usr/bin/bash --login emacsclient" %1
@REM Default WSL distribution example
wsl.exe emacsclient %1

This comment has been minimized.

Copy link
Owner Author

@AloisJanicek AloisJanicek commented Nov 29, 2020

Assuming you have working emacs setup on WSL.
If not, this blogpost called The Ultimate Emacs Hacking Tutorial in Windows 10 WSL 2 ( 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)


This comment has been minimized.

Copy link

@Spauldo 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