I am trying to write an elisp function that marks a Python test function as green or red depending on the input. The arguments are pretty clear. The navigation part works, but the part put-text-propertyjust does nothing. I tried evalusing functions match-*, but I cannot figure out the return values. They also seem to return different things depending on which buffer I'm evalin.
The main meaning of this is borrowed from the corresponding part of rainbow-mode.el , and there it works flawlessly.
What happened to the challenge put-text-property? Is there anything that I can do to debug this and learn more?
(defun snake-decorate-test (file class func status)
; FIXME: Path hardcoded while developing.
(find-file (format "/home/thiderman/git/piper/%s" file))
(beginning-of-buffer)
(re-search-forward (format "^class %s(" class) nil t)
(re-search-forward (format "^ def \\(%s\\)(" func) nil t)
(put-text-property
(match-beginning 1) (match-end 1)
'face `((:background ,(if (s-equals? status ".")
"#007200" "#720000")))))```
source
share