Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elnode is unusable on Emacs 26+ #106

Open
jcaw opened this issue May 20, 2019 · 2 comments
Open

Elnode is unusable on Emacs 26+ #106

jcaw opened this issue May 20, 2019 · 2 comments

Comments

@jcaw
Copy link

jcaw commented May 20, 2019

Because of a quirk in how Emacs 25.1+ creates network processes, the flags server and nowait cannot both be set in make-network-process. Elnode sets both.

On Emacs 26.1, this is formalised and supplying both flags results in an error. This makes Elnode unusable on Emacs 26.1+. It crashes when it tries to start the server.

There's an open pull request, #105, which appears to fix this issue.

I've opened two pull requests to fix this, one for Master (#107) and one for MELPA (#108).

@jcaw
Copy link
Author

jcaw commented May 21, 2019

In the meantime, overriding the method elnode/make-service with a patched version allows Elnode to be used. Add this to your init file to get Elnode working again:

;; Elnode doesn't work on Emacs 25.1+, because it sets both the `:server` and
;; `:nowait` flags. They can't both be set on Emacs 25.1+, so `:nowait` has to be 
;; dropped.
;;
;; Make sure the patch is applied *after* elnode is loaded.
(with-eval-after-load 'elnode
  (defun elnode/make-service (host port service-mappings request-handler defer-mode)
    "Make an actual TCP server."
    (let ((an-buf (get-buffer-create "*elnode-webserver*")))
      (make-network-process
       :name "*elnode-webserver-proc*"
       :buffer an-buf
       :server t
       ;; This flag is the only change in the patched in this version of the method.
       :nowait nil
       :host (cond
              ((equal host "localhost") 'local)
              ((equal host "*") nil)
              (t host))
       :service port
       :coding '(raw-text-unix . raw-text-unix)
       :family 'ipv4
       :filter 'elnode--filter
       :sentinel 'elnode--sentinel
       :log 'elnode--log-fn
       :plist (list
               :elnode-service-map service-mappings
               :elnode-http-handler request-handler
               :elnode-defer-mode defer-mode)))))

@jcaw jcaw changed the title Elnode is unusable on Emacs 25.1+ Elnode is unusable on Emacs 26.1+ Jun 1, 2019
@jcaw jcaw changed the title Elnode is unusable on Emacs 26.1+ Elnode is unusable on Emacs 26+ Jun 1, 2019
@jcaw
Copy link
Author

jcaw commented Jun 8, 2019

The MELPA Recipe has been updated in leui of inactivity: melpa/melpa#6184

Active fork here: https://github.com/jcaw/elnode

@nicferrier - I've given you push access to the forked Repo. Let me know if you'd like to move it back here when you have more time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant