branch: master commit e2ceef9fa1dd455d1fc9657cca6ae778436e2ead Author: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com> Commit: Jackson Ray Hamilton <jack...@jacksonrayhamilton.com>
Prepend function symbols with octothorpes. --- benchmark/context-coloring-benchmark.el | 27 +++++++++--------- context-coloring.el | 46 +++++++++++++++--------------- test/context-coloring-coverage.el | 4 +- test/context-coloring-test.el | 28 +++++++++--------- 4 files changed, 53 insertions(+), 52 deletions(-) diff --git a/benchmark/context-coloring-benchmark.el b/benchmark/context-coloring-benchmark.el index 3675fc7..9ce2f6d 100644 --- a/benchmark/context-coloring-benchmark.el +++ b/benchmark/context-coloring-benchmark.el @@ -137,7 +137,7 @@ CALLBACK when all are done." ;; Test 5 times. (cond ((= count 5) - (advice-remove 'context-coloring-colorize advice) + (advice-remove #'context-coloring-colorize advice) (context-coloring-benchmark-log-results result-file fixture @@ -146,13 +146,13 @@ CALLBACK when all are done." :lines (count-lines (point-min) (point-max)) :words (count-words (point-min) (point-max)) :colorization-times colorization-times - :average-colorization-time (/ (apply '+ colorization-times) 5))) + :average-colorization-time (/ (apply #'+ colorization-times) 5))) (kill-buffer) (funcall callback)) (t (setq colorization-start-time (float-time)) - (funcall 'context-coloring-colorize)))))))) - (advice-add 'context-coloring-colorize :around advice) + (context-coloring-colorize)))))))) + (advice-add #'context-coloring-colorize :around advice) (setq colorization-start-time (float-time)) (find-file fixture))) (lambda () @@ -172,10 +172,10 @@ CALLBACK when all are done." "js-mode" (lambda () "Preparation logic for `js-mode'." - (add-hook 'js-mode-hook 'context-coloring-mode)) + (add-hook 'js-mode-hook #'context-coloring-mode)) (lambda () "Cleanup logic for `js-mode'." - (remove-hook 'js-mode-hook 'context-coloring-mode)) + (remove-hook 'js-mode-hook #'context-coloring-mode)) context-coloring-benchmark-js-fixtures callback)) @@ -188,10 +188,10 @@ CALLBACK when all are done." (setq js2-mode-show-parse-errors nil) (setq js2-mode-show-strict-warnings nil) (add-to-list 'auto-mode-alist '("\\.js\\'" . js2-mode)) - (add-hook 'js2-mode-hook 'context-coloring-mode)) + (add-hook 'js2-mode-hook #'context-coloring-mode)) (lambda () "Cleanup logic for `js2-mode'." - (remove-hook 'js2-mode-hook 'context-coloring-mode) + (remove-hook 'js2-mode-hook #'context-coloring-mode) (setq auto-mode-alist (delete '("\\.js\\'" . js2-mode) auto-mode-alist)) (setq js2-mode-show-strict-warnings t) @@ -212,19 +212,20 @@ CALLBACK when all are done." "emacs-lisp-mode" (lambda () "Preparation logic for `emacs-lisp-mode'." - (add-hook 'emacs-lisp-mode-hook 'context-coloring-mode)) + (add-hook 'emacs-lisp-mode-hook #'context-coloring-mode)) (lambda () "Cleanup logic for `emacs-lisp-mode'." - (remove-hook 'emacs-lisp-mode-hook 'context-coloring-mode)) + (remove-hook 'emacs-lisp-mode-hook #'context-coloring-mode)) context-coloring-benchmark-emacs-lisp-fixtures callback)) (defun context-coloring-benchmark-run () "Benchmark all modes, then exit." (context-coloring-benchmark-series - '(context-coloring-benchmark-js-mode-run - context-coloring-benchmark-js2-mode-run - context-coloring-benchmark-emacs-lisp-mode-run) + (list + #'context-coloring-benchmark-js-mode-run + #'context-coloring-benchmark-js2-mode-run + #'context-coloring-benchmark-emacs-lisp-mode-run) (lambda () (kill-emacs)))) diff --git a/context-coloring.el b/context-coloring.el index a343292..35e8c43 100644 --- a/context-coloring.el +++ b/context-coloring.el @@ -41,7 +41,7 @@ (defun context-coloring-join (strings delimiter) "Join a list of STRINGS with the string DELIMITER." - (mapconcat 'identity strings delimiter)) + (mapconcat #'identity strings delimiter)) (defsubst context-coloring-trim-right (string) "Remove leading whitespace from STRING." @@ -178,14 +178,14 @@ Supported modes: `js-mode', `js3-mode'" "Setup idle change detection." (let ((dispatch (context-coloring-get-dispatch-for-mode major-mode))) (add-hook - 'after-change-functions 'context-coloring-change-function nil t) + 'after-change-functions #'context-coloring-change-function nil t) (add-hook - 'kill-buffer-hook 'context-coloring-teardown-idle-change-detection nil t) + 'kill-buffer-hook #'context-coloring-teardown-idle-change-detection nil t) (setq context-coloring-colorize-idle-timer (run-with-idle-timer (or (plist-get dispatch :delay) context-coloring-default-delay) t - 'context-coloring-maybe-colorize + #'context-coloring-maybe-colorize (current-buffer))))) (defun context-coloring-teardown-idle-change-detection () @@ -194,9 +194,9 @@ Supported modes: `js-mode', `js3-mode'" (when context-coloring-colorize-idle-timer (cancel-timer context-coloring-colorize-idle-timer)) (remove-hook - 'kill-buffer-hook 'context-coloring-teardown-idle-change-detection t) + 'kill-buffer-hook #'context-coloring-teardown-idle-change-detection t) (remove-hook - 'after-change-functions 'context-coloring-change-function t)) + 'after-change-functions #'context-coloring-change-function t)) ;;; Colorization utilities @@ -243,10 +243,10 @@ the END point (exclusive) with the face corresponding to LEVEL." (cond ((and context-coloring-syntactic-comments (not context-coloring-syntactic-strings)) - 'context-coloring-font-lock-syntactic-comment-function) + #'context-coloring-font-lock-syntactic-comment-function) ((and context-coloring-syntactic-strings (not context-coloring-syntactic-comments)) - 'context-coloring-font-lock-syntactic-string-function) + #'context-coloring-font-lock-syntactic-string-function) (t font-lock-syntactic-face-function)))) (save-excursion @@ -323,7 +323,7 @@ variable." "Color the current buffer using the abstract syntax tree generated by `js2-mode'." ;; Reset the hash table; the old one could be obsolete. - (setq context-coloring-js2-scope-level-hash-table (make-hash-table :test 'eq)) + (setq context-coloring-js2-scope-level-hash-table (make-hash-table :test #'eq)) (setq context-coloring-point-max (point-max)) (with-silent-modifications (js2-visit-ast @@ -386,7 +386,7 @@ the way." (defsubst context-coloring-exact-or-regexp (words) "Create a regexp that matches any exact word in WORDS." (context-coloring-join - (mapcar 'context-coloring-exact-regexp words) "\\|")) + (mapcar #'context-coloring-exact-regexp words) "\\|")) (defconst context-coloring-elisp-defun-regexp (context-coloring-exact-or-regexp @@ -926,7 +926,7 @@ scopes and variables." the current buffer. Tokens are 3 integers: start, end, level. A new token occurrs after every 3rd element, and the elements are separated by commas." - (let* ((tokens (mapcar 'string-to-number (split-string tokens ",")))) + (let* ((tokens (mapcar #'string-to-number (split-string tokens ",")))) (while tokens (context-coloring-colorize-region (pop tokens) @@ -1089,11 +1089,11 @@ Invoke CALLBACK when complete." ;;; Dispatch -(defvar context-coloring-dispatch-hash-table (make-hash-table :test 'eq) +(defvar context-coloring-dispatch-hash-table (make-hash-table :test #'eq) "Map dispatch strategy names to their corresponding property lists, which contain details about the strategies.") -(defvar context-coloring-mode-hash-table (make-hash-table :test 'eq) +(defvar context-coloring-mode-hash-table (make-hash-table :test #'eq) "Map major mode names to dispatch property lists.") (defun context-coloring-get-dispatch-for-mode (mode) @@ -1232,7 +1232,7 @@ version number required for the current major mode." ;;; Themes -(defvar context-coloring-theme-hash-table (make-hash-table :test 'eq) +(defvar context-coloring-theme-hash-table (make-hash-table :test #'eq) "Map theme names to theme properties.") (defun context-coloring-theme-p (theme) @@ -1244,7 +1244,7 @@ version number required for the current major mode." "Extract a level from a face.") (defvar context-coloring-originally-set-theme-hash-table - (make-hash-table :test 'eq) + (make-hash-table :test #'eq) "Cache custom themes who originally set their own `context-coloring-level-N-face' faces.") @@ -1323,7 +1323,7 @@ which must already exist and which *should* already be enabled." (when (custom-theme-enabled-p theme) (setq context-coloring-maximum-face (- (length colors) 1))) (apply - 'custom-theme-set-faces + #'custom-theme-set-faces theme (mapcar (lambda (color) @@ -1586,21 +1586,21 @@ precedence, i.e. the car of `custom-enabled-themes'." (context-coloring-define-dispatch 'javascript-js2 :modes '(js2-mode) - :colorizer 'context-coloring-js2-colorize + :colorizer #'context-coloring-js2-colorize :setup (lambda () - (add-hook 'js2-post-parse-callbacks 'context-coloring-colorize nil t)) + (add-hook 'js2-post-parse-callbacks #'context-coloring-colorize nil t)) :teardown (lambda () - (remove-hook 'js2-post-parse-callbacks 'context-coloring-colorize t))) + (remove-hook 'js2-post-parse-callbacks #'context-coloring-colorize t))) (context-coloring-define-dispatch 'emacs-lisp :modes '(emacs-lisp-mode) - :colorizer 'context-coloring-elisp-colorize + :colorizer #'context-coloring-elisp-colorize :delay 0.016 ;; Thanks to lazy colorization this can be 60 frames per second. - :setup 'context-coloring-setup-idle-change-detection - :teardown 'context-coloring-teardown-idle-change-detection) + :setup #'context-coloring-setup-idle-change-detection + :teardown #'context-coloring-teardown-idle-change-detection) (defun context-coloring-dispatch (&optional callback) "Determine the optimal track for scopification / coloring of @@ -1656,7 +1656,7 @@ elisp tracks, and asynchronously for shell command tracks." ;; ...but we do use font-lock functions here. (font-lock-set-defaults) - ;; Safely change the valye of this function as necessary. + ;; Safely change the value of this function as necessary. (make-local-variable 'font-lock-syntactic-face-function) (let ((dispatch (context-coloring-get-dispatch-for-mode major-mode))) diff --git a/test/context-coloring-coverage.el b/test/context-coloring-coverage.el index b18f8ad..cbd1e47 100644 --- a/test/context-coloring-coverage.el +++ b/test/context-coloring-coverage.el @@ -53,7 +53,7 @@ (defun context-coloring-coverage-join (strings delimiter) "Join a list of STRINGS with the string DELIMITER." - (mapconcat 'identity strings delimiter)) + (mapconcat #'identity strings delimiter)) (defun context-coloring-coverage-percentage (dividend divisor) "Get the percentage of DIVIDEND / DIVISOR with precision 2." @@ -109,7 +109,7 @@ "Generate reports for all files in COVERAGE-DATA." (context-coloring-coverage-join (mapcar - 'context-coloring-coverage-format-source-file + #'context-coloring-coverage-format-source-file (cdr (assq 'source_files coverage-data))) "\n")) diff --git a/test/context-coloring-test.el b/test/context-coloring-test.el index e6e6a59..8e95219 100644 --- a/test/context-coloring-test.el +++ b/test/context-coloring-test.el @@ -199,21 +199,21 @@ override it." (when ,after-each (apply ,after-each ,args)))))))))))))) (context-coloring-test-define-deftest nil - :mode 'fundamental-mode + :mode #'fundamental-mode :no-fixture t) (context-coloring-test-define-deftest async - :mode 'fundamental-mode + :mode #'fundamental-mode :no-fixture t :async t) (context-coloring-test-define-deftest js - :mode 'js-mode + :mode #'js-mode :extension "js" :post-colorization t) (context-coloring-test-define-deftest js2 - :mode 'js2-mode + :mode #'js2-mode :extension "js" :enable-context-coloring-mode t :before-each (lambda () @@ -228,12 +228,12 @@ override it." (context-coloring-test-deftest-js2 ,@args))) (context-coloring-test-define-deftest emacs-lisp - :mode 'emacs-lisp-mode + :mode #'emacs-lisp-mode :extension "el" :enable-context-coloring-mode t) (context-coloring-test-define-deftest define-theme - :mode 'fundamental-mode + :mode #'fundamental-mode :no-fixture t :get-args (lambda () (list (context-coloring-test-get-next-theme))) @@ -500,7 +500,7 @@ is FOREGROUND, or the inverse if NEGATE is non-nil." "but it didn't") level))) (setq actual-foreground (face-attribute face :foreground)) - (when (funcall (if negate 'identity 'not) + (when (funcall (if negate #'identity #'not) (string-equal foreground actual-foreground)) (ert-fail (format (concat "Expected face for level `%s' " "%sto have foreground `%s'; " @@ -514,7 +514,7 @@ is FOREGROUND, or the inverse if NEGATE is non-nil." "Assert that LEVEL does not have a face with `:foreground' FOREGROUND. Apply ARGUMENTS to `context-coloring-test-assert-face', see that function." - (apply 'context-coloring-test-assert-face + (apply #'context-coloring-test-assert-face (append arguments '(t)))) (defun context-coloring-test-assert-theme-originally-set-p @@ -524,7 +524,7 @@ t for a theme with SETTINGS, or the inverse if NEGATE is non-nil." (let ((theme (context-coloring-test-get-next-theme))) (put theme 'theme-settings settings) - (when (funcall (if negate 'identity 'not) + (when (funcall (if negate #'identity #'not) (context-coloring-theme-originally-set-p theme)) (ert-fail (format (concat "Expected theme `%s' with settings `%s' " "%sto be considered to have defined a level, " @@ -538,7 +538,7 @@ non-nil." return t for a theme with SETTINGS. Apply ARGUMENTS to `context-coloring-test-assert-theme-originally-set-p', see that function." - (apply 'context-coloring-test-assert-theme-originally-set-p + (apply #'context-coloring-test-assert-theme-originally-set-p (append arguments '(t)))) (context-coloring-test-deftest theme-originally-set-p @@ -567,7 +567,7 @@ EXPECTED-LEVEL." "Assert that THEME has the highest level EXPECTED-LEVEL, or the inverse if NEGATE is non-nil." (let ((highest-level (context-coloring-theme-highest-level theme))) - (when (funcall (if negate 'identity 'not) (eq highest-level expected-level)) + (when (funcall (if negate #'identity #'not) (eq highest-level expected-level)) (ert-fail (format (concat "Expected theme with settings `%s' " "%sto have a highest level of `%s', " "but it %s.") @@ -580,7 +580,7 @@ inverse if NEGATE is non-nil." Apply ARGUMENTS to `context-coloring-test-assert-theme-highest-level', see that function." - (apply 'context-coloring-test-assert-theme-highest-level + (apply #'context-coloring-test-assert-theme-highest-level (append arguments '(t)))) (context-coloring-test-deftest theme-highest-level @@ -774,7 +774,7 @@ theme THEME is signaled." (defun context-coloring-test-assert-maximum-face (maximum &optional negate) "Assert that `context-coloring-maximum-face' is MAXIMUM, or the inverse if NEGATE is non-nil." - (when (funcall (if negate 'identity 'not) + (when (funcall (if negate #'identity #'not) (eq context-coloring-maximum-face maximum)) (ert-fail (format (concat "Expected `context-coloring-maximum-face' " "%sto be `%s', " @@ -788,7 +788,7 @@ inverse if NEGATE is non-nil." "Assert that `context-coloring-maximum-face' is not MAXIMUM. Apply ARGUMENTS to `context-coloring-test-assert-maximum-face', see that function." - (apply 'context-coloring-test-assert-maximum-face + (apply #'context-coloring-test-assert-maximum-face (append arguments '(t)))) (context-coloring-test-deftest-define-theme disable-cascade