emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* [ANN, OT] Emacs web-server, a new option for serving Org-mode files
@ 2014-01-11 18:09 Eric Schulte
  2014-01-11 19:12 ` Thomas S. Dye
                   ` (2 more replies)
  0 siblings, 3 replies; 17+ messages in thread
From: Eric Schulte @ 2014-01-11 18:09 UTC (permalink / raw)
  To: Org Mode Mailing List

A non-Org announcement which I believe may still be of interest given
the recurring discussion of ways to serve Org-mode files as web pages.

I've written an Emacs web-server [1], which may be used to interact with
Org-mode over HTTP.  It has no dependencies aside from needing Emacs 24
or later and it should be easy to install and use [2].

Three simple examples of how it may be used with Org-mode include;
1. web server which exports Org files on demand [3],
2. an export *service* [4] which allows users to upload Org-mode files
   and then download exported versions, or 
3. simply a way to serve your daily agenda as a web page [5].

I've ported the Org-ehtml editable Org-mode Wiki [6] from Elnode to this
new web-server, and I now find that it is both easier to install, and is
more stable, and faster [7].  I know that Elnode setup had been a
barrier to some users of org-ehtml, hopefully that barrier is now
removed.

I hope this is of interest and not too far off topic.

Best,

Footnotes: 
[1]  https://github.com/eschulte/emacs-web-server

[2]  http://eschulte.github.io/emacs-web-server/tutorials/#sec-1

[3]  http://eschulte.github.io/emacs-web-server/Org_002dmode-Export.html#Org_002dmode-Export

[4]  https://github.com/eschulte/emacs-web-server/blob/master/examples/013-org-export-service.el

[5]  https://github.com/eschulte/emacs-web-server/blob/master/examples/011-org-agenda.el

[6]  https://github.com/eschulte/org-ehtml

[7]  http://eschulte.github.io/emacs-web-server/benchmark/

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-11 18:09 [ANN, OT] Emacs web-server, a new option for serving Org-mode files Eric Schulte
@ 2014-01-11 19:12 ` Thomas S. Dye
  2014-01-11 21:53   ` Eric Schulte
  2014-01-11 22:21 ` John Hendy
  2014-01-16  0:51 ` Andrea Rossetti
  2 siblings, 1 reply; 17+ messages in thread
From: Thomas S. Dye @ 2014-01-11 19:12 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode Mailing List

Hi Eric,

This worked out of the box for me. Neat!

I ran into a problem with an optional step:

   poto:emacs-web-server dk$ emacs --version
   GNU Emacs 24.3.1
   Copyright (C) 2013 Free Software Foundation, Inc.
   GNU Emacs comes with ABSOLUTELY NO WARRANTY.
   You may redistribute copies of Emacs
   under the terms of the GNU General Public License.
   For more information about these matters, see the file named COPYING.
   poto:emacs-web-server dk$ make
   emacs --batch --execute '(add-to-list (quote load-path) "/Users/dk/org-local/emacs-web-server")' -f batch-byte-compile web-server-status-codes.el web-server-test.el web-server.el
   Wrote /Users/dk/org-local/emacs-web-server/web-server-status-codes.elc

   In toplevel form:
   web-server-test.el:9:1:Error: Cannot open load file: eieio

   In toplevel form:
   web-server.el:33:1:Error: Cannot open load file: eieio
   make: *** [src] Error 1

All the best,
Tom

Eric Schulte <schulte.eric@gmail.com> writes:

> A non-Org announcement which I believe may still be of interest given
> the recurring discussion of ways to serve Org-mode files as web pages.
>
> I've written an Emacs web-server [1], which may be used to interact with
> Org-mode over HTTP.  It has no dependencies aside from needing Emacs 24
> or later and it should be easy to install and use [2].
>
> Three simple examples of how it may be used with Org-mode include;
> 1. web server which exports Org files on demand [3],
> 2. an export *service* [4] which allows users to upload Org-mode files
>    and then download exported versions, or 
> 3. simply a way to serve your daily agenda as a web page [5].
>
> I've ported the Org-ehtml editable Org-mode Wiki [6] from Elnode to this
> new web-server, and I now find that it is both easier to install, and is
> more stable, and faster [7].  I know that Elnode setup had been a
> barrier to some users of org-ehtml, hopefully that barrier is now
> removed.
>
> I hope this is of interest and not too far off topic.
>
> Best,
>
> Footnotes: 
> [1]  https://github.com/eschulte/emacs-web-server
>
> [2]  http://eschulte.github.io/emacs-web-server/tutorials/#sec-1
>
> [3]
> http://eschulte.github.io/emacs-web-server/Org_002dmode-Export.html#Org_002dmode-Export
>
> [4]
> https://github.com/eschulte/emacs-web-server/blob/master/examples/013-org-export-service.el
>
> [5]
> https://github.com/eschulte/emacs-web-server/blob/master/examples/011-org-agenda.el
>
> [6]  https://github.com/eschulte/org-ehtml
>
> [7]  http://eschulte.github.io/emacs-web-server/benchmark/

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-11 19:12 ` Thomas S. Dye
@ 2014-01-11 21:53   ` Eric Schulte
  2014-01-12  1:12     ` Thomas S. Dye
  0 siblings, 1 reply; 17+ messages in thread
From: Eric Schulte @ 2014-01-11 21:53 UTC (permalink / raw)
  To: Thomas S. Dye; +Cc: Org Mode Mailing List

tsd@tsdye.com (Thomas S. Dye) writes:

> Hi Eric,
>
> This worked out of the box for me. Neat!
>

Great.

>
> I ran into a problem with an optional step:
>
>    poto:emacs-web-server dk$ emacs --version
>    GNU Emacs 24.3.1
>    Copyright (C) 2013 Free Software Foundation, Inc.
>    GNU Emacs comes with ABSOLUTELY NO WARRANTY.
>    You may redistribute copies of Emacs
>    under the terms of the GNU General Public License.
>    For more information about these matters, see the file named COPYING.
>    poto:emacs-web-server dk$ make
>    emacs --batch --execute '(add-to-list (quote load-path)
> "/Users/dk/org-local/emacs-web-server")' -f batch-byte-compile
> web-server-status-codes.el web-server-test.el web-server.el
>    Wrote /Users/dk/org-local/emacs-web-server/web-server-status-codes.elc
>
>    In toplevel form:
>    web-server-test.el:9:1:Error: Cannot open load file: eieio
>
>    In toplevel form:
>    web-server.el:33:1:Error: Cannot open load file: eieio
>    make: *** [src] Error 1
>

I'm not sure what to make of that, as eieio.el is distributed as part of
Emacs, so it should be in lisp/emacs-lisp/ under your installed Emacs
directory, which should be in the load-path.  Regardless, since
everything is running successfully, Emacs can obviously find eieio at
runtime, so I wouldn't worry about batch compilation not working.

Best,

>
> All the best,
> Tom
>
> Eric Schulte <schulte.eric@gmail.com> writes:
>
>> A non-Org announcement which I believe may still be of interest given
>> the recurring discussion of ways to serve Org-mode files as web pages.
>>
>> I've written an Emacs web-server [1], which may be used to interact with
>> Org-mode over HTTP.  It has no dependencies aside from needing Emacs 24
>> or later and it should be easy to install and use [2].
>>
>> Three simple examples of how it may be used with Org-mode include;
>> 1. web server which exports Org files on demand [3],
>> 2. an export *service* [4] which allows users to upload Org-mode files
>>    and then download exported versions, or 
>> 3. simply a way to serve your daily agenda as a web page [5].
>>
>> I've ported the Org-ehtml editable Org-mode Wiki [6] from Elnode to this
>> new web-server, and I now find that it is both easier to install, and is
>> more stable, and faster [7].  I know that Elnode setup had been a
>> barrier to some users of org-ehtml, hopefully that barrier is now
>> removed.
>>
>> I hope this is of interest and not too far off topic.
>>
>> Best,
>>
>> Footnotes: 
>> [1]  https://github.com/eschulte/emacs-web-server
>>
>> [2]  http://eschulte.github.io/emacs-web-server/tutorials/#sec-1
>>
>> [3]
>> http://eschulte.github.io/emacs-web-server/Org_002dmode-Export.html#Org_002dmode-Export
>>
>> [4]
>> https://github.com/eschulte/emacs-web-server/blob/master/examples/013-org-export-service.el
>>
>> [5]
>> https://github.com/eschulte/emacs-web-server/blob/master/examples/011-org-agenda.el
>>
>> [6]  https://github.com/eschulte/org-ehtml
>>
>> [7]  http://eschulte.github.io/emacs-web-server/benchmark/

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-11 18:09 [ANN, OT] Emacs web-server, a new option for serving Org-mode files Eric Schulte
  2014-01-11 19:12 ` Thomas S. Dye
