aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--modules/system-utils.el31
-rw-r--r--tests/test-system-utils-scratch-background.el30
2 files changed, 2 insertions, 59 deletions
diff --git a/modules/system-utils.el b/modules/system-utils.el
index b3e038ef0..7cf958674 100644
--- a/modules/system-utils.el
+++ b/modules/system-utils.el
@@ -157,39 +157,12 @@ detached from Emacs."
;; Set scratch buffer to org-mode
(setopt initial-major-mode 'org-mode)
-;; Tint the *scratch* background a shade lighter than the default so it reads
-;; as the scratch buffer at a glance. Buffer-local face remap, recomputed from
-;; whatever theme is loaded.
-(require 'color)
-
-(defcustom cj/scratch-background-lighten 5
- "Percent to lighten the *scratch* background above the default background.
-Aesthetic; tune to taste."
- :type 'integer
- :group 'convenience)
-
-(defun cj/--scratch-lightened-background (bg)
- "Return BG lightened by `cj/scratch-background-lighten' percent.
-Return nil when BG is not a usable color string (e.g. `unspecified')."
- (when (and (stringp bg) (color-name-to-rgb bg))
- (color-lighten-name bg cj/scratch-background-lighten)))
-
-(defun cj/scratch-apply-background ()
- "Remap the *scratch* buffer background a shade lighter than the default."
- (when (get-buffer "*scratch*")
- (with-current-buffer "*scratch*"
- (let ((lighter (cj/--scratch-lightened-background
- (face-attribute 'default :background nil t))))
- (when lighter
- (face-remap-add-relative 'default :background lighter))))))
-
-;; Move cursor to end of scratch buffer on startup, and tint its background
+;; Move cursor to end of scratch buffer on startup
(add-hook 'emacs-startup-hook
(lambda ()
(when (get-buffer "*scratch*")
(with-current-buffer "*scratch*"
- (goto-char (point-max))))
- (cj/scratch-apply-background)))
+ (goto-char (point-max))))))
;;; --------------------------------- Dictionary --------------------------------
diff --git a/tests/test-system-utils-scratch-background.el b/tests/test-system-utils-scratch-background.el
deleted file mode 100644
index 422590f4b..000000000
--- a/tests/test-system-utils-scratch-background.el
+++ /dev/null
@@ -1,30 +0,0 @@
-;;; test-system-utils-scratch-background.el --- Tests for the scratch tint -*- lexical-binding: t; -*-
-
-;;; Commentary:
-;; cj/--scratch-lightened-background lightens the default background by a
-;; tunable percent for the *scratch* buffer's buffer-local face remap. The
-;; colour arithmetic (color-lighten-name -> color-name-to-rgb) is
-;; display-dependent and returns zeros under --batch, so the actual lightening
-;; is verified live in the daemon; here we cover the display-independent
-;; contract: a usable colour string yields a string, junk yields nil.
-
-;;; Code:
-
-(require 'ert)
-(require 'color)
-(add-to-list 'load-path (expand-file-name "modules" user-emacs-directory))
-(require 'system-utils)
-
-(ert-deftest test-system-utils-scratch-lightened-background-returns-string ()
- "Normal: a valid hex colour yields a colour string (not nil)."
- (let ((cj/scratch-background-lighten 5))
- (should (stringp (cj/--scratch-lightened-background "#100f0f")))))
-
-(ert-deftest test-system-utils-scratch-lightened-background-bad-input ()
- "Error: non-colour input yields nil rather than signalling."
- (should (null (cj/--scratch-lightened-background nil)))
- (should (null (cj/--scratch-lightened-background 'unspecified)))
- (should (null (cj/--scratch-lightened-background "not-a-color"))))
-
-(provide 'test-system-utils-scratch-background)
-;;; test-system-utils-scratch-background.el ends here