branch: externals/beardbolt
commit ed99686703b3c611435bc7d2ab01c04817ddcf87
Author: João Távora <[email protected]>
Commit: João Távora <[email protected]>
Handle TTYs with unknown background color
---
beardbolt.el | 17 +++++++----------
1 file changed, 7 insertions(+), 10 deletions(-)
diff --git a/beardbolt.el b/beardbolt.el
index 6254097bf3..a994ae4d1d 100644
--- a/beardbolt.el
+++ b/beardbolt.el
@@ -491,14 +491,16 @@ Returns a list (SPEC ...) where SPEC looks like (WHAT FN
CMD)."
((match bb-endblock) (setq reachable-label nil)))
(bb--demangle-overlays demangle-ovs))))
-(defun bb--rainbowize (line-mappings src-buffer)
+(cl-defun bb--rainbowize (line-mappings src-buffer)
(let* ((background-hsl
- (apply #'color-rgb-to-hsl (color-name-to-rgb (face-background
'default))))
+ (ignore-errors
+ (apply #'color-rgb-to-hsl (color-name-to-rgb (face-background
'default)))))
all-ovs
(idx 0)
;; The 1+ helps us keep our hue distance from the actual
;; background color
(total (1+ (hash-table-count line-mappings))))
+ (unless background-hsl (cl-return-from bb--rainbowize nil))
(maphash
(lambda (src-line asm-regions)
(when (not (zerop src-line))
@@ -661,9 +663,9 @@ Interactively, determine LANG from `major-mode'."
(cl-letf (((symbol-function 'hack-local-variables-confirm)
(lambda (_all-vars unsafe-vars risky-vars &rest _)
(when unsafe-vars
- (error "[beardbolt] Some variables unsafe %s" unsafe-vars))
+ (message "[beardbolt] Some variables unsafe %s" unsafe-vars))
(when risky-vars
- (error "[beardbolt] Some variables risky %s" risky-vars)))))
+ (message "[beardbolt] Some variables risky %s" risky-vars)))))
(hack-local-variables))
(let* ((dump-file
(let ((inhibit-message t))
@@ -688,12 +690,7 @@ Interactively, determine LANG from `major-mode'."
(setq-local compilation-skip-threshold 2)
(setq-local compilation-always-kill t)
(setq-local inhibit-message t)
- (add-hook 'compilation-finish-functions
- #'(lambda (&rest whatever)
- (let ((inhibit-message nil))
- (benchmark-progn
- (apply #'bb--handle-finish-compile whatever))))
- nil t)
+ (add-hook 'compilation-finish-functions #'bb--handle-finish-compile nil
t)
(setq bb--source-buffer src-buffer)
(setq bb--compile-spec spec)
(setq bb--dump-file dump-file)