I want to the prettify-symbols-mode
functionality, but using strings instead of chars as visual replacements:
;; typical replacement for chars
(push '("lambda" . ?λ) prettify-symbols-alist)
(defun my/add-visual-replacement (whatwith)
;; answer to my question
;; maybe do something with `prettify-symbols-alist'
)
;; usage
(with-current-buffer "micódigo.py"
(my/add-visual-replacement '("print" . "imprime")))
so, with cursor outside of the replacement, shows the string replacement:
def mifunción():
mivariable=1█
imprime(mivariable)
But will show the true string when the cursor is on it:
def mifunción():
mivariable=1
█rint(mivariable)
Best approach that I'm trying to understand is using reference-point-alist
(as was done here), but I don't fully understand it.