|
97 | 97 | (ansi-color-map (ansi-color-make-color-map)))
|
98 | 98 | ,@body))
|
99 | 99 |
|
| 100 | +(defmacro text-property-make (foreground-color &optional style) |
| 101 | + "Return FOREGROUND-COLOR and STYLE as a text property list." |
| 102 | + (if (< emacs-major-version 28) |
| 103 | + (if style |
| 104 | + `(quote ((foreground-color . ,foreground-color) ,style)) |
| 105 | + `(quote (foreground-color . ,foreground-color))) |
| 106 | + (if style |
| 107 | + `(quote (,(intern (concat "ansi-color-" (symbol-name style))) |
| 108 | + (:foreground ,foreground-color))) |
| 109 | + `(quote (:foreground ,foreground-color))))) |
| 110 | + |
100 | 111 | (describe "multiple calls to cider-repl--emit-output"
|
101 | 112 | (it "Multiple emit output calls set properties and emit text"
|
102 | 113 | (with-temp-buffer
|
|
136 | 147 | (expect (buffer-substring-no-properties (point-min) (point-max))
|
137 | 148 | :to-equal "a\nb\nc\nd\ne\nf\ng\nh\ni\nj\n")
|
138 | 149 | (expect (get-text-property 1 'font-lock-face)
|
139 |
| - :to-equal '(foreground-color . "black")) |
| 150 | + :to-equal (text-property-make "black")) |
140 | 151 | (expect (get-text-property 3 'font-lock-face)
|
141 | 152 | :to-equal 'cider-repl-stdout-face)
|
142 | 153 | (expect (get-text-property 5 'font-lock-face)
|
143 |
| - :to-equal '(foreground-color . "red3")) |
| 154 | + :to-equal (text-property-make "red3")) |
144 | 155 | (expect (get-text-property 7 'font-lock-face)
|
145 |
| - :to-equal '(foreground-color . "green3")) |
| 156 | + :to-equal (text-property-make "green3")) |
146 | 157 | (expect (get-text-property 9 'font-lock-face)
|
147 |
| - :to-equal '(foreground-color . "yellow3")) |
| 158 | + :to-equal (text-property-make "yellow3")) |
148 | 159 | (expect (get-text-property 11 'font-lock-face)
|
149 |
| - :to-equal '(foreground-color . "red3")) |
| 160 | + :to-equal (text-property-make "red3")) |
150 | 161 | (expect (get-text-property 13 'font-lock-face)
|
151 |
| - :to-equal '(foreground-color . "green3")) |
| 162 | + :to-equal (text-property-make "green3")) |
152 | 163 | (expect (get-text-property 15 'font-lock-face)
|
153 |
| - :to-equal '((foreground-color . "yellow3") bold)) |
| 164 | + :to-equal (text-property-make "yellow3" bold)) |
154 | 165 | (expect (get-text-property 17 'font-lock-face)
|
155 |
| - :to-equal '(foreground-color . "red3")) |
| 166 | + :to-equal (text-property-make "red3")) |
156 | 167 | (expect (get-text-property 19 'font-lock-face)
|
157 |
| - :to-equal '((foreground-color . "green3") italic)) |
| 168 | + :to-equal (text-property-make "green3" italic)) |
158 | 169 | ))))
|
159 | 170 |
|
160 | 171 | (defun simulate-cider-output (s property)
|
|
0 commit comments