diff options
| author | Paul Eggert | 2017-03-07 21:23:08 -0800 |
|---|---|---|
| committer | Paul Eggert | 2017-03-07 21:23:47 -0800 |
| commit | 1590127335cef06af8d77884f9c16a8629d65943 (patch) | |
| tree | 32b8046ed3faf42a430eca93fcf56b7b1f853c25 /src/data.c | |
| parent | 1a6597660a405fe78885476f8761cab79167b4e1 (diff) | |
| download | emacs-1590127335cef06af8d77884f9c16a8629d65943.tar.gz emacs-1590127335cef06af8d77884f9c16a8629d65943.zip | |
min and max should not return markers
Problem reported by Glenn Morris in:
http://lists.gnu.org/archive/html/emacs-devel/2017-03/msg00147.html
* src/data.c (minmax_driver): Convert any marker result to an
integer, since some callers assume this.
* test/src/data-tests.el (data-tests-max, data-tests-min):
Test for this.
Diffstat (limited to 'src/data.c')
| -rw-r--r-- | src/data.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/data.c b/src/data.c index 29547d8a9ba..c480ed2068a 100644 --- a/src/data.c +++ b/src/data.c | |||
| @@ -2972,9 +2972,9 @@ minmax_driver (ptrdiff_t nargs, Lisp_Object *args, | |||
| 2972 | if (argnum == 0 || !NILP (arithcompare (val, accum, comparison))) | 2972 | if (argnum == 0 || !NILP (arithcompare (val, accum, comparison))) |
| 2973 | accum = val; | 2973 | accum = val; |
| 2974 | else if (FLOATP (accum) && isnan (XFLOAT_DATA (accum))) | 2974 | else if (FLOATP (accum) && isnan (XFLOAT_DATA (accum))) |
| 2975 | break; | 2975 | return accum; |
| 2976 | } | 2976 | } |
| 2977 | return accum; | 2977 | return MARKERP (accum) ? make_number (marker_position (accum)) : accum; |
| 2978 | } | 2978 | } |
| 2979 | 2979 | ||
| 2980 | DEFUN ("max", Fmax, Smax, 1, MANY, 0, | 2980 | DEFUN ("max", Fmax, Smax, 1, MANY, 0, |