(defun pretty-add-keywords (mode keywords)
(font-lock-add-keywords
mode (mapcar (lambda (kw) `(,(car kw)
(0 (prog1 nil
(compose-region (match-beginning 0)
(match-end 0)
,(cdr kw))))))
keywords)))
This function currently lets me match a regexp and replace it with a single char. I've been trying to modify it so that instead of just replacing it with a fixed char it replaces it with a group from the regex.
Would anybody be able to help me out.
Thanks
array[x]
I would want to be able to replace (visually) that with justx
. I know font lock uses regexps internally but I haven't found a way to access the groups. – Wolfe Oct 27 '16 at 18:56