leoliu / ggtags

Emacs frontend to GNU Global source code tagging system.
http://elpa.gnu.org
577 stars 56 forks source link

`ggtags-fontify-code` should be called optionally #216

Open ooglyhLL opened 2 years ago

ooglyhLL commented 2 years ago

Some may prefer no highlighting at all. Also, some modes require (significantly) more context for proper highlighting than just a single line[1]. What about a variable to configure the behaviour? Something along these lines:

ggtags-maybe-fontify-code: t: Fontify if the code buffer has font-lock-mode switched on. nil: Force off

[1] I guess loading the entire file into a temporary buffer, highlighting and extracting the string with text properties might be too expensive in case of large files.

leoliu commented 2 years ago

The plan originally was for people to use (add-function (local 'ggtags-get-definition-function) ...) to override the default. Alternatively you can defalias ggtags-fontify-code to identity.

ooglyhLL commented 2 years ago

Yeah that would work, thanks. I guess having a switch for the default implementation won't hurt though.