2010/6/11 Barry Warsaw <ba...@python.org>: > On May 30, 2010, at 02:20 AM, Micah wrote: > >>I'm shifting from a perl and java coding environment to a python and django >>(templates) world (along with a fair bit of css, js, etc) and I'm trying to >>push, shove, coerce as best I can my background of an emacs user (let me >>emphatically state, I've always been a user of emacs/elisp, never a hacker). >>I'm using GNU emacs, not only that I'm now trying to use the super-easy >>http://emacsformacosx.com/ version (23.2) and python-mode.el (5.1.0 from >>https://launchpad.net/python-mode). >> >>My problem: while I've gotten python-mode.el to work, I can't get all syntax >>highlighting to work, most particular variable highlighting. I have >>christmas tree mode on. If I disable python-mode, I get the (what I >>consider) inferior highlighting from python.el working, but the tabbing in >>that mode is awful. >> >>I'm very confused, and have spent way too much time crawling the web for an >>answer. If you guys have any easy clues, I'd gladly take them. > > I'm not sure python-mode.el actually provides variable syntax highlighting. I > don't have it turned on and I don't see in the code where that's supported, > but I could have missed something (it's Friday after all :). > > I see this in python.el: > > ;; Top-level assignments are worth highlighting. > (,(rx line-start (group (1+ (or word ?_))) (0+ space) "=") > (1 font-lock-variable-name-face)) > > Maybe some elisp hacker would like to add support for this into > python-mode.el? >
That regular expression only matches (non-augmented) top-level variable assignment statements. It's also a legible regular expression - silly to say the least! This regex should be better: "^ *\\([a-zA-Z0-9_]+\\) *\\(?:+\\|*\\|/\\|//\\|%\\|**\\|>>\\|<<\\|&\\|\\^\\||\\)?=" I haven't tried this rx regex, but maybe something along the lines of... (rx bol (0+ space) (group (1+ (any alnum ?_))) (0+ space) (any "=" "+=" "-=" "*=" "/=" "//=" "%=" "**=" ">>=" "<<=" "&=" "^=" "|=") -- Deniz Dogan _______________________________________________ Python-mode mailing list Python-mode@python.org http://mail.python.org/mailman/listinfo/python-mode