Advertisement
Guest User

Untitled

a guest
May 28th, 2015
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.15 KB | None | 0 0
  1. (setq rainbow-identifiers-faces-to-override (default font-lock-variable-name-face))
  2.  
  3. (defun rainbow-identifiers-face-overridable (begin end)
  4. "Test if all the faces under the identifier are overridable."
  5. (let ((current begin)
  6. (contains-non-default nil))
  7. (catch 'rainbow-identifiers--face-overridable
  8. (while (progn
  9. (let ((face (get-text-property current 'face)))
  10. ; In PHP function names have no style
  11. (if (not (or (eq face 'default) (null face))) (setq contains-non-default t))
  12. (cond
  13. ((null face)
  14. t)
  15. ((listp face)
  16. (dolist (face* face)
  17. (unless (memq face* rainbow-identifiers-faces-to-override)
  18. (throw 'rainbow-identifiers--face-overridable nil))))
  19. (t
  20. (unless (memq face rainbow-identifiers-faces-to-override)
  21. (throw 'rainbow-identifiers--face-overridable nil)))))
  22. (setq current (next-single-property-change current 'face nil end))
  23. (not (eq current end))))
  24. contains-non-default)))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement