aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2018-03-29 11:01:38 -0700
committerPaul Eggert2018-03-29 11:03:07 -0700
commitc213f465ba8038ce93314b96fd53ec3e35d34609 (patch)
treec15b9e7a0617eba9008dd217deaa237b634ec79c /src
parent6b3d01dad415230ad0bd0d01a05351d7a8b0e8c3 (diff)
downloademacs-c213f465ba8038ce93314b96fd53ec3e35d34609.tar.gz
emacs-c213f465ba8038ce93314b96fd53ec3e35d34609.zip
New experimental variable read-integer-overflow-as-float.
Following a suggestion by Eli Zaretskii (Bug#30408#46). * etc/NEWS: Mention it. * src/lread.c (syms_of_lread): Add it. (read1): Treat out-of-range integers as floats if read-integer-overflow-as-float is non-nil.
Diffstat (limited to 'src')
-rw-r--r--src/lread.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/lread.c b/src/lread.c
index a774524ee43..8fb61f56338 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -3502,7 +3502,9 @@ read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
3502 3502
3503 if (!quoted && !uninterned_symbol) 3503 if (!quoted && !uninterned_symbol)
3504 { 3504 {
3505 Lisp_Object result = string_to_number (read_buffer, 10, 0); 3505 int flags = (read_integer_overflow_as_float
3506 ? S2N_OVERFLOW_TO_FLOAT : 0);
3507 Lisp_Object result = string_to_number (read_buffer, 10, flags);
3506 if (! NILP (result)) 3508 if (! NILP (result))
3507 return unbind_to (count, result); 3509 return unbind_to (count, result);
3508 } 3510 }
@@ -4830,6 +4832,13 @@ were read in. */);
4830 doc: /* Non-nil means read recursive structures using #N= and #N# syntax. */); 4832 doc: /* Non-nil means read recursive structures using #N= and #N# syntax. */);
4831 Vread_circle = Qt; 4833 Vread_circle = Qt;
4832 4834
4835 DEFVAR_BOOL ("read-integer-overflow-as-float",
4836 read_integer_overflow_as_float,
4837 doc: /* Non-nil means `read' quietly treats an out-of-range integer as floating point.
4838Nil (the default) means signal an overflow unless the integer ends in `.'.
4839This variable is experimental; email 30408@debbugs.gnu.org if you need it. */);
4840 read_integer_overflow_as_float = false;
4841
4833 DEFVAR_LISP ("load-path", Vload_path, 4842 DEFVAR_LISP ("load-path", Vload_path,
4834 doc: /* List of directories to search for files to load. 4843 doc: /* List of directories to search for files to load.
4835Each element is a string (directory file name) or nil (meaning 4844Each element is a string (directory file name) or nil (meaning