Hi Jean-François
On 2015-07-06 Monday at 14:16 -0700 Jean-François Bignolles wrote: > Using different languages, I remarked that the "Todo" system (highlighting > of special words inside comments) was currently a bit chaotic: some keywords > are highlighted for one syntax, but not for an another one. > > (I won't talk here of syntax files which doesn't support this at all, syntax > files which have special needs, i.e. "syntax match" / "syntax region", etc.) > > Out of curiosity, I searched all the (uniques) lists of "Todo" keywords; > currently there are about 40 (!) different variants: > > TODO > TODO BUG FIX > TODO BUG FIXME HACK REFACTOR REVIEW TEMP XXX > TODO COMBAK DEBUG FIXME XXX > TODO COMBAK FIXME XXX > TODO DEBUG FIXME NOTE XXX > TODO FIXME > TODO FIXME DEBUG NOTE XXX > TODO FIXME NOT XXX > TODO FIXME NOTE > TODO FIXME NOTE NOTES XXX > TODO FIXME NOTE OPTIMIZE XXX > TODO FIXME NOTE XXX > TODO FIXME REVIEW TBD XXX[XXXXX] > TODO FIXME TBD > TODO FIXME TBD XXX > TODO FIXME XXX > TODO FIXME XXX[XXXXX] > TODO NOTE XXX > TODO TODO: FIXME FIXME: NOTE NOTE: TBD TBD: XXX XXX: > TODO Todo COMBAK DEBUG FIXME XXX > TODO Todo DEBUG > TODO Todo todo > TODO XXX > TODO XXX FIXME > TODO XXX FIXME BUG > TODO display FIXME XXX > TODO lout Lout LOUT > TODO todo FIXME NOTE OPTIMIZE XXX > TODO todo FIXME fixme TBD tbd > Todo > todo > todo todo: combak combak: > todo combak fixme xxx > todo attention note fixme readme > todo fixme > todo fixme bugbug todo: bugbug: note: > todo fixme xxx > todo test > > The problem is that each syntax file contains the hard-coded preferences > of its author. > > However the end user may want to have some keywords added to the "Todo" > list, to have some other keywords removed, or may even want to have the "Todo" > system completely switched off! And above all, the end user probably wants > the same "Todo" list for whatever syntax he uses! > > Of course one can take a Vim syntax file, tweak it for his own needs, > and drop it into his personal configuration directory. But it's a bit > radical when few lines must be changed! > > To solve this, just for simple cases where a "syntax keyword" is used > (around 240 syntax files), the proposal is: > > - to let the user defines its list of "Todo" matches, using a > Vim-standardized global variable; for instance: > > let g:todo_keywords = 'Todo FIX MyTodo' > > - to update Vim documentation (mostly "syntax.txt" and "user_44.txt") > to replace hard-coded "Todo", explain the usage of the variable, etc. > > - modify syntax files to use this variable (and do nothing when > undefined) to build syntax commands. Taking "c.vim" as an example > of adaptation: > > " ........ Original .............................................. > syn keyword cTodo contained TODO FIXME XXX > > " [...] > > " cCommentGroup allows adding matches for special things in comments > syn cluster cCommentGroup contains=cTodo,cBadContinuation > > " ........ New version ........................................... > > " cCommentGroup allows adding matches for special things in comments > syn cluster cCommentGroup contains=cBadContinuation > > if exists ('g:todo_keywords') > exe 'syntax keyword cTodo contained ' g:todo_keywords > syn cluster cCommentGroup add=cTodo > endif > > Note that some syntax files (sinda, tak, trasys) already allows the user > user to define its own list of "Todo" keywords. However the variable name > ("thermal_todo") isn't too generic! > > The proposal involves small changes to a lot of files. I've started > to test this with some syntax file (c, tcl, vhdl) and seen no problem. > > Other remark: sometimes the "contained" keyword isn't used to declare "Todo" > lists; I'm not sure it's needed or not, but here's the list of syntax files: > arch, cdrdaoconf, falcon, initex, lace, modconf, nsis, pli, > plsql, sqlinformix, stp Many thanks for your contribution! Your concept looks to me (1) reasonable (2) reusable: • for other popular keywords, e.g. “Note” which I would keep separate from “Todo”, because the former may be just a hint to avoid reintroduction of an already fixed bug, whereas the latter mostly regards to not yet fixed bugs or scheduled or considered improvements • Maybe automatic update of timestamps could be generalized similarly [1] (3) valuable: yields benefits for all three groups: users, maintainers, developers Just my humble subjective opinion, to encourage your work. [1] See my separate mail “Proposal: Generalization of automatic update of timestamps in lines like "Last Change: 2015-07-07"”. -- Best regards, Roland Eggner -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
pgpqrnxJiooo1.pgp
Description: PGP signature