[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 84/119: more examples
From: |
Eric Schulte |
Subject: |
[elpa] 84/119: more examples |
Date: |
Mon, 10 Mar 2014 16:57:46 +0000 |
eschulte pushed a commit to branch master
in repository elpa.
commit 33ac1643ca17ffa9ff198eae510b3af0c08849dc
Author: Eric Schulte <address@hidden>
Date: Wed Jan 8 13:01:59 2014 -0700
more examples
---
NOTES | 21 +++++++++++++--------
examples/10-current-buffer.el | 14 ++++++++++++++
examples/11-org-agenda.el | 17 +++++++++++++++++
examples/12-search-bbdb.el | 22 ++++++++++++++++++++++
4 files changed, 66 insertions(+), 8 deletions(-)
diff --git a/NOTES b/NOTES
index 9c6e3a2..a4413f3 100644
--- a/NOTES
+++ b/NOTES
@@ -1,21 +1,22 @@
-*- org -*-
* Notes
-* Tasks [10/25]
-** TODO web sockets
+* Tasks [14/24]
+** DONE web sockets
- http://en.wikipedia.org/wiki/WebSocket
- http://tools.ietf.org/html/rfc6455
-** more examples [0/4]
-*** TODO Org-mode agenda
+** more examples [3/3]
+*** DONE Org-mode agenda
Already exists as part of org-ehtml.
+file:examples/11-org-agenda.el
-*** TODO display the current buffer
+*** DONE display the current buffer
Idea stolen from elnode.
+file:examples/10-current-buffer.el
-*** TODO browse the BBDB
-*** TODO browse available ELPA packages
-Also took this idea from elnode.
+*** DONE browse the BBDB
+file:examples/12-search-bbdb.el
** DONE handle large files
When large files arrive quickly, the filter functions are called while
@@ -162,3 +163,7 @@ low priority -- just
[[*running%20behind%20an%20https%20proxy][run behind an htt
This will be a pain, and will require expanding [[info:emacs-gnutls]] to
add support for starting server processes, currently only client
processes are supported.
+* Bugs [0/1]
+** TODO Sometimes servers don't stop cleanly
+- specifically servers with active client process
+- maybe also implement a =ws-stop-all= function
diff --git a/examples/10-current-buffer.el b/examples/10-current-buffer.el
new file mode 100644
index 0000000..73b75da
--- /dev/null
+++ b/examples/10-current-buffer.el
@@ -0,0 +1,14 @@
+;;; current-buffer.el --- Show the current Emacs buffer
+(require 'htmlize)
+
+(ws-start
+ '(((lambda (_) t) .
+ (lambda (request)
+ (with-slots (process headers) request
+ (ws-response-header process 200
+ '("Content-type" . "text/html; charset=utf-8"))
+ (process-send-string process
+ (let ((html-buffer (htmlize-buffer)))
+ (prog1 (with-current-buffer html-buffer (buffer-string))
+ (kill-buffer html-buffer))))))))
+ 9010)
diff --git a/examples/11-org-agenda.el b/examples/11-org-agenda.el
new file mode 100644
index 0000000..578f688
--- /dev/null
+++ b/examples/11-org-agenda.el
@@ -0,0 +1,17 @@
+;;; org-agenda.el --- display the Org-mode agenda
+(require 'htmlize)
+
+(ws-start
+ '(((lambda (_) t) .
+ (lambda (request)
+ (with-slots (process headers) request
+ (ws-response-header process 200
+ '("Content-type" . "text/html; charset=utf-8"))
+ (org-agenda nil "a")
+ (process-send-string process
+ (save-window-excursion
+ (let ((html-buffer (htmlize-buffer)))
+ (prog1 (with-current-buffer html-buffer (buffer-string))
+ (kill-buffer html-buffer)
+ (org-agenda-quit)))))))))
+ 9011)
diff --git a/examples/12-search-bbdb.el b/examples/12-search-bbdb.el
new file mode 100644
index 0000000..2c1a49c
--- /dev/null
+++ b/examples/12-search-bbdb.el
@@ -0,0 +1,22 @@
+;;; search-bbdb.el --- search the Big Brother Data Base for a supplied name
+(ws-start
+ '(((lambda (_) t) .
+ (lambda (request)
+ (with-slots (process headers) request
+ (let ((name (cdr (assoc "name" headers))))
+ (unless name
+ (ws-error process "Must specify a name to search."))
+ (save-excursion
+ (unless (set-buffer (get-buffer "*BBDB*"))
+ (ws-error process "no *BBDB* buffer found"))
+ (bbdb-search-name name)
+ (if (equal (point-min) (point-max))
+ (progn
+ (ws-response-header process 404
+ '("Content-type" . "text/plain"))
+ (process-send-string process
+ "no matches found"))
+ (ws-response-header process 200
+ '("Content-type" . "text/plain"))
+ (process-send-string process (buffer-string)))))))))
+ 9012)
- [elpa] 73/119: some more examples to implement, (continued)
- [elpa] 73/119: some more examples to implement, Eric Schulte, 2014/03/10
- [elpa] 68/119: no multiple concurrent entry of ws-parse-request, Eric Schulte, 2014/03/10
- [elpa] 76/119: and more web-socket progress, Eric Schulte, 2014/03/10
- [elpa] 74/119: beginning to implement web-socket support, Eric Schulte, 2014/03/10
- [elpa] 77/119: handle chunked receipt of web-socket messages, Eric Schulte, 2014/03/10
- [elpa] 78/119: hold, Eric Schulte, 2014/03/10
- [elpa] 79/119: beginning to add convenience macro for web sockets, Eric Schulte, 2014/03/10
- [elpa] 81/119: implemented ws-web-socket-frame to send replies, Eric Schulte, 2014/03/10
- [elpa] 80/119: helpers for handling web socket connections, Eric Schulte, 2014/03/10
- [elpa] 82/119: web-sockets are working, Eric Schulte, 2014/03/10
- [elpa] 84/119: more examples,
Eric Schulte <=
- [elpa] 85/119: renaming example files, Eric Schulte, 2014/03/10
- [elpa] 86/119: another example idea -- org export service, Eric Schulte, 2014/03/10
- [elpa] 87/119: update server stopping w/requests process field, Eric Schulte, 2014/03/10
- [elpa] 83/119: supports web sockets, Eric Schulte, 2014/03/10
- [elpa] 75/119: more web-socket implementation, Eric Schulte, 2014/03/10
- [elpa] 91/119: more tutorial, Eric Schulte, 2014/03/10
- [elpa] 94/119: example serving Org-mode files as JSON, Eric Schulte, 2014/03/10
- [elpa] 93/119: helper function to serve directory listings, Eric Schulte, 2014/03/10
- [elpa] 90/119: tutorials, Eric Schulte, 2014/03/10
- [elpa] 88/119: accept single-function handlers, Eric Schulte, 2014/03/10