Home
Welcome to the emacs-sofa wiki!
Until emacs-sofa is enough usable, here is the current status and possibly step-by-step tutorial. Note that anything in this page is subjected to change without notification.
Download the source from github:
$ git clone http://github.com/cinsk/emacs-sofa.git
$ cd emacs-sofa
$ git submodule update --init
Emacs needs to know where the sources of emacs-sofa is located. One possible solution is to evaluate following sexp:
(add-to-path 'load-path "SOMEWHERE/emacs-sofa")
(add-to-path 'load-path "SOMEWHERE/emacs-sofa/curl")
You may add above sexps into your $HOME/.emacs
or $HOME/.emacs.d/init.el
if you want.
Launch Emacs, and evaluate following sexp by "M-: (require 'sofa)".
If you already running CouchDB in localhost:5984, no configuration is needed. If you're not, set the sofa-server
and sofa-port
accordingly:
(setq sofa-server "COUCHDB-HOSTNAME"
sofa-port COUCHDB-PORT)
If you have set the account for the CouchDB, set sofa-user-name
and sofa-user-password
accordingly:
(setq sofa-user-name "COUCHDB-USERNAME"
sofa-user-password "COUCHDB-PASSWORD")
Configuration for Cloudant
(setq cloudant-user-name "CLOUDANT-USER-NAME"
cloudant-user-password "CLOUDANT-USER-PASSWORD")
(defalias 'sofa-endpoint 'sofa-cloudant-url)
To load the document (as in Futon's document view), use following command:
M-x sofa-load-view <RET>
Then, input the database name then again. (completion is enabled)
Then, you can see the list of documents (Sofa view mode), as in Futon. Current key-binings are:
C-x [ load previous page
C-x ] load next page
m mark the current document
u unmark the current document
g revert the current buffer
o load the contents for marked documents (if no mark, use the current line)
On the document view (after o
command in view mode), you can change the contents,
C-c C-c commit the change into the CouchDB.
C-c C-k close the contents buffer (no effect to CouchDB)
To load the design document for a database,
M-x sofa-load-design <RET> DATABASE-NAME <RET> DESIGN-DOC-NAME <RET>
The DATABASE-NAME and DESIGN-DOC-NAME can be auto-completed.
After loading the design document, you can edit design doc by simply editing the buffer, or C-c C-e
command. I recommend to use C-c C-e
command if the value is complex, such as view functions or lengthy text. If it is a function, C-c C-e
automatically load javascript-mode and prettify the contents.
After modifying the design document, you can C-c C-c
to commit the change.