From: Mark Wooding Date: Thu, 25 Oct 2012 11:37:11 +0000 (+0100) Subject: el/dot-emacs.el (mdw-fontify-pythonic): Handle word boundaries better. X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/profile/commitdiff_plain/4b0371099c1ba64354db14c84b1f9595a3eee417?ds=inline el/dot-emacs.el (mdw-fontify-pythonic): Handle word boundaries better. 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. --- diff --git a/el/dot-emacs.el b/el/dot-emacs.el index 503fa37..887dc1c 100644 --- a/el/dot-emacs.el +++ b/el/dot-emacs.el @@ -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))