chiark / gitweb /
el/dot-emacs.el (mdw-fontify-pythonic): Handle word boundaries better.
authorMark Wooding <mwooding@good.com>
Thu, 25 Oct 2012 11:37:11 +0000 (12:37 +0100)
committerMark Wooding <mwooding@good.com>
Thu, 25 Oct 2012 11:37:11 +0000 (12:37 +0100)
For some reason, in squeeze's Emacs, underscores cause a break in the
middle of a token, and the individual pieces can be recognized as
keywords or numbers.  This is obviously wrong.  Fix it by using
different word-boundary regexp magic.

This doesn't seem to happen in wheezy's Emacs, but I don't think this
change will harm that.

el/dot-emacs.el

index 503fa37f36eaae482a65bfefe00be3d886fc798d..887dc1c4138631bd38c8632cee12469858812cd8 100644 (file)
@@ -1667,12 +1667,12 @@ (defun mdw-fontify-pythonic (keywords)
        (list
 
         ;; Set up the keywords defined above.
-        (list (concat "\\<\\(" keywords "\\)\\>")
+        (list (concat "\\_<\\(" keywords "\\)\\_>")
               '(0 font-lock-keyword-face))
 
         ;; At least numbers are simpler than C.
-        (list (concat "\\<0\\([xX][0-9a-fA-F_]+\\|[0-7_]+\\)\\|"
-                      "\\<[0-9][0-9_]*\\(\\.[0-9_]*\\|\\)"
+        (list (concat "\\_<0\\([xX][0-9a-fA-F_]+\\|[0-7_]+\\)\\|"
+                      "\\_<[0-9][0-9_]*\\(\\.[0-9_]*\\|\\)"
                       "\\([eE]\\([-+]\\|\\)[0-9_]+\\|[lL]\\|\\)")
               '(0 mdw-number-face))