Properly Setting up Emacsclient on Windows

Create a shortcut key for runemacs.exe

Make this the target:

C:\Users\woofi\scoop\apps\emacs\29.1\bin\runemacs.exe --daemon

Copy shortcut to:

C:\Users\[USER]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Right click on file types you wish to open by default in emacsclient

Choose openwith and then navigate to "C:\Users\woofi\scoop\apps\emacs\29.1\bin\emacsclientw.exe"

Stubborn ones: bat:

Edit registry

Navigate to HKEY_CLASSES_ROOT\.bat

HKEY_CLASSES_ROOT\batfile

Expand the key and navigate to shell\open\command

Change the value:

C:\Users\woofi\scoop\apps\emacs\29.1\bin\emacsclientw.exe --no-wait --alternate-editor"" "%1"=

Set better Emacsclient defaults

  (setq default-frame-alist
  '((vertical-scroll-bars)
    (top . 1)
    (left . 440)
    (width . 95)
    (height . 52)
    (font . "Dejavu Sans Mono-13")))

  (defun my-set-fringe-size (&optional frame)
    "Set fringe size for all windows in FRAME or the selected frame."
    (unless frame
      (setq frame (selected-frame)))
    (dolist (window (window-list frame))
      (with-selected-window window
  (let* ((fringes (window-fringes))
         (left-fringe (* 2 (or (nth 0 fringes) 0)))
         (right-fringe (* 2 (or (nth 1 fringes) 0))))
    (set-window-fringes window left-fringe right-fringe)))))

  ;; Apply to all existing windows in all existing frames
  (dolist (frame (frame-list))
    (my-set-fringe-size frame))

  ;; Apply to all new frames, including emacsclient frames
  (add-hook 'after-make-frame-functions 'my-set-fringe-size)

  (set-face-attribute 'fringe nil :background "black")

Return to Home