"Run the next test in LIST by calling CONTINUE. When LIST is
exhausted, call STOP instead."
(if (null list)
- (context-coloring-benchmark-next-tick stop)
+ (progn
+ (context-coloring-benchmark-next-tick stop))
(context-coloring-benchmark-next-tick
(lambda ()
(funcall
(find-file fixture)))
(lambda ()
(funcall teardown)
- (if callback (funcall callback))))))
+ (when callback (funcall callback))))))
(defconst context-coloring-benchmark-js-fixtures
'("./fixtures/jquery-2.1.1.js"
(with-current-buffer buffer
(context-coloring-apply-tokens tokens))
(setq context-coloring-scopifier-process nil)
- (if callback (funcall callback)))))))
+ (when callback (funcall callback)))))))
;; Give the process its input so it can begin.
(process-send-region
Invokes CALLBACK when complete. It is invoked synchronously for
elisp tracks, and asynchronously for shell command tracks."
(let ((dispatch (gethash major-mode context-coloring-mode-hash-table)))
- (if (null dispatch)
- (message "%s" "Context coloring is not available for this major mode"))
+ (when (null dispatch)
+ (message "%s" "Context coloring is not available for this major mode"))
(let (colorizer
scopifier
command
(cond
((setq colorizer (plist-get dispatch :colorizer))
(funcall colorizer)
- (if callback (funcall callback)))
+ (when callback (funcall callback)))
((setq scopifier (plist-get dispatch :scopifier))
(context-coloring-apply-tokens (funcall scopifier))
- (if callback (funcall callback)))
+ (when callback (funcall callback)))
((setq command (plist-get dispatch :command))
(setq executable (plist-get dispatch :executable))
(if (and executable
(null (executable-find executable)))
- (message "Executable \"%s\" not found" executable)
+ (progn
+ (message "Executable \"%s\" not found" executable))
(context-coloring-scopify-shell-command command callback)))))))
(lambda ()
(when context-coloring-benchmark-colorization
(message "Colorization took %.3f seconds" (- (float-time) start-time)))
- (if callback (funcall callback))))))
+ (when callback (funcall callback))))))
(defun context-coloring-change-function (_start _end _length)
"Registers a change so that a buffer can be colorized soon."
(when (custom-theme-p theme) ; Guard against non-existent themes.
(let ((enabled-theme (car custom-enabled-themes)))
(if (context-coloring-theme-p enabled-theme)
- (context-coloring-enable-theme enabled-theme)
+ (progn
+ (context-coloring-enable-theme enabled-theme))
;; Assume we are back to no theme; act as if nothing ever happened.
;; This is still prone to intervention, but rather extraordinarily.
(setq context-coloring-maximum-face
(context-coloring-test-with-temp-buffer-async
(lambda (done-with-temp-buffer)
(context-coloring-test-setup)
- (if setup (funcall setup))
+ (when setup (funcall setup))
(insert (context-coloring-test-read-file fixture))
(funcall
callback
(defun context-coloring-test-kill-buffer (buffer)
"Kill BUFFER if it exists."
- (if (get-buffer buffer) (kill-buffer buffer)))
+ (when (get-buffer buffer) (kill-buffer buffer)))
(defun context-coloring-test-assert-face (level foreground &optional negate)
"Assert that a face for LEVEL exists and that its `:foreground'