@ 2014-01-11 22:21 ` John Hendy
  2014-01-11 22:27   ` David Belohrad
  2014-01-11 22:29   ` Eric Schulte
  2014-01-16  0:51 ` Andrea Rossetti
  2 siblings, 2 replies; 17+ messages in thread
From: John Hendy @ 2014-01-11 22:21 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode Mailing List

On Sat, Jan 11, 2014 at 12:09 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
> A non-Org announcement which I believe may still be of interest given
> the recurring discussion of ways to serve Org-mode files as web pages.
>
> I've written an Emacs web-server [1], which may be used to interact with
> Org-mode over HTTP.  It has no dependencies aside from needing Emacs 24
> or later and it should be easy to install and use [2].
>
> Three simple examples of how it may be used with Org-mode include;
> 1. web server which exports Org files on demand [3],
> 2. an export *service* [4] which allows users to upload Org-mode files
>    and then download exported versions, or
> 3. simply a way to serve your daily agenda as a web page [5].
>

This sounds really, really cool!

> I've ported the Org-ehtml editable Org-mode Wiki [6] from Elnode to this
> new web-server, and I now find that it is both easier to install, and is
> more stable, and faster [7].  I know that Elnode setup had been a
> barrier to some users of org-ehtml, hopefully that barrier is now
> removed.
>
> I hope this is of interest and not too far off topic.

The "Hello world" example worked splendidly for me out of the box. I'm
having a bit of difficulty with serving up a file via this example:
http://eschulte.github.io/emacs-web-server/File-Server.html#File-Server

Perhaps I don't understand how the function is supposed to work... It
says that the docroot is the current working directory in the example,
so I cd'd to a directory with an .html file in it, started `emacs -Q`
from the command line, ran `M-x load-file RET ~/.emacs`, and then
evaluated the code from the example in the *scratch* buffer. I'm
getting the 404 error. Should I be modifying that code somehow?


Thanks and great work -- this is really neat!
John


> Best,
>
> Footnotes:
> [1]  https://github.com/eschulte/emacs-web-server
>
> [2]  http://eschulte.github.io/emacs-web-server/tutorials/#sec-1
>
> [3]  http://eschulte.github.io/emacs-web-server/Org_002dmode-Export.html#Org_002dmode-Export
>
> [4]  https://github.com/eschulte/emacs-web-server/blob/master/examples/013-org-export-service.el
>
> [5]  https://github.com/eschulte/emacs-web-server/blob/master/examples/011-org-agenda.el
>
> [6]  https://github.com/eschulte/org-ehtml
>
> [7]  http://eschulte.github.io/emacs-web-server/benchmark/
>
> --
> Eric Schulte
> https://cs.unm.edu/~eschulte
> PGP: 0x614CA05D
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-11 22:21 ` John Hendy
@ 2014-01-11 22:27   ` David Belohrad
  2014-01-11 22:33     ` Eric Schulte
  2014-01-11 22:29   ` Eric Schulte
  1 sibling, 1 reply; 17+ messages in thread
From: David Belohrad @ 2014-01-11 22:27 UTC (permalink / raw)
  To: John Hendy, Eric Schulte; +Cc: Org Mode Mailing List

Hmm, I got

Caught Error: (void-function symbol-macrolet)

when browsing the web page. Do I miss something?
.d.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-11 22:21 ` John Hendy
  2014-01-11 22:27   ` David Belohrad
@ 2014-01-11 22:29   ` Eric Schulte
  2014-01-11 23:22     ` John Hendy
  1 sibling, 1 reply; 17+ messages in thread
From: Eric Schulte @ 2014-01-11 22:29 UTC (permalink / raw)
  To: John Hendy; +Cc: Org Mode Mailing List

>
> The "Hello world" example worked splendidly for me out of the box. I'm
> having a bit of difficulty with serving up a file via this example:
> http://eschulte.github.io/emacs-web-server/File-Server.html#File-Server
>
> Perhaps I don't understand how the function is supposed to work... It
> says that the docroot is the current working directory in the example,
> so I cd'd to a directory with an .html file in it, started `emacs -Q`
> from the command line, ran `M-x load-file RET ~/.emacs`, and then
> evaluated the code from the example in the *scratch* buffer. I'm
> getting the 404 error. Should I be modifying that code somehow?
>

Since the value of the default-directory variable may not be easy to
predict, you're probably better off changing

  (docroot default-directory)

to

  (docroot "/full/path/to/directory/of/org/files")

I only used default-directory in the example because I couldn't think of
a good static path which would probably exist on most people's systems.

>
>
> Thanks and great work -- this is really neat!

Thanks, and please do let me know if anything else doesn't work as
expected.

Best,

> 
> John
>
>
>> Best,
>>
>> Footnotes:
>> [1]  https://github.com/eschulte/emacs-web-server
>>
>> [2]  http://eschulte.github.io/emacs-web-server/tutorials/#sec-1
>>
>> [3]  http://eschulte.github.io/emacs-web-server/Org_002dmode-Export.html#Org_002dmode-Export
>>
>> [4]  https://github.com/eschulte/emacs-web-server/blob/master/examples/013-org-export-service.el
>>
>> [5]  https://github.com/eschulte/emacs-web-server/blob/master/examples/011-org-agenda.el
>>
>> [6]  https://github.com/eschulte/org-ehtml
>>
>> [7]  http://eschulte.github.io/emacs-web-server/benchmark/
>>
>> --
>> Eric Schulte
>> https://cs.unm.edu/~eschulte
>> PGP: 0x614CA05D
>>

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-11 22:27   ` David Belohrad
@ 2014-01-11 22:33     ` Eric Schulte
  2014-01-12 16:38       ` David Belohrad
  0 siblings, 1 reply; 17+ messages in thread
From: Eric Schulte @ 2014-01-11 22:33 UTC (permalink / raw)
  To: David Belohrad; +Cc: Org Mode Mailing List

David Belohrad <david@belohrad.ch> writes:

> Hmm, I got
>
> Caught Error: (void-function symbol-macrolet)
>
> when browsing the web page. Do I miss something?
> .d.
>

You might want to try requiring the cl library with (require 'cl), and
then re-trying the example.  I believe the problem here is that eieio
(despite being distributed with Emacs) uses some functions which are
defined in the 'cl package.

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-11 22:29   ` Eric Schulte
@ 2014-01-11 23:22     ` John Hendy
  2014-01-12  0:26       ` Eric Schulte
  0 siblings, 1 reply; 17+ messages in thread
From: John Hendy @ 2014-01-11 23:22 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode Mailing List

On Sat, Jan 11, 2014 at 4:29 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
>>
>> The "Hello world" example worked splendidly for me out of the box. I'm
>> having a bit of difficulty with serving up a file via this example:
>> http://eschulte.github.io/emacs-web-server/File-Server.html#File-Server
>>
>> Perhaps I don't understand how the function is supposed to work... It
>> says that the docroot is the current working directory in the example,
>> so I cd'd to a directory with an .html file in it, started `emacs -Q`
>> from the command line, ran `M-x load-file RET ~/.emacs`, and then
>> evaluated the code from the example in the *scratch* buffer. I'm
>> getting the 404 error. Should I be modifying that code somehow?
>>
>
> Since the value of the default-directory variable may not be easy to
> predict, you're probably better off changing
>
>   (docroot default-directory)
>
> to
>
>   (docroot "/full/path/to/directory/of/org/files")
>
> I only used default-directory in the example because I couldn't think of
> a good static path which would probably exist on most people's systems.

Hmmm. Still having trouble. I tried:

(lexical-let ((docroot "/home/jwhendy/Desktop/e-web-server-test"))
  (ws-start
   (list (cons (cons :GET ".*")
               (lambda (request)
                 (with-slots (process headers) request
                   (let ((path (substring (cdr (assoc :GET headers)) 1)))
                     (if (ws-in-directory-p docroot path)
                         (ws-send-file process (expand-file-name path docroot))
                       (ws-send-404 process)))))))
   9003))

That directory contains just two .org files. When I open
localhost:9003, it downloads a file called `download`, containing the
following:

HTTP/1.1 500 Internal Server Error
Content-type: text/plain

Caught Error: (error "IO error reading
/home/jwhendy/Desktop/e-web-server-test: Is a directory")

So, I then tried with the first line like so (trailing slash):

(lexical-let ((docroot "/home/jwhendy/Desktop/e-web-server-test/"))

Then I'm back to the 404 error. Sorry if I'm being dense and didn't
follow something else implied. I noticed the tutorial mentioned
mime-types. Do I need to set something with xdg-mime for .org files or
do anything else other than simply doing (require 'web-server)?

Since the hello world example worked, I'm assuming the setup is at
least partially sound.

I did wonder why I get no completions for `M-x ws-TAB`. Should emacs
be aware of ws-* functions? Or is that not how one would run them
(e.g. M-x something is actually a command, not a function and my
nomenclature is incorrect)?


Thanks,
John

>
>>
>>
>> Thanks and great work -- this is really neat!
>
> Thanks, and please do let me know if anything else doesn't work as
> expected.
>
> Best,
>
>>
>> John
>>
>>
>>> Best,
>>>
>>> Footnotes:
>>> [1]  https://github.com/eschulte/emacs-web-server
>>>
>>> [2]  http://eschulte.github.io/emacs-web-server/tutorials/#sec-1
>>>
>>> [3]  http://eschulte.github.io/emacs-web-server/Org_002dmode-Export.html#Org_002dmode-Export
>>>
>>> [4]  https://github.com/eschulte/emacs-web-server/blob/master/examples/013-org-export-service.el
>>>
>>> [5]  https://github.com/eschulte/emacs-web-server/blob/master/examples/011-org-agenda.el
>>>
>>> [6]  https://github.com/eschulte/org-ehtml
>>>
>>> [7]  http://eschulte.github.io/emacs-web-server/benchmark/
>>>
>>> --
>>> Eric Schulte
>>> https://cs.unm.edu/~eschulte
>>> PGP: 0x614CA05D
>>>
>
> --
> Eric Schulte
> https://cs.unm.edu/~eschulte
> PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-11 23:22     ` John Hendy
@ 2014-01-12  0:26       ` Eric Schulte
  2014-01-12  1:10         ` John Hendy
  0 siblings, 1 reply; 17+ messages in thread
From: Eric Schulte @ 2014-01-12  0:26 UTC (permalink / raw)
  To: John Hendy; +Cc: Org Mode Mailing List

John Hendy <jw.hendy@gmail.com> writes:

> On Sat, Jan 11, 2014 at 4:29 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
>>>
>>> The "Hello world" example worked splendidly for me out of the box. I'm
>>> having a bit of difficulty with serving up a file via this example:
>>> http://eschulte.github.io/emacs-web-server/File-Server.html#File-Server
>>>
>>> Perhaps I don't understand how the function is supposed to work... It
>>> says that the docroot is the current working directory in the example,
>>> so I cd'd to a directory with an .html file in it, started `emacs -Q`
>>> from the command line, ran `M-x load-file RET ~/.emacs`, and then
>>> evaluated the code from the example in the *scratch* buffer. I'm
>>> getting the 404 error. Should I be modifying that code somehow?
>>>
>>
>> Since the value of the default-directory variable may not be easy to
>> predict, you're probably better off changing
>>
>>   (docroot default-directory)
>>
>> to
>>
>>   (docroot "/full/path/to/directory/of/org/files")
>>
>> I only used default-directory in the example because I couldn't think of
>> a good static path which would probably exist on most people's systems.
>
> Hmmm. Still having trouble. I tried:
>
> (lexical-let ((docroot "/home/jwhendy/Desktop/e-web-server-test"))
>   (ws-start
>    (list (cons (cons :GET ".*")
>                (lambda (request)
>                  (with-slots (process headers) request
>                    (let ((path (substring (cdr (assoc :GET headers)) 1)))
>                      (if (ws-in-directory-p docroot path)
>                          (ws-send-file process (expand-file-name path docroot))
>                        (ws-send-404 process)))))))
>    9003))
>
> That directory contains just two .org files. When I open
> localhost:9003, it downloads a file called `download`, containing the
> following:
>
> HTTP/1.1 500 Internal Server Error
> Content-type: text/plain
>
> Caught Error: (error "IO error reading
> /home/jwhendy/Desktop/e-web-server-test: Is a directory")
>
> So, I then tried with the first line like so (trailing slash):
>
> (lexical-let ((docroot "/home/jwhendy/Desktop/e-web-server-test/"))
>
> Then I'm back to the 404 error. Sorry if I'm being dense and didn't
> follow something else implied. I noticed the tutorial mentioned
> mime-types. Do I need to set something with xdg-mime for .org files or
> do anything else other than simply doing (require 'web-server)?
>
> Since the hello world example worked, I'm assuming the setup is at
> least partially sound.
>

Oh, the example is confusing, I just updated both the example and the
documentation.  The problem is that the example serves files, but not
directory listings.  So since you just requested "/" it said there was
nothing there.  If you pull down the latest version of the web-server
that example will now give a directory listing when "/" is requested.

>
> I did wonder why I get no completions for `M-x ws-TAB`. Should emacs
> be aware of ws-* functions? Or is that not how one would run them
> (e.g. M-x something is actually a command, not a function and my
> nomenclature is incorrect)?
>

Because none of the ws-* functions are commands, they are all functions
(meaning they don't have an interactive spec).  If you do `M-x
describe-function ws-TAB' you'll see a completion list.

This is because ws-* functions are all meant to be used from source
code, not called with M-x.  If you think any should have an interactive
spec added please let me know.

Thanks,

>
>
> Thanks,
> John
>
>>
>>>
>>>
>>> Thanks and great work -- this is really neat!
>>
>> Thanks, and please do let me know if anything else doesn't work as
>> expected.
>>
>> Best,
>>
>>>
>>> John
>>>
>>>
>>>> Best,
>>>>
>>>> Footnotes:
>>>> [1]  https://github.com/eschulte/emacs-web-server
>>>>
>>>> [2]  http://eschulte.github.io/emacs-web-server/tutorials/#sec-1
>>>>
>>>> [3]  http://eschulte.github.io/emacs-web-server/Org_002dmode-Export.html#Org_002dmode-Export
>>>>
>>>> [4]  https://github.com/eschulte/emacs-web-server/blob/master/examples/013-org-export-service.el
>>>>
>>>> [5]  https://github.com/eschulte/emacs-web-server/blob/master/examples/011-org-agenda.el
>>>>
>>>> [6]  https://github.com/eschulte/org-ehtml
>>>>
>>>> [7]  http://eschulte.github.io/emacs-web-server/benchmark/
>>>>
>>>> --
>>>> Eric Schulte
>>>> https://cs.unm.edu/~eschulte
>>>> PGP: 0x614CA05D
>>>>
>>
>> --
>> Eric Schulte
>> https://cs.unm.edu/~eschulte
>> PGP: 0x614CA05D

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-12  0:26       ` Eric Schulte
@ 2014-01-12  1:10         ` John Hendy
  2014-01-12  1:53           ` Eric Schulte
  0 siblings, 1 reply; 17+ messages in thread
From: John Hendy @ 2014-01-12  1:10 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode Mailing List

On Sat, Jan 11, 2014 at 6:26 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
> John Hendy <jw.hendy@gmail.com> writes:
>
>> On Sat, Jan 11, 2014 at 4:29 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
>>>>
>>>> The "Hello world" example worked splendidly for me out of the box. I'm
>>>> having a bit of difficulty with serving up a file via this example:
>>>> http://eschulte.github.io/emacs-web-server/File-Server.html#File-Server
>>>>
>>>> Perhaps I don't understand how the function is supposed to work... It
>>>> says that the docroot is the current working directory in the example,
>>>> so I cd'd to a directory with an .html file in it, started `emacs -Q`
>>>> from the command line, ran `M-x load-file RET ~/.emacs`, and then
>>>> evaluated the code from the example in the *scratch* buffer. I'm
>>>> getting the 404 error. Should I be modifying that code somehow?
>>>>
>>>
>>> Since the value of the default-directory variable may not be easy to
>>> predict, you're probably better off changing
>>>
>>>   (docroot default-directory)
>>>
>>> to
>>>
>>>   (docroot "/full/path/to/directory/of/org/files")
>>>
>>> I only used default-directory in the example because I couldn't think of
>>> a good static path which would probably exist on most people's systems.
>>
>> Hmmm. Still having trouble. I tried:
>>
>> (lexical-let ((docroot "/home/jwhendy/Desktop/e-web-server-test"))
>>   (ws-start
>>    (list (cons (cons :GET ".*")
>>                (lambda (request)
>>                  (with-slots (process headers) request
>>                    (let ((path (substring (cdr (assoc :GET headers)) 1)))
>>                      (if (ws-in-directory-p docroot path)
>>                          (ws-send-file process (expand-file-name path docroot))
>>                        (ws-send-404 process)))))))
>>    9003))
>>
>> That directory contains just two .org files. When I open
>> localhost:9003, it downloads a file called `download`, containing the
>> following:
>>
>> HTTP/1.1 500 Internal Server Error
>> Content-type: text/plain
>>
>> Caught Error: (error "IO error reading
>> /home/jwhendy/Desktop/e-web-server-test: Is a directory")
>>
>> So, I then tried with the first line like so (trailing slash):
>>
>> (lexical-let ((docroot "/home/jwhendy/Desktop/e-web-server-test/"))
>>
>> Then I'm back to the 404 error. Sorry if I'm being dense and didn't
>> follow something else implied. I noticed the tutorial mentioned
>> mime-types. Do I need to set something with xdg-mime for .org files or
>> do anything else other than simply doing (require 'web-server)?
>>
>> Since the hello world example worked, I'm assuming the setup is at
>> least partially sound.
>>
>
> Oh, the example is confusing, I just updated both the example and the
> documentation.  The problem is that the example serves files, but not
> directory listings.  So since you just requested "/" it said there was
> nothing there.  If you pull down the latest version of the web-server
> that example will now give a directory listing when "/" is requested.

So instead of a path, should I have provided a specific file name? I
guess I was just going by the description: "The following example
implements a file server which will serve files from..." Perhaps I'm
still not understanding what, exactly, the web-server does!

Do you point it to *a* file, or a directory containing numerous files?

Or just to understand better, can you give a concrete example of what
I could do with my example path which contains .org files (perhaps via
the original code before you modified it, just so I understand the
intent).

Or should I have been doing something like http://localhost:9003/file.org?

>
>>
>> I did wonder why I get no completions for `M-x ws-TAB`. Should emacs
>> be aware of ws-* functions? Or is that not how one would run them
>> (e.g. M-x something is actually a command, not a function and my
>> nomenclature is incorrect)?
>>
>
> Because none of the ws-* functions are commands, they are all functions
> (meaning they don't have an interactive spec).  If you do `M-x
> describe-function ws-TAB' you'll see a completion list.
>
> This is because ws-* functions are all meant to be used from source
> code, not called with M-x.  If you think any should have an interactive
> spec added please let me know.

Gotcha -- indeed, it was my poor grasp of Emacs terminology :)

Sorry for the denseness above. I'm not a super web guy, so I'm
probably just getting hung up on poor understanding of the term "web
server" and what exactly it would do in this context. For my limited
Apache experience I suppose I always had an index.html with links
elsewhere, so that's sort of the extent of my knowledge.


Thanks for all the assistance!
John

>
> Thanks,
>
>>
>>
>> Thanks,
>> John
>>
>>>
>>>>
>>>>
>>>> Thanks and great work -- this is really neat!
>>>
>>> Thanks, and please do let me know if anything else doesn't work as
>>> expected.
>>>
>>> Best,
>>>
>>>>
>>>> John
>>>>
>>>>
>>>>> Best,
>>>>>
>>>>> Footnotes:
>>>>> [1]  https://github.com/eschulte/emacs-web-server
>>>>>
>>>>> [2]  http://eschulte.github.io/emacs-web-server/tutorials/#sec-1
>>>>>
>>>>> [3]  http://eschulte.github.io/emacs-web-server/Org_002dmode-Export.html#Org_002dmode-Export
>>>>>
>>>>> [4]  https://github.com/eschulte/emacs-web-server/blob/master/examples/013-org-export-service.el
>>>>>
>>>>> [5]  https://github.com/eschulte/emacs-web-server/blob/master/examples/011-org-agenda.el
>>>>>
>>>>> [6]  https://github.com/eschulte/org-ehtml
>>>>>
>>>>> [7]  http://eschulte.github.io/emacs-web-server/benchmark/
>>>>>
>>>>> --
>>>>> Eric Schulte
>>>>> https://cs.unm.edu/~eschulte
>>>>> PGP: 0x614CA05D
>>>>>
>>>
>>> --
>>> Eric Schulte
>>> https://cs.unm.edu/~eschulte
>>> PGP: 0x614CA05D
>
> --
> Eric Schulte
> https://cs.unm.edu/~eschulte
> PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-11 21:53   ` Eric Schulte
@ 2014-01-12  1:12     ` Thomas S. Dye
  0 siblings, 0 replies; 17+ messages in thread
From: Thomas S. Dye @ 2014-01-12  1:12 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode Mailing List

Hi Eric,

Eric Schulte <schulte.eric@gmail.com> writes:

> I'm not sure what to make of that, as eieio.el is distributed as part of
> Emacs, so it should be in lisp/emacs-lisp/ under your installed Emacs
> directory, which should be in the load-path.  Regardless, since
> everything is running successfully, Emacs can obviously find eieio at
> runtime, so I wouldn't worry about batch compilation not working.

Somehow, make was finding the emacs 22 that came with the OS. Not sure
why emacs --version said 24.3.1. Apologies for the noise.

Tom

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-12  1:10         ` John Hendy
@ 2014-01-12  1:53           ` Eric Schulte
  2014-01-12 14:40             ` John Hendy
  0 siblings, 1 reply; 17+ messages in thread
From: Eric Schulte @ 2014-01-12  1:53 UTC (permalink / raw)
  To: John Hendy; +Cc: Org Mode Mailing List

John Hendy <jw.hendy@gmail.com> writes:

> On Sat, Jan 11, 2014 at 6:26 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
>> John Hendy <jw.hendy@gmail.com> writes:
>>
>>> On Sat, Jan 11, 2014 at 4:29 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
>>>>>
>>>>> The "Hello world" example worked splendidly for me out of the box. I'm
>>>>> having a bit of difficulty with serving up a file via this example:
>>>>> http://eschulte.github.io/emacs-web-server/File-Server.html#File-Server
>>>>>
>>>>> Perhaps I don't understand how the function is supposed to work... It
>>>>> says that the docroot is the current working directory in the example,
>>>>> so I cd'd to a directory with an .html file in it, started `emacs -Q`
>>>>> from the command line, ran `M-x load-file RET ~/.emacs`, and then
>>>>> evaluated the code from the example in the *scratch* buffer. I'm
>>>>> getting the 404 error. Should I be modifying that code somehow?
>>>>>
>>>>
>>>> Since the value of the default-directory variable may not be easy to
>>>> predict, you're probably better off changing
>>>>
>>>>   (docroot default-directory)
>>>>
>>>> to
>>>>
>>>>   (docroot "/full/path/to/directory/of/org/files")
>>>>
>>>> I only used default-directory in the example because I couldn't think of
>>>> a good static path which would probably exist on most people's systems.
>>>
>>> Hmmm. Still having trouble. I tried:
>>>
>>> (lexical-let ((docroot "/home/jwhendy/Desktop/e-web-server-test"))
>>>   (ws-start
>>>    (list (cons (cons :GET ".*")
>>>                (lambda (request)
>>>                  (with-slots (process headers) request
>>>                    (let ((path (substring (cdr (assoc :GET headers)) 1)))
>>>                      (if (ws-in-directory-p docroot path)
>>>                          (ws-send-file process (expand-file-name path docroot))
>>>                        (ws-send-404 process)))))))
>>>    9003))
>>>
>>> That directory contains just two .org files. When I open
>>> localhost:9003, it downloads a file called `download`, containing the
>>> following:
>>>
>>> HTTP/1.1 500 Internal Server Error
>>> Content-type: text/plain
>>>
>>> Caught Error: (error "IO error reading
>>> /home/jwhendy/Desktop/e-web-server-test: Is a directory")
>>>
>>> So, I then tried with the first line like so (trailing slash):
>>>
>>> (lexical-let ((docroot "/home/jwhendy/Desktop/e-web-server-test/"))
>>>
>>> Then I'm back to the 404 error. Sorry if I'm being dense and didn't
>>> follow something else implied. I noticed the tutorial mentioned
>>> mime-types. Do I need to set something with xdg-mime for .org files or
>>> do anything else other than simply doing (require 'web-server)?
>>>
>>> Since the hello world example worked, I'm assuming the setup is at
>>> least partially sound.
>>>
>>
>> Oh, the example is confusing, I just updated both the example and the
>> documentation.  The problem is that the example serves files, but not
>> directory listings.  So since you just requested "/" it said there was
>> nothing there.  If you pull down the latest version of the web-server
>> that example will now give a directory listing when "/" is requested.
>
> So instead of a path, should I have provided a specific file name? I
> guess I was just going by the description: "The following example
> implements a file server which will serve files from..." Perhaps I'm
> still not understanding what, exactly, the web-server does!
>
> Do you point it to *a* file, or a directory containing numerous files?
>
> Or just to understand better, can you give a concrete example of what
> I could do with my example path which contains .org files (perhaps via
> the original code before you modified it, just so I understand the
> intent).
>
> Or should I have been doing something like http://localhost:9003/file.org?
>

Yes, the above would have worked with the original.  It assumed you
would give it a file name as the end of the URL.

>
>>
>>>
>>> I did wonder why I get no completions for `M-x ws-TAB`. Should emacs
>>> be aware of ws-* functions? Or is that not how one would run them
>>> (e.g. M-x something is actually a command, not a function and my
>>> nomenclature is incorrect)?
>>>
>>
>> Because none of the ws-* functions are commands, they are all functions
>> (meaning they don't have an interactive spec).  If you do `M-x
>> describe-function ws-TAB' you'll see a completion list.
>>
>> This is because ws-* functions are all meant to be used from source
>> code, not called with M-x.  If you think any should have an interactive
>> spec added please let me know.
>
> Gotcha -- indeed, it was my poor grasp of Emacs terminology :)
>
> Sorry for the denseness above. I'm not a super web guy, so I'm
> probably just getting hung up on poor understanding of the term "web
> server" and what exactly it would do in this context. For my limited
> Apache experience I suppose I always had an index.html with links
> elsewhere, so that's sort of the extent of my knowledge.
>

No problem, happy to help and I appreciate your feedback on what parts
are not obvious.

Best,

>
>
> Thanks for all the assistance!
> John
>
>>
>> Thanks,
>>
>>>
>>>
>>> Thanks,
>>> John
>>>
>>>>
>>>>>
>>>>>
>>>>> Thanks and great work -- this is really neat!
>>>>
>>>> Thanks, and please do let me know if anything else doesn't work as
>>>> expected.
>>>>
>>>> Best,
>>>>
>>>>>
>>>>> John
>>>>>
>>>>>
>>>>>> Best,
>>>>>>
>>>>>> Footnotes:
>>>>>> [1]  https://github.com/eschulte/emacs-web-server
>>>>>>
>>>>>> [2]  http://eschulte.github.io/emacs-web-server/tutorials/#sec-1
>>>>>>
>>>>>> [3]  http://eschulte.github.io/emacs-web-server/Org_002dmode-Export.html#Org_002dmode-Export
>>>>>>
>>>>>> [4]  https://github.com/eschulte/emacs-web-server/blob/master/examples/013-org-export-service.el
>>>>>>
>>>>>> [5]  https://github.com/eschulte/emacs-web-server/blob/master/examples/011-org-agenda.el
>>>>>>
>>>>>> [6]  https://github.com/eschulte/org-ehtml
>>>>>>
>>>>>> [7]  http://eschulte.github.io/emacs-web-server/benchmark/
>>>>>>
>>>>>> --
>>>>>> Eric Schulte
>>>>>> https://cs.unm.edu/~eschulte
>>>>>> PGP: 0x614CA05D
>>>>>>
>>>>
>>>> --
>>>> Eric Schulte
>>>> https://cs.unm.edu/~eschulte
>>>> PGP: 0x614CA05D
>>
>> --
>> Eric Schulte
>> https://cs.unm.edu/~eschulte
>> PGP: 0x614CA05D

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-12  1:53           ` Eric Schulte
@ 2014-01-12 14:40             ` John Hendy
  2014-01-12 16:21               ` Eric Schulte
  0 siblings, 1 reply; 17+ messages in thread
From: John Hendy @ 2014-01-12 14:40 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode Mailing List

On Sat, Jan 11, 2014 at 7:53 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
> John Hendy <jw.hendy@gmail.com> writes:
>
>> On Sat, Jan 11, 2014 at 6:26 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
>>> John Hendy <jw.hendy@gmail.com> writes:
>>>
>>>> On Sat, Jan 11, 2014 at 4:29 PM, Eric Schulte <schulte.eric@gmail.com> wrote:
>>>>>>
>>>>>> The "Hello world" example worked splendidly for me out of the box. I'm
>>>>>> having a bit of difficulty with serving up a file via this example:
>>>>>> http://eschulte.github.io/emacs-web-server/File-Server.html#File-Server
>>>>>>
>>>>>> Perhaps I don't understand how the function is supposed to work... It
>>>>>> says that the docroot is the current working directory in the example,
>>>>>> so I cd'd to a directory with an .html file in it, started `emacs -Q`
>>>>>> from the command line, ran `M-x load-file RET ~/.emacs`, and then
>>>>>> evaluated the code from the example in the *scratch* buffer. I'm
>>>>>> getting the 404 error. Should I be modifying that code somehow?
>>>>>>
>>>>>
>>>>> Since the value of the default-directory variable may not be easy to
>>>>> predict, you're probably better off changing
>>>>>
>>>>>   (docroot default-directory)
>>>>>
>>>>> to
>>>>>
>>>>>   (docroot "/full/path/to/directory/of/org/files")
>>>>>
>>>>> I only used default-directory in the example because I couldn't think of
>>>>> a good static path which would probably exist on most people's systems.
>>>>
>>>> Hmmm. Still having trouble. I tried:
>>>>
>>>> (lexical-let ((docroot "/home/jwhendy/Desktop/e-web-server-test"))
>>>>   (ws-start
>>>>    (list (cons (cons :GET ".*")
>>>>                (lambda (request)
>>>>                  (with-slots (process headers) request
>>>>                    (let ((path (substring (cdr (assoc :GET headers)) 1)))
>>>>                      (if (ws-in-directory-p docroot path)
>>>>                          (ws-send-file process (expand-file-name path docroot))
>>>>                        (ws-send-404 process)))))))
>>>>    9003))
>>>>
>>>> That directory contains just two .org files. When I open
>>>> localhost:9003, it downloads a file called `download`, containing the
>>>> following:
>>>>
>>>> HTTP/1.1 500 Internal Server Error
>>>> Content-type: text/plain
>>>>
>>>> Caught Error: (error "IO error reading
>>>> /home/jwhendy/Desktop/e-web-server-test: Is a directory")
>>>>
>>>> So, I then tried with the first line like so (trailing slash):
>>>>
>>>> (lexical-let ((docroot "/home/jwhendy/Desktop/e-web-server-test/"))
>>>>
>>>> Then I'm back to the 404 error. Sorry if I'm being dense and didn't
>>>> follow something else implied. I noticed the tutorial mentioned
>>>> mime-types. Do I need to set something with xdg-mime for .org files or
>>>> do anything else other than simply doing (require 'web-server)?
>>>>
>>>> Since the hello world example worked, I'm assuming the setup is at
>>>> least partially sound.
>>>>
>>>
>>> Oh, the example is confusing, I just updated both the example and the
>>> documentation.  The problem is that the example serves files, but not
>>> directory listings.  So since you just requested "/" it said there was
>>> nothing there.  If you pull down the latest version of the web-server
>>> that example will now give a directory listing when "/" is requested.
>>
>> So instead of a path, should I have provided a specific file name? I
>> guess I was just going by the description: "The following example
>> implements a file server which will serve files from..." Perhaps I'm
>> still not understanding what, exactly, the web-server does!
>>
>> Do you point it to *a* file, or a directory containing numerous files?
>>
>> Or just to understand better, can you give a concrete example of what
>> I could do with my example path which contains .org files (perhaps via
>> the original code before you modified it, just so I understand the
>> intent).
>>
>> Or should I have been doing something like http://localhost:9003/file.org?
>>
>
> Yes, the above would have worked with the original.  It assumed you
> would give it a file name as the end of the URL.

I tried two things:

;;; file-server.el --- serve any files using Emacs Web Server
(lexical-let ((docroot "/home/jwhendy/Desktop/e-web-server-test/"))
  (ws-start
   (lambda (request)
     (with-slots (process headers) request
       (let ((path (substring (cdr (assoc :GET headers)) 1)))
         (if (ws-in-directory-p docroot path)
             (if (file-directory-p path)
                 (ws-send-directory-list process
                   (expand-file-name path docroot) "^[^\.]")
               (ws-send-file process (expand-file-name path docroot)))
           (ws-send-404 process)))))
   9003))

- If I go to localhost:9003, I get 404 not found.
- If I go to localhost:9003/personal.org (I threw my non-work notes
file into that directory), it downloads the file.

Next, I replaced the first line with a full path to personal.org:

(lexical-let ((docroot "/home/jwhendy/Desktop/e-web-server-test/personal.org"))

Now I get the following error (in the browser) for localhost:9003:

Caught Error: (void-function ws-send-directory-list)

If I do localhost:9003/personal.org, it also downloads the file.


I feel I must be drastically overcomplicating this somehow...


Thanks again for persisting with me!
John

[snipped emacs terminology discussion]

>> Sorry for the denseness above. I'm not a super web guy, so I'm
>> probably just getting hung up on poor understanding of the term "web
>> server" and what exactly it would do in this context. For my limited
>> Apache experience I suppose I always had an index.html with links
>> elsewhere, so that's sort of the extent of my knowledge.
>>
>
> No problem, happy to help and I appreciate your feedback on what parts
> are not obvious.
>
> Best,
>
>>
>>
>> Thanks for all the assistance!
>> John
>>
>>>
>>> Thanks,
>>>
>>>>
>>>>
>>>> Thanks,
>>>> John
>>>>
>>>>>
>>>>>>
>>>>>>
>>>>>> Thanks and great work -- this is really neat!
>>>>>
>>>>> Thanks, and please do let me know if anything else doesn't work as
>>>>> expected.
>>>>>
>>>>> Best,
>>>>>
>>>>>>
>>>>>> John
>>>>>>
>>>>>>
>>>>>>> Best,
>>>>>>>
>>>>>>> Footnotes:
>>>>>>> [1]  https://github.com/eschulte/emacs-web-server
>>>>>>>
>>>>>>> [2]  http://eschulte.github.io/emacs-web-server/tutorials/#sec-1
>>>>>>>
>>>>>>> [3]  http://eschulte.github.io/emacs-web-server/Org_002dmode-Export.html#Org_002dmode-Export
>>>>>>>
>>>>>>> [4]  https://github.com/eschulte/emacs-web-server/blob/master/examples/013-org-export-service.el
>>>>>>>
>>>>>>> [5]  https://github.com/eschulte/emacs-web-server/blob/master/examples/011-org-agenda.el
>>>>>>>
>>>>>>> [6]  https://github.com/eschulte/org-ehtml
>>>>>>>
>>>>>>> [7]  http://eschulte.github.io/emacs-web-server/benchmark/
>>>>>>>
>>>>>>> --
>>>>>>> Eric Schulte
>>>>>>> https://cs.unm.edu/~eschulte
>>>>>>> PGP: 0x614CA05D
>>>>>>>
>>>>>
>>>>> --
>>>>> Eric Schulte
>>>>> https://cs.unm.edu/~eschulte
>>>>> PGP: 0x614CA05D
>>>
>>> --
>>> Eric Schulte
>>> https://cs.unm.edu/~eschulte
>>> PGP: 0x614CA05D
>
> --
> Eric Schulte
> https://cs.unm.edu/~eschulte
> PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-12 14:40             ` John Hendy
@ 2014-01-12 16:21               ` Eric Schulte
  0 siblings, 0 replies; 17+ messages in thread
From: Eric Schulte @ 2014-01-12 16:21 UTC (permalink / raw)
  To: John Hendy; +Cc: Org Mode Mailing List

>
> I tried two things:
>
> ;;; file-server.el --- serve any files using Emacs Web Server
> (lexical-let ((docroot "/home/jwhendy/Desktop/e-web-server-test/"))
>   (ws-start
>    (lambda (request)
>      (with-slots (process headers) request
>        (let ((path (substring (cdr (assoc :GET headers)) 1)))
>          (if (ws-in-directory-p docroot path)
>              (if (file-directory-p path)
>                  (ws-send-directory-list process
>                    (expand-file-name path docroot) "^[^\.]")
>                (ws-send-file process (expand-file-name path docroot)))
>            (ws-send-404 process)))))
>    9003))
>
> - If I go to localhost:9003, I get 404 not found.

Surprising, I don't see that locally, and I don't see how that could be
the case.

> 
> - If I go to localhost:9003/personal.org (I threw my non-work notes
> file into that directory), it downloads the file.
>

This is expected.  Note, you could serve other file types as well, what
this example was meant to illustrate is how the web-server will set the
mime-type appropriately based on the file type (e.g., serving foo.jpg
with the "image/jpeg" type).

If you only care about Org-mode files, maybe look at example 7.

>
> Next, I replaced the first line with a full path to personal.org:
>
> (lexical-let ((docroot "/home/jwhendy/Desktop/e-web-server-test/personal.org"))
>

This makes no sense.  The docroot should be a directory.

>
> Now I get the following error (in the browser) for localhost:9003:
>
> Caught Error: (void-function ws-send-directory-list)
>
> If I do localhost:9003/personal.org, it also downloads the file.
>
>
> I feel I must be drastically overcomplicating this somehow...
>

I've pushed up a small fix to the directory listing which I originally
wrote too quickly last night.  If you do want to serve files like this
locally then it is probably worth it to update your web-server install
and try again.  If you do update make sure you stop old servers before
starting new ones, e.g., by executing the following.

  (mapc #'ws-stop ws-servers)

>
>
> Thanks again for persisting with me!

Sure thing.  Sorry if a bug in my hastily written directory listing made
things more confusing than they needed to be.

> 
> John
>
> [snipped emacs terminology discussion]
>
-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-11 22:33     ` Eric Schulte
@ 2014-01-12 16:38       ` David Belohrad
  0 siblings, 0 replies; 17+ messages in thread
From: David Belohrad @ 2014-01-12 16:38 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode Mailing List

yeah, that worked. cool, thanks.

Eric Schulte <schulte.eric@gmail.com> writes:

> David Belohrad <david@belohrad.ch> writes:
>
>> Hmm, I got
>>
>> Caught Error: (void-function symbol-macrolet)
>>
>> when browsing the web page. Do I miss something?
>> .d.
>>
>
> You might want to try requiring the cl library with (require 'cl), and
> then re-trying the example.  I believe the problem here is that eieio
> (despite being distributed with Emacs) uses some functions which are
> defined in the 'cl package.
>
> -- 
> Eric Schulte
> https://cs.unm.edu/~eschulte
> PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-11 18:09 [ANN, OT] Emacs web-server, a new option for serving Org-mode files Eric Schulte
  2014-01-11 19:12 ` Thomas S. Dye
  2014-01-11 22:21 ` John Hendy
@ 2014-01-16  0:51 ` Andrea Rossetti
  2014-01-17 17:37   ` Eric Schulte
  2 siblings, 1 reply; 17+ messages in thread
From: Andrea Rossetti @ 2014-01-16  0:51 UTC (permalink / raw)
  To: Eric Schulte; +Cc: Org Mode Mailing List


Eric Schulte <schulte.eric@gmail.com> writes:
> I've written an Emacs web-server [1], which may be used to interact with
> Org-mode over HTTP.  It has no dependencies aside from needing Emacs 24
> or later and it should be easy to install and use [2].

Thanks Eric for having shared this project. Unfortunately in my setup
(Emacs 24.3.1, Windows 7) I could not run even the first "hello world".
If some Windows user has time and chance to try, may I please ask
if they run web-server successfully.

My attempt was to run emacs -Q and type:

--8<---------------cut here---------------start------------->8---
(require 'cl)
(require 'ert)
(add-to-list 'load-path "C:/Users/andrea/Desktop/emacs-web-server-master")
(require 'web-server)

(load-file "./examples/000-hello-world.el")
--8<---------------cut here---------------end--------------->8---

  While executing this script I received no errors, not even with
debug-on-error turned on. 

  I checked that my port 9000 is free before using it.

  When I launch Chrome/curl/wget, the connection is established
but it never terminates, and no output is delivered to client.

  Even M-x list-processes showed apparently correct output:
---------------------------------
server          listen  --              --           (network server on local)
ws-server       listen  --              --           (network server on [0 0 0 0 9000])
ws-server <1... open    --              --           (network connection to 127.0.0.1)
---------------------------------

  Thanks for any hint/advice, kindest regards.

  Andrea

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [ANN, OT] Emacs web-server, a new option for serving Org-mode files
  2014-01-16  0:51 ` Andrea Rossetti
@ 2014-01-17 17:37   ` Eric Schulte
  0 siblings, 0 replies; 17+ messages in thread
From: Eric Schulte @ 2014-01-17 17:37 UTC (permalink / raw)
  To: Andrea Rossetti; +Cc: Org Mode Mailing List

Andrea Rossetti <andrea.rossetti@gmail.com> writes:

> Eric Schulte <schulte.eric@gmail.com> writes:
>> I've written an Emacs web-server [1], which may be used to interact with
>> Org-mode over HTTP.  It has no dependencies aside from needing Emacs 24
>> or later and it should be easy to install and use [2].
>
> Thanks Eric for having shared this project. Unfortunately in my setup
> (Emacs 24.3.1, Windows 7) I could not run even the first "hello world".
> If some Windows user has time and chance to try, may I please ask
> if they run web-server successfully.
>

Hi Andrea,

For better or worse I have no access to a Windows machine and can't
address any windows problems.

Sorry I can't be of more help,

-- 
Eric Schulte
https://cs.unm.edu/~eschulte
PGP: 0x614CA05D

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2014-01-17 17:55 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-01-11 18:09 [ANN, OT] Emacs web-server, a new option for serving Org-mode files Eric Schulte
2014-01-11 19:12 ` Thomas S. Dye
2014-01-11 21:53   ` Eric Schulte
2014-01-12  1:12     ` Thomas S. Dye
2014-01-11 22:21 ` John Hendy
2014-01-11 22:27   ` David Belohrad
2014-01-11 22:33     ` Eric Schulte
2014-01-12 16:38       ` David Belohrad
2014-01-11 22:29   ` Eric Schulte
2014-01-11 23:22     ` John Hendy
2014-01-12  0:26       ` Eric Schulte
2014-01-12  1:10         ` John Hendy
2014-01-12  1:53           ` Eric Schulte
2014-01-12 14:40             ` John Hendy
2014-01-12 16:21               ` Eric Schulte
2014-01-16  0:51 ` Andrea Rossetti
2014-01-17 17:37   ` Eric Schulte

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).