Sometimes a lexer may need to handle notifications from Scintilla and it may also need to know which instance should be handling a particular notification. For example, a lexer that manages function names in a buffer wants to handle SCN_MODIFIED notification so it can properly update its managed function name list. Surprisingly, in current Notepad++ it is impossible for a lexer to know which lexer instance triggered the notification. Scintilla's notification doesn't contain lexer instance info, and it also doesn't work for lexer to try to cache NPP's buffer ID in Lex() method, since when Lex is called, it may be happening on a different view instead of NPP's active view.
The suggestion is to introduce a new message (e.g. NPPM_GETBUFFERIDFROMLEXER) so a lexer instance can use its own "this" pointer to query the buffer ID that is currently being lexed by it,