Bug 125322 - app-emacs/httpd needs function: open-network-stream-server
Bug#: 125322 Product:  Gentoo Linux Version: unspecified Platform: All
OS/Version: Linux Status: RESOLVED Severity: normal Priority: P2
Resolution: FIXED Assigned To: emacs@gentoo.org Reported By: paul@wolfbone.ath.cx
Component: Ebuilds
URL: 
Summary: app-emacs/httpd needs function: open-network-stream-server
Keywords:  
Status Whiteboard: 
Opened: 2006-03-06 19:09 0000
Description:   Opened: 2006-03-06 19:09 0000
httpd.el needs the function open-network-stream-server to work, but this
function is not included in emacs anymore. It certainly isn't in emacs-cvs and
I doubt it exists in stable emacs either (it's not in my debian 21.4.1 version
anyway).

The following elisp in my .emacs fixed it for me:

(unless (fboundp 'open-network-stream-server)
  (defun open-network-stream-server (proc buff port sentl filtr)
    "Compatibility function for httpd.el on newer emacsen"
    (make-network-process :server t
                          :name proc
                          :buffer buff
                          :host "localhost"
                          :service port
                          :sentinel sentl
                          :filter filtr)))

------- Comment #1 From Matthew Kennedy (RETIRED) 2006-04-26 11:00:50 0000 -------
Arch testers for amd64 ppc sparc and x86, please confirm the
app-emacs/httpd-1.0-r1 ebuild builds so that this bug can be resolved.  Many
thanks for the arch testing work :)

------- Comment #2 From David Morgan 2006-04-26 16:53:28 0000 -------
It builds, and (load "/usr/share/emacs/site-lisp/httpd/httpd.el) runs fine, but
when I do (httpd-start) I get

Symbol's function definition is void: make-network-process

Am I doing something stupid, or is something broken? (I'm not overly familar
with elisp)

------- Comment #3 From P.L.Hayes 2006-04-26 19:09:30 0000 -------
It turns out that neither open-network-stream-server nor make-network-process
appear in my Debian emacs 21.4.1. If this is also true of the Gentoo emacs
21.4, then I don't think anything can be done to make httpd.el work. 

Michael Olson has made a more careful and better modification to httpd.el than
I did in my .emacs file in his muse distribution: 
http://www.mwolson.org/projects/EmacsMuse.html so I'm using that now (but it
still wouldn't work on emacs 21.4, of course). It's in the contrib directory.

------- Comment #4 From Matthew Kennedy (RETIRED) 2006-04-26 23:22:50 0000 -------
I commited a new ebuild for httpd-1.1.ebuild. it uses the httpd.el from Muse. 
In the source, it says it works for emacs-21 and emacs-22 (cvs).  It works on
my emacs-22 (cvs), but as you discovered, not in emacs-21.

  (setq httpd-process
        (if (fboundp 'make-network-process)
            (make-network-process :name "httpd"
                                  :buffer (generate-new-buffer "httpd")
                                  :host 'local :service port
                                  :server t :noquery t
                                  :filter 'httpd-serve)
          (and (fboundp 'open-network-stream-server)
               (open-network-stream-server "httpd"
                                           (generate-new-buffer "httpd")
                                           port nil 'httpd-serve))))

make-network-process is the emacs-22 call, and open-network-stream-server is a
mystery.  Its not in emacs-22 or emacs-21.4.1.

------- Comment #5 From Matthew Kennedy (RETIRED) 2006-04-26 23:33:56 0000 -------
Sorry for the confusion arch testers, it was premature to get you involved.

I dont think httpd.el works with emacs-21.

------- Comment #6 From P.L.Hayes 2006-04-27 01:35:59 0000 -------
(In reply to comment #4)

> make-network-process is the emacs-22 call, and open-network-stream-server is a
> mystery.  Its not in emacs-22 or emacs-21.4.1.

Yes - it looks to me as though the author of httpd.el was using a snapshot of
emacs when writing it: 
http://lists.gnu.org/archive/html/emacs-diffs/2004-09/msg00626.html and
open-network-stream-server never made it into the actual 21.4 release or 22. So
no Gentoo emacs is ever going to have it and

  (setq httpd-process
        (make-network-process :name "httpd"
                              :buffer (generate-new-buffer "httpd")
                              :host 'local :service port
                              :server t :noquery t
                              :filter 'httpd-serve))

would suffice.

------- Comment #7 From Mark Loeser 2006-05-07 13:27:42 0000 -------
mkennedy: what is going on with this?

------- Comment #8 From Matthew Kennedy (RETIRED) 2006-05-07 13:59:14 0000 -------
x86 people need to remove the only stable ebuild for this (httpd-1.0.ebuild)
from portage.

------- Comment #9 From Mark Loeser 2006-05-07 14:43:35 0000 -------
Put 1.0 back to ~x86.  if you want the ebuild completely removed, go for it :)

------- Comment #10 From Matthew Kennedy (RETIRED) 2006-05-15 09:19:17 0000 -------
Thanks.