;;; num3-mode.el --- highlight groups of digits in long numbers -*- lexical-binding: t -*-
-;; Copyright (C) 2012 Free Software Foundation, Inc.
+;; Copyright (C) 2012, 2014 Free Software Foundation, Inc.
;; Author: Felix Lee <felix8a@gmail.com>, Michal Nazarewicz <mina86@mina86.com>
;; Maintainer: Michal Nazarewicz <mina86@mina86.com>
-;; Keywoards: faces, minor-mode
-;; Version: 1.1
+;; Keywords: faces, minor-mode
+;; Version: 1.2
;; GNU Emacs is free software: you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
(unless (assoc 'num3--matcher font-lock-keywords)
(font-lock-add-keywords nil '(num3--matcher) 'append))
(font-lock-remove-keywords nil '(num3--matcher)))
- (when font-lock-mode
- (font-lock-fontify-buffer)))
+ (if (fboundp 'font-lock-flush) (font-lock-flush)
+ (when font-lock-mode (font-lock-fontify-buffer))))
;;;###autoload
(define-globalized-minor-mode global-num3-mode num3-mode num3-mode)
(defconst num3--number-re
- (concat "\\(?:0[xX]\\|#\\)\\([0-9a-fA-F]+\\)" ; 1 = hexadecimal
- "\\|\\([0-9]+\\)" ; 2 = decimal
- "\\|\\.\\([0-9]+\\)")) ; 3 = fraction
+ (concat "[0#][xX]\\([[:xdigit:]]+\\)" ; 1 = hexadecimal
+ "\\|\\(?1:\\b\\(?:[0-9]+[a-fA-F]\\|" ; 1 = hexadecimal
+ "[a-fA-F]+[0-9]\\)[[:xdigit:]]*\\b\\)"
+ "\\|\\([0-9]+\\)" ; 2 = decimal
+ "\\|\\.\\([0-9]+\\)")) ; 3 = fraction
(defun num3--matcher (lim)
"Function used as a font-lock-keywoard handler used in `num3-mode'.
(font-lock-append-text-property lo hi 'face
(if even 'num3-face-even 'num3-face-odd)))
-(provide 'num3)
-
-;;; num3.el ends here
+(provide 'num3-mode)
+;;; num3-mode.el ends here