Skip to content

Development Resources

Bruce-Connor edited this page Dec 1, 2014 · 5 revisions

Development Tools

In #40, sx-assoc-let was introduced to make data access more reasable when working with the associations lists that functions like sx-request-make return:

((site_type . "main_site")
 (name . "Stack Overflow")
 (api_site_parameter . "stackoverflow")
 (site_url . "http://stackoverflow.com"))

To use this as is (say, bound to data), we would need to use a complicated let-binding:

(let ((site_type          (cdr (assoc 'site_type          data)))
      (name               (cdr (assoc 'name               data)))
      (api_site_parameter (cdr (assoc 'api_site_parameter data)))
      (site_url           (cdr (assoc 'site_url           data))))
  (message "%S %S %S %S"
           site_type name api_site_parameter site_url))

With sx-assoc-let, this complicated structure becomes

(sx-assoc-let data
  (message "%S %S %S %S"
           .site_type .name .api_site_parameter .site_url))

Much cleaner, don’t you think? The macro gathers every symbol the begins with . and let-binds them to the corresponding form. For .symbol, we would see (cdr (assoc 'symbol data)) as its binding.

Since this is an easily recognizable pattern, it’s recommended that the following font-lock rule is added to your development environment:

(font-lock-add-keywords
 'emacs-lisp-mode 
 '(("\\_<\\.\\(?:\\sw\\|\\s_\\)+\\_>" 0 font-lock-builtin-face)))

Useful Links

Editing

Requests

Authentication Tests

Elisp manual on Buttons

Buttons are used throughout the interface to provide interactivity. There is a button type defined in sx-button.el for each type of interactible object (section titles, links, code-blocks, etc).

Bookmarks

Lisp-to-Org
f2ebbd3aa4916a27b2368a56046c33eea88058b7
HTML rendering
53c9770c8e706b901197f33a9af38bfb1397246c