Skip to content

Instantly share code, notes, and snippets.

@killerswan
Created July 21, 2016 09:52
Show Gist options
  • Select an option

  • Save killerswan/d320b540f45546a6ef79e977387ce295 to your computer and use it in GitHub Desktop.

Select an option

Save killerswan/d320b540f45546a6ef79e977387ce295 to your computer and use it in GitHub Desktop.

Download emacs-24.5-bin-i686-mingw32.zip from GNU and extract it.

Run it using a minimal path to avoid crashes when closing:

set path=C:\Users\kevin.cantu\Desktop\emacs\emacs-24.5-bin-i686-mingw32\bin
runemacs

Download gnutls-3.4.9-w32.zip from GnuTLS and exctract it.

Test it against a website:

set path=C:\Users\kevin.cantu\Desktop\emacs\gnutls-3.4.9-w32\bin
gnutls-cli -p 443 elpa.gnu.org

To trust ELPA, we can install the Let’s Encrypt Authority X3 certificate (fingerprint: e6:a3:b4:5b:06:2d:50:9b:33:82:28:2d:19:6e:fe:97:d5:95:6c:cb) on the system. For example, open Internet Options -> Content -> Certificates -> Intermediate Certificate Authorities, and install it there.

Then we can see GnuTLS trust that like so:

C:\code\infr>set path=C:\Users\kevin.cantu\Desktop\emacs\gnutls-3.4.9-w32\bin

C:\code\infr>gnutls-cli -p 443 elpa.gnu.org
...
Processed 338 CA certificate(s).
Resolving 'elpa.gnu.org'...
Connecting to '208.118.235.89:443'...
- Certificate type: X.509
- Got a certificate list of 3 certificates.
- Certificate[0] info:
 - subject `CN=elpa.gnu.org', issuer `C=US,O=Let's Encrypt,CN=Let's Encrypt Authority X3', RSA key 2048 bits, signed using RSA-SHA256, activated `2016-04-04 14:46:00 UTC', expires `2016-07-03 14:46:00 UTC', SHA-1 fingerprint `166ad56ce1ecdab73c26e0a6950cc4c67a1f2019'
        Public Key ID:
                f299e84d06e63febdd7b7229670f805ffdc97395
        Public key's random art:
                +--[ RSA 2048]----+
                |                 |
                |                 |
                |                 |
                |           .   ..|
                |      + S . . .Eo|
                |     o = o . o. +|
                |      o *   . .=o|
                |     . =.. .o *.o|
                |      ..=o. oO ..|
                +-----------------+

- Certificate[1] info:
 - subject `CN=elpa.gnu.org', issuer `C=US,O=Let's Encrypt,CN=Let's Encrypt Authority X3', RSA key 2048 bits, signed using RSA-SHA256, activated `2016-04-04 14:46:00 UTC', expires `2016-07-03 14:46:00 UTC', SHA-1 fingerprint `166ad56ce1ecdab73c26e0a6950cc4c67a1f2019'
- Certificate[2] info:
 - subject `C=US,O=Let's Encrypt,CN=Let's Encrypt Authority X3', issuer `O=Digital Signature Trust Co.,CN=DST Root CA X3', RSA key 2048 bits, signed using RSA-SHA256, activated `2016-03-17 16:40:46 UTC', expires `2021-03-17 16:40:46 UTC', SHA-1 fingerprint `e6a3b45b062d509b3382282d196efe97d5956ccb'
- Status: The certificate is trusted.
- Description: (TLS1.2)-(ECDHE-RSA-SECP256R1)-(AES-128-GCM)
- Session ID: 9E:4C:E7:4E:66:DB:5C:22:95:F4:FC:4A:6D:24:0C:91:5C:25:CB:36:69:A4:3B:F3:49:B6:A6:B1:8A:1B:B1:2D
- Ephemeral EC Diffie-Hellman parameters
 - Using curve: SECP256R1
 - Curve size: 256 bits
- Version: TLS1.2
- Key Exchange: ECDHE-RSA
- Server Signature: RSA-SHA256
- Cipher: AES-128-GCM
- MAC: AEAD
- Compression: NULL
- Options: safe renegotiation,
- Handshake was completed

- Simple Client Mode:

^C

I think maybe that should make the --insecure flag unnecessary, but YMMV...

Now I'm trying to get GnuTLS working from inside Emacs. By default, it's missing:

set path=C:\Users\kevin.cantu\Desktop\emacs\emacs-24.5-bin-i686-mingw32\bin
set path=%path%;C:\Users\kevin.cantu\Desktop\emacs\gnutls-3.4.9-w32\bin
runemacs

Using the elisp eval, M-: (ESC-SHIFT-;):

(gnutls-available-p)
nil

And copying the folders over isn't enough, either...

However, downloading the out-of-date gnutls-3.3.11-w32-bin.zip from ezwinports and exctracting into the emacs folder works!

(gnutls-available-p)
t

Now, using the gnutls-3.3.13-w32.zip from GnuTLS, it works the same.

To get Git working, though, I've set up a script with more on the path:

C:\Program Files (x86)\emacs>cat runemacs.bat
@setlocal enableextensions enabledelayedexpansion
@echo off

echo Launching Kevin's Emacs

set path=%~dp0\emacs-24.5-bin-i686-mingw32\bin

set path=%path%;%LocalAppData%\Programs\Git\cmd
set path=%path%;%LocalAppData%\Programs\Git\bin
set path=%path%;%LocalAppData%\Programs\Git\mingw64\bin
set path=%path%;%LocalAppData%\Programs\Git\usr\bin

runemacs %*

To set up a good light-colored theme, just add this to the top of the dotspacemacs-themes list:

  • hemisu-light

For Python syntax highlighting, add this to the dotspacemacs-configuration-layers:

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