Skip to content

Instantly share code, notes, and snippets.

@MelleB
Last active May 19, 2016 09:15
Show Gist options
  • Save MelleB/920ad8e6c9d68a50b0670f72d324b284 to your computer and use it in GitHub Desktop.
Save MelleB/920ad8e6c9d68a50b0670f72d324b284 to your computer and use it in GitHub Desktop.
Change background color of python class and function definitions in Emacs
(font-lock-add-keywords 'python-mode
'(("^\s*\\(def\s*\\)\\(.*\\)\\((.*):.*\xa\\)"
(1 '(:inherit 'font-lock-keyword-face :background "#F3F3F3"))
(2 '(:inherit 'font-lock-function-name-face :background "#F3F3F3" :weight bold))
(3 '(:background "#F3F3F3"))
)
("^\s*\\(class\s*\\)\\(.*\\)\\((.*):.*\xa\\)"
(1 '(:inherit 'font-lock-keyword-face :background "#EEEEEE" :height 1.4))
(2 '(:inherit 'font-lock-function-name-face :background "#EEEEEE" :height 1.4 :weight bold))
(3 '(:background "#EEEEEE" :height 1.4))
)
))
@MelleB
Copy link
Author

MelleB commented May 19, 2016

example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment