branch: master commit 04f6f73735367c81075f67f774e0b40f306b9d7a Author: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com> Commit: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>
Documentation. --- context-coloring.el | 30 ++++++++++++++++++++---------- 1 files changed, 20 insertions(+), 10 deletions(-) diff --git a/context-coloring.el b/context-coloring.el index 16eb1f2..830fd98 100644 --- a/context-coloring.el +++ b/context-coloring.el @@ -59,7 +59,7 @@ Supported modes: `js-mode', `js3-mode'" :group 'context-coloring) (defcustom context-coloring-js-block-scopes nil - "If non-nil, add block scopes to the scope hierarchy. + "If non-nil, also color block scopes in the scope hierarchy in JavaScript. The block-scope-inducing `let' and `const' are introduced in ES6. If you are writing ES6 code, enable this; otherwise, don't. @@ -74,15 +74,17 @@ Supported modes: `js2-mode'" "Reference to this buffer (for timers).") (defvar-local context-coloring-scopifier-process nil - "Only allow a single scopifier process to run at a time. This -is a reference to that one process.") + "Reference to the single scopifier process that can be + running.") (defvar-local context-coloring-colorize-idle-timer nil - "Reference to currently-running idle timer.") + "Reference to the currently-running idle timer.") (defvar-local context-coloring-changed nil "Indication that the buffer has changed recently, which would -imply that it should be colorized again.") +imply that it should be colorized again by +`context-coloring-colorize-idle-timer' if that timer is being +used.") ;;; Faces @@ -175,7 +177,7 @@ imply that it should be colorized again.") :group 'context-coloring-faces) (defcustom context-coloring-face-count 7 - "Number of faces defined for highlighting delimiter levels. + "Number of faces defined for highlighting levels. Determines level at which to cycle through faces again." :group 'context-coloring) @@ -204,11 +206,14 @@ For example: \"context-coloring-level-1-face\"." (defun context-coloring-uncolorize-buffer () "Clears all coloring in the current buffer." - (remove-text-properties (point-min) (point-max) `(face nil rear-nonsticky nil))) + (remove-text-properties + (point-min) + (point-max) + `(face nil rear-nonsticky nil))) (defsubst context-coloring-colorize-region (start end level) - "Colorizes characters from 1-indexed START (inclusive) to END -\(exclusive) with the face corresponding to LEVEL." + "Colorizes characters from the 1-indexed START (inclusive) to +END (exclusive) with the face corresponding to LEVEL." (add-text-properties start end @@ -236,6 +241,8 @@ For example: \"context-coloring-level-1-face\"." ;; Adapted from js2-refactor.el/js2r-vars.el. ;; FIXME: This fails if there is whitespace between the name and the colon. (defsubst context-coloring-js2-local-name-node-p (node) + "Determines if NODE is a js2-name-node representing a local +variable." (and (js2-name-node-p node) (let ((start (js2-node-abs-pos node))) (and @@ -250,6 +257,7 @@ For example: \"context-coloring-level-1-face\"." start))))))) (defsubst context-coloring-js2-colorize-node (node level) + "Colors NODE with the color for LEVEL." (let ((start (js2-node-abs-pos node))) (context-coloring-colorize-region start @@ -257,6 +265,8 @@ For example: \"context-coloring-level-1-face\"." level))) (defun context-coloring-js2-colorize () + "Colorizes the current buffer using the abstract syntax tree +generated by js2-mode." (with-silent-modifications (js2-visit-ast js2-mode-ast @@ -282,7 +292,7 @@ For example: \"context-coloring-level-1-face\"." t))))) -;;; Shell command copification / colorization +;;; Shell command scopification / colorization (defun context-coloring-apply-tokens (tokens) "Processes a vector of TOKENS to apply context-based coloring