diff options
| -rw-r--r-- | tests/test-wttrin-smoke.el | 4 | ||||
| -rw-r--r-- | wttrin.el | 6 |
2 files changed, 7 insertions, 3 deletions
diff --git a/tests/test-wttrin-smoke.el b/tests/test-wttrin-smoke.el index 5cb4b08..acf7fd5 100644 --- a/tests/test-wttrin-smoke.el +++ b/tests/test-wttrin-smoke.el @@ -33,9 +33,9 @@ If we got here, the package loaded successfully via (require 'wttrin)." ;;; Dependency Tests (ert-deftest test-wttrin-smoke-xterm-color-available () - "Test that xterm-color dependency is available. + "Test that xterm-color dependency can be loaded when needed. This is a REQUIRED dependency - wttrin cannot function without it." - (should (featurep 'xterm-color))) + (should (require 'xterm-color nil t))) (ert-deftest test-wttrin-smoke-url-available () "Test that url library is available (built-in)." @@ -35,7 +35,9 @@ (require 'face-remap) (require 'url) -(require 'xterm-color) ;; https://github.com/atomontage/xterm-color + +;; Declare xterm-color functions (loaded on-demand) +(declare-function xterm-color-filter "xterm-color" (string)) ;; Declare functions from wttrin-debug.el (loaded conditionally) (declare-function wttrin--debug-mode-line-info "wttrin-debug") @@ -314,6 +316,7 @@ Return t if valid, nil if missing or contains errors." (defun wttrin--process-weather-content (raw-string) "Process RAW-STRING: apply ANSI filtering and remove verbose lines. Returns processed string ready for display." + (require 'xterm-color) (let ((processed (xterm-color-filter raw-string))) ;; Remove verbose Location: coordinate line (with-temp-buffer @@ -347,6 +350,7 @@ Returns processed string ready for display." (let ((inhibit-read-only t)) (erase-buffer) ;; Initialize xterm-color state AFTER wttrin-mode to prevent it being wiped + (require 'xterm-color) (setq-local xterm-color--state :char) (insert (wttrin--process-weather-content raw-string)) (wttrin--add-buffer-instructions) |
