[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 01/01: * num3-mode.el: Catch strings looking like hex number even
From: |
Michal Nazarewicz |
Subject: |
[elpa] 01/01: * num3-mode.el: Catch strings looking like hex number even w/o 0x prefix. |
Date: |
Mon, 24 Feb 2014 00:30:45 +0000 |
mina86 pushed a commit to branch master
in repository elpa.
commit 34a33fa74a7ded2456e75138e93ba0c057615f80
Author: Michal Nazarewicz <address@hidden>
Date: Mon Feb 24 01:28:48 2014 +0100
* num3-mode.el: Catch strings looking like hex number even w/o 0x prefix.
Update `num3--number-re' to catch strings which are a whole word, have
only hexadecimal digits and have at least one non-decimal hexadecimal
digit (i.e. letter from A to F), and treat them as hexadecimal number.
Also update `num3--number-re' to properly catch Emacs Lisp's
This fixes bug#16834.
---
packages/num3-mode/num3-mode.el | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/packages/num3-mode/num3-mode.el b/packages/num3-mode/num3-mode.el
index b890c89..4e4f625 100644
--- a/packages/num3-mode/num3-mode.el
+++ b/packages/num3-mode/num3-mode.el
@@ -4,8 +4,8 @@
;; Author: Felix Lee <address@hidden>, Michal Nazarewicz <address@hidden>
;; Maintainer: Michal Nazarewicz <address@hidden>
-;; 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
@@ -98,9 +98,11 @@ where) decimal point (would be) is."
(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'.