From: William Xu Date: Thu, 19 Jun 2014 21:08:44 +0000 (-0400) Subject: * lisp/progmodes/hideif.el (hif-string-to-number): Don't return float for X-Git-Tag: emacs-25.0.90~2612^2~709^2~697^2~58 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=da20e0f1a8ab6b4c0713b237315dd1bd383f8f76;p=emacs.git * lisp/progmodes/hideif.el (hif-string-to-number): Don't return float for hex integer constants. Fixes: debbugs:17807 --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 1bc768a3b52..d8146a96312 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-06-19 William Xu + + * progmodes/hideif.el (hif-string-to-number): Don't return float for + hex integer constants (bug#17807). + 2014-06-19 Stefan Monnier * international/mule-util.el (truncate-string-ellipsis): New var. diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el index bcb46592465..ee144df4395 100644 --- a/lisp/progmodes/hideif.el +++ b/lisp/progmodes/hideif.el @@ -412,9 +412,13 @@ that form should be displayed.") (if (or (not base) (= base 10)) (string-to-number string base) (let* ((parts (split-string string "\\." t "[ \t]+")) - (frac (cadr parts)) - (quot (expt (* base 1.0) (length frac)))) - (/ (string-to-number (concat (car parts) frac) base) quot)))) + (frac (cadr parts)) + (quot (expt (* base 1.0) (length frac))) + (num (/ (string-to-number (concat (car parts) frac) base) + quot))) + (if (= num (truncate num)) + (truncate num) + num)))) (defun hif-tokenize (start end) "Separate string between START and END into a list of tokens."