rolandwalker / button-lock

clickable text in Emacs
42 stars 6 forks source link

Priority over other faces? #14

Open actondev opened 4 years ago

actondev commented 4 years ago

First of thanks for this extension, really glad that I stumbled upon this!

I have an issue when defining buttons in org-mode. If the button's regexp text is in plain text, it works fine. However if it's inside some block that has custom highligting (let's say inside a table) the normal face doesn't work - only the :mouse-face

image

actondev commented 4 years ago

Hi, I found the solution (at least it's working - not doing a PR cause I don't really get what happens with font-lock)

in button-lock-add-to-button-list adding a 3rd argument to the font-lock-add-keywords that evaluates to true

eg (font-lock-add-keywords nil (list button) 'how-add-to-end)

cause


(defun font-lock-add-keywords (mode keywords &optional how)

"...
If HOW is any other non-nil value, they are added at the
end of the current highlighting list."

And the :face-policy 'prepend needs to be there as well, if not this doesn't work

rolandwalker commented 4 years ago

Hi! It's hard to coexist with org-mode, since it does so much.

It seems like the font-lock-add-keywords behavior could be controlled by a new property.