On 2016-11-05 12:42, Dmitry Gutov wrote: > On 05.11.2016 17:52, Clément Pit--Claudel wrote: > >> I never understood this one. The name string-to-int suggests that you'll get an error if your string doesn't describe an int. > > I'm just guessing, but that probably never happened. stirng-to-number works like this: > > ELISP> (string-to-number "abc") > 0 (#o0, #x0, ?\C-@) > ELISP> (string-to-number "22.2abc") > 22.2 I know, I know :) (what is this fancy ELISP repl, btw?) >> How do you get a proper string-to-int behavior in Emacs Lisp? With (let ((v (string-to-number s))) (when (floatp v) (error …)))? > > By calling `floor' on the result of string-to-number, I guess. Hmm. I'd expect string-to-int to error on non-ints: >>> int("1.3") Traceback (most recent call last): File "", line 1, in ValueError: invalid literal for int() with base 10: '1.3' Clément.