diff options
-rw-r--r-- | .gitignore | 12 | ||||
-rw-r--r-- | sx-auth.el | 16 | ||||
-rw-r--r-- | sx-cache.el | 14 | ||||
-rw-r--r-- | sx-encoding.el | 14 | ||||
-rw-r--r-- | sx-favorites.el | 6 | ||||
-rw-r--r-- | sx-filter.el | 7 | ||||
-rw-r--r-- | sx-interaction.el | 10 | ||||
-rw-r--r-- | sx-networks.el | 6 | ||||
-rw-r--r-- | sx-question-list.el | 8 | ||||
-rw-r--r-- | sx-question-mode.el | 5 | ||||
-rw-r--r-- | sx-question.el | 3 | ||||
-rw-r--r-- | sx-request.el | 6 | ||||
-rw-r--r-- | sx-site.el | 6 | ||||
-rw-r--r-- | sx-tab.el | 13 | ||||
-rw-r--r-- | sx-time.el | 3 | ||||
-rw-r--r-- | sx.el | 2 |
16 files changed, 109 insertions, 22 deletions
@@ -1,12 +1,18 @@ -# Emacs backup files +# Personal Development +.dir-locals.el + +# Backup Files *~ \#*\# # Compiled Elisp *.elc + +# Package Artifacts /.cask/ -.dir-locals.el -/.stackmode/ /url/ +/.sx/ + +# Generated Files /sx.info /sx.texi @@ -1,4 +1,4 @@ -;;; sx-auth.el --- user authentication -*- lexical-binding: t; -*- +;;; sx-auth.el --- user authentication ;; Copyright (C) 2014 Sean Allred @@ -19,6 +19,13 @@ ;;; Commentary: +;; This file handles logic related to authentication. This includes +;; determining if a certain filter requires authentication (via the +;; variable `sx-auth-filter-auth' and function `sx-auth--filter-p'), +;; determining if a method requires authentication (via the variable +;; `sx-auth-method-auth' and function `sx-auth--method-p'), and +;; actually authenticating the user (with `sx-auth-authenticate'). + ;;; Code: (require 'sx) @@ -36,7 +43,9 @@ "Your access token. This is needed to use your account to write questions, make comments, and read your inbox. Do not alter this unless you know -what you are doing!") +what you are doing! + +This variable is set with `sx-auth-authenticate'.") (defvar sx-auth-method-auth '((me . t) (inbox . t) @@ -65,7 +74,7 @@ what you are doing!") upvote (unanswered my-tags))) "List of methods that require auth. -Methods are of form (METHOD SUBMETHODS) where SUBMETHODS +Methods are of form (METHOD . SUBMETHODS) where SUBMETHODS is (METHOD METHOD METHOD ...). If all SUBMETHODS require auth or there are no submethods, form @@ -183,4 +192,5 @@ removed those properties." ;; Local Variables: ;; indent-tabs-mode: nil +;; lexical-binding: t ;; End: diff --git a/sx-cache.el b/sx-cache.el index 51c2267..cf48ef5 100644 --- a/sx-cache.el +++ b/sx-cache.el @@ -19,12 +19,18 @@ ;;; Commentary: -;; All caches are retrieved and set using symbols. The symbol should -;; be the sub-subpackage that is using the cache. For example, -;; `sx-pkg' would use `(sx-cache-get 'pkg)'. +;; This file handles the cache system. All caches are retrieved and +;; set using symbols. The symbol should be the sub-package that is +;; using the cache. For example, `sx-pkg' would use +;; +;; `(sx-cache-get 'pkg)' ;; ;; This symbol is then converted into a filename within -;; `sx-cache-directory'. +;; `sx-cache-directory' using `sx-cache-get-file-name'. +;; +;; Currently, the cache is written at every `sx-cache-set', but this +;; write will eventually be done by some write-all function which will +;; be set on an idle timer. ;;; Code: diff --git a/sx-encoding.el b/sx-encoding.el index 0e66677..ee099bc 100644 --- a/sx-encoding.el +++ b/sx-encoding.el @@ -19,10 +19,18 @@ ;;; Commentary: +;; This file handles decoding the responses we get from the API. They +;; are received either as plain-text or as a `gzip' compressed archive. +;; For this, `sx-encoding-gzipped-p' is used to determine if content +;; has been compressed under `gzip'. + ;;; Code: (require 'cl-lib) + +;;;; HTML Encoding + (defcustom sx-encoding-html-entities-plist '(Aacute "Á" aacute "á" Acirc "Â" acirc "â" acute "´" AElig "Æ" aelig "æ" Agrave "À" agrave "à" alefsym "ℵ" Alpha "Α" alpha "α" amp "&" and "∧" @@ -86,6 +94,9 @@ Return the decoded string." (substring ss 1)))))))) (replace-regexp-in-string "&[^; ]*;" get-function string))) + +;;;; Convenience Functions + (defun sx-encoding-normalize-line-endings (string) "Normalize the line endings for STRING. The API returns strings that use Windows-style line endings. @@ -131,6 +142,9 @@ some cases." (cl-map #'vector #'sx-encoding-clean-content-deep data)) (t data)))) + +;;;; GZIP + (defun sx-encoding-gzipped-p (data) "Check for magic bytes in DATA. Check if the first two bytes of a string in DATA match the magic diff --git a/sx-favorites.el b/sx-favorites.el index d957167..44ee19f 100644 --- a/sx-favorites.el +++ b/sx-favorites.el @@ -1,4 +1,4 @@ -;;; sx-favorites.el --- Starred questions -*- lexical-binding: t; -*- +;;; sx-favorites.el --- starred questions ;; Copyright (C) 2014 Sean Allred @@ -19,6 +19,9 @@ ;;; Commentary: +;; This file provides logic for retrieving and managing a user's +;; starred questions. + ;;; Code: (require 'sx-method) @@ -79,4 +82,5 @@ Writes list to cache QUESTION-FAVORITES." ;; Local Variables: ;; indent-tabs-mode: nil +;; lexical-binding: t ;; End: diff --git a/sx-filter.el b/sx-filter.el index 38084b9..327a8eb 100644 --- a/sx-filter.el +++ b/sx-filter.el @@ -1,4 +1,4 @@ -;;; sx-filter.el --- filters -*- lexical-binding: t; -*- +;;; sx-filter.el --- filters ;; Copyright (C) 2014 Sean Allred @@ -19,6 +19,10 @@ ;;; Commentary: +;; This file manages filters and provides an API to compile filters +;; and retrieve them from the cache. See `sx-filter-compile' and +;; `sx-filter-get-var', respectively. + ;;; Code: @@ -86,4 +90,5 @@ return the compiled filter." ;; Local Variables: ;; indent-tabs-mode: nil +;; lexical-binding: t ;; End: diff --git a/sx-interaction.el b/sx-interaction.el index 5f3ece6..0e4aae9 100644 --- a/sx-interaction.el +++ b/sx-interaction.el @@ -1,4 +1,4 @@ -;;; sx-interaction.el --- Voting, commenting, and otherwise interacting with questions. -*- lexical-binding: t; -*- +;;; sx-interaction.el --- voting, commenting, and other interaction ;; Copyright (C) 2014 Artur Malabarba @@ -19,6 +19,10 @@ ;;; Commentary: +;; This file provides voting, commenting, and other interactive +;; facilities. Most functions are scoped relative to `sx--data-here' +;; when called interactively. + ;;; Code: @@ -196,3 +200,7 @@ OBJECT can be a question or an answer." (provide 'sx-interaction) ;;; sx-interaction.el ends here + +;; Local Variables: +;; lexical-binding: t +;; End: diff --git a/sx-networks.el b/sx-networks.el index e4660af..5f5f1c3 100644 --- a/sx-networks.el +++ b/sx-networks.el @@ -1,4 +1,4 @@ -;;; sx-networks.el --- user network information -*- lexical-binding: t; -*- +;;; sx-networks.el --- user network information ;; Copyright (C) 2014 Sean Allred @@ -19,6 +19,9 @@ ;;; Commentary: +;; This file provides logic for retrieving information about the user +;; across the entire network, e.g. their registered sites. + ;;; Code: (require 'sx-method) @@ -104,4 +107,5 @@ list of sites the user is active on." ;; Local Variables: ;; indent-tabs-mode: nil +;; lexical-binding: t ;; End: diff --git a/sx-question-list.el b/sx-question-list.el index 9709b99..0967d6a 100644 --- a/sx-question-list.el +++ b/sx-question-list.el @@ -1,4 +1,4 @@ -;;; sx-question-list.el --- Major-mode for navigating questions list. -*- lexical-binding: t; -*- +;;; sx-question-list.el --- major-mode for navigating questions list ;; Copyright (C) 2014 Artur Malabarba @@ -19,6 +19,8 @@ ;;; Commentary: +;; Provides question list logic (as used in e.g. `sx-tab-frontpage'). + ;;; Code: (require 'tabulated-list) (require 'cl-lib) @@ -540,3 +542,7 @@ Sets `sx-question-list--site' and then call (provide 'sx-question-list) ;;; sx-question-list.el ends here + +;; Local Variables: +;; lexical-binding: t +;; End: diff --git a/sx-question-mode.el b/sx-question-mode.el index 21b6d40..fcbd112 100644 --- a/sx-question-mode.el +++ b/sx-question-mode.el @@ -1,4 +1,4 @@ -;;; sx-question-mode.el --- Creating the buffer that displays questions +;;; sx-question-mode.el --- major-mode for displaying questions ;; Copyright (C) 2014 Artur Malabarba @@ -19,6 +19,9 @@ ;;; Commentary: +;; This file provides a means to print questions with their answers +;; and all comments. See the customizable group `sx-question-mode'. + ;;; Code: (require 'markdown-mode) diff --git a/sx-question.el b/sx-question.el index f80a9bd..7b53e2e 100644 --- a/sx-question.el +++ b/sx-question.el @@ -19,6 +19,9 @@ ;;; Commentary: +;; Thie file provides an API for retrieving questions and defines +;; additional logic for marking questions as read or hidden. + ;;; Code: diff --git a/sx-request.el b/sx-request.el index 6be363d..3a8b7a8 100644 --- a/sx-request.el +++ b/sx-request.el @@ -1,4 +1,4 @@ -;;; sx-request.el --- requests and url manipulation -*- lexical-binding: t; -*- +;;; sx-request.el --- requests and url manipulation ;; Copyright (C) 2014 Sean Allred @@ -198,3 +198,7 @@ false, use the symbol `false'. Each element is processed with (provide 'sx-request) ;;; sx-request.el ends here + +;; Local Variables: +;; lexical-binding: t +;; End: @@ -1,4 +1,4 @@ -;;; sx-site.el --- browsing sites -*- lexical-binding: t; -*- +;;; sx-site.el --- browsing sites ;; Copyright (C) 2014 Sean Allred @@ -19,6 +19,9 @@ ;;; Commentary: +;; This file provides various pieces of site logic, such as retrieving +;; the list of sites and the list of a user's favorited questions. + ;;; Code: (require 'sx-method) @@ -70,4 +73,5 @@ api_site_parameter." ;; Local Variables: ;; indent-tabs-mode: nil +;; lexical-binding: t ;; End: @@ -1,4 +1,4 @@ -;;; sx-tab.el --- Functions for viewing different tabs. -*- lexical-binding: t; -*- +;;; sx-tab.el --- functions for viewing different tabs ;; Copyright (C) 2014 Artur Malabarba @@ -19,7 +19,12 @@ ;;; Commentary: -;; +;; This file provides a single macro to define 'tabs' to view lists of +;; questions. + +;;; Tabs: + +;; - frontpage :: the frontpage of a single site ;;; Code: @@ -107,3 +112,7 @@ If SITE is nil, use `sx-tab-default-site'." (provide 'sx-tab) ;;; sx-tab.el ends here + +;; Local Variables: +;; lexical-binding: t +;; End: @@ -19,7 +19,8 @@ ;;; Commentary: -;; +;; This file provides functions for manipulating and displaying +;; timestamps. ;;; Code: @@ -1,4 +1,4 @@ -;;; sx.el --- core functions of the sx package. +;;; sx.el --- core functions ;; Copyright (C) 2014 Sean Allred |