1. 28 Aug, 2018 5 commits
    • Paul Eggert's avatar
      Improve bignum support for system types · d77d01d2
      Paul Eggert authored
      Use bignums when Emacs converts to and from system types like
      off_t for file sizes whose values can exceed fixnum range.
      Formerly, Emacs sometimes generted floats and sometimes ad-hoc
      conses of integers.  Emacs still accepts floats and conses for
      these system types, in case some stray Lisp code is generating
      them, though this usage is obsolescent.
      * doc/lispref/files.texi (File Attributes):
      * doc/lispref/hash.texi (Defining Hash):
      * doc/lispref/nonascii.texi (Character Sets):
      * doc/lispref/os.texi (User Identification):
      * doc/lispref/processes.texi (System Processes):
      * etc/NEWS:
      Document changes.
      * src/bignum.c (mpz_set_uintmax, make_biguint)
      (mpz_set_uintmax_slow, bignum_to_intmax, bignum_to_uintmax):
      New functions.
      (mpz_set_intmax_slow): Implement via mpz_limbs_write,
      to avoid the need for an extra pass through a negative number.
      * src/charset.c (Fencode_char):
      * src/composite.h (LGLYPH_SET_CODE):
      * src/dired.c (file_attributes):
      * src/dosfns.c, src/w32.c (list_system_processes)
      * src/editfns.c (init_editfns, Fuser_uid, Fuser_real_uid)
      (Fgroup_gid, Fgroup_real_gid, Femacs_pid):
      * src/emacs-module.c (check_vec_index):
      * src/fns.c (Fsafe_length):
      * src/process.c (record_deleted_pid, Fprocess_id):
      * src/sysdep.c (list_system_processes, system_process_attributes):
      * src/xselect.c (x_own_selection, selection_data_to_lisp_data):
      * src/xterm.c (set_wm_state):
      * src/inotify.c (inotifyevent_to_event, add_watch)
      If an integer is out of fixnum range, use a bignum
      instead of converting it to a float or a cons of integers.
      * src/coding.c (Fdefine_coding_system_internal):
      * src/frame.c (frame_windows_min_size)
      * src/fringe.c (Fdefine_fringe_bitmap):
      * src/nsterm.m (mouseDown:):
      * src/syntax.c (find_defun_start):
      * src/w32fns.c (x_set_undecorated, w32_createwindow)
      (w32_wnd_proc, Fx_create_frame, Fx_show_tip)
      * src/w32inevt.c (key_event):
      * src/w32proc.c (Fw32_get_locale_info):
      Do not mishandle floats by treating their addresses as their
      * src/data.c (store_symval_forwarding):
      * src/gnutls.c (Fgnutls_error_fatalp, Fgnutls_error_string):
      * src/keyboard.c (command_loop_1, make_lispy_event):
      * src/lread.c (read_filtered_event, read1)
      * src/window.c (Fcoordinates_in_window_p, Fwindow_at)
      (window_resize_apply, Fset_window_vscroll):
      * src/xdisp.c (handle_single_display_spec, try_scrolling)
      (redisplay_window, calc_pixel_width_or_height)
      (calc_line_height_property, on_hot_spot_p):
      * src/xfaces.c (check_lface_attrs):
      * src/xselect.c (x_get_local_selection, cons_to_x_long)
      (lisp_data_to_selection_data, clean_local_selection_data)
      (x_check_property_data, x_fill_property_data):
      Do not reject bignums.
      * src/data.c (INTBIG_TO_LISP, intbig_to_lisp)
      Remove.  All uses removed.
      * src/data.c (cons_to_unsigned, cons_to_signed):
      * src/dbusbind.c (xd_signature, xd_extract_signed)
      * src/dispnew.c (sit_for):
      * src/dosfns.c, src/w32.c (system_process_attributes):
      * src/editfns.c (Fuser_full_name):
      * src/fileio.c (file_offset):
      * src/fileio.c (write_region):
      * src/font.c (font_unparse_xlfd, font_open_for_lface, Fopen_font):
      * src/frame.c (x_set_screen_gamma):
      * src/frame.h (NUMVAL, FRAME_PIXEL_X_FROM_CANON_X)
      * src/image.c (parse_image_spec, x_edge_detection)
      * src/json.c (json_to_lisp):
      * src/lcms.c (PARSE_LAB_LIST_FIELD, Flcms_cie_de2000)
      * src/nsimage.m (ns_load_image, setSizeFromSpec):
      * src/process.c (Fsignal_process, handle_child_signal):
      * src/sysdep.c (system_process_attributes):
      * src/xdisp.c (calc_line_height_property):
      Handle bignums.
      * src/data.c (Fnumber_to_string): Use proper predicate name in
      signal if the argument is not a number.
      * src/lisp.h (make_uint): New function.
      (INT_TO_INTEGER): New macro.
      (make_fixnum_or_float): Remove; no longer used.
      * src/nsfns.m, src/w32fns.c, src/xfns.c (Fx_create_frame):
      Reject floating-point min-width or min-height.
      * src/process.c (handle_child_signal): Do not worry
      about floating-point pids, as they are no longer generated.
    • Paul Eggert's avatar
      Modularize bignums better · 9abaf5f3
      Paul Eggert authored
      * src/bignum.c, src/bignum.h: New files.  Only modules that
      need to know how bignums are implemented should include
      bignum.h.  Currently these are alloc.c, bignum.c (of course),
      data.c, emacs.c, emacs-module.c, floatfns.c, fns.c, print.c.
      * src/Makefile.in (base_obj): Add bignum.o.
      * src/alloc.c (make_bignum_str): Move to bignum.c.
      (make_number): Remove; replaced by bignum.c’s make_integer.
      All callers changed.
      * src/conf_post.h (ARG_NONNULL): New macro.
      * src/json.c (json_to_lisp): Use it.
      * src/data.c (Fnatnump):
      Move NATNUMP’s implementation here from lisp.h.
      * src/data.c (Fnumber_to_string):
      * src/editfns.c (styled_format):
      Move conversion of string to bignum to bignum_to_string, and
      call it here.
      * src/emacs-module.c (module_make_integer):
      * src/floatfns.c (Fabs):
      Simplify by using make_int.
      * src/emacs.c: Include bignum.h, to expand its inline fns.
      * src/floatfns.c (Ffloat): Simplify by using XFLOATINT.
      (rounding_driver): Simplify by using double_to_bignum.
      (rounddiv_q): Clarify use of temporaries.
      * src/lisp.h: Move decls that need to know bignum internals to
      bignum.h.  Do not include gmp.h or mini-gmp.h; that is now
      bignum.h’s job.
      (GMP_NUM_BITS, struct Lisp_Bignum, XBIGNUM, mpz_set_intmax):
      Move to bignum.h.
      (make_int): New function.
      (NATNUMP): Remove; all callers changed to use Fnatnump.
      (XFLOATINT): If arg is a bignum, use bignum_to_double, so that
      bignum internals are not exposed here.
      * src/print.c (print_vectorlike): Use SAFE_ALLOCA to avoid the
      need for a record_unwind_protect_ptr.
    • Glenn Morris's avatar
    • Karl Otness's avatar
      Support ImageMagick version 7 (bug#25967) · 57294869
      Karl Otness authored
      * configure.ac, src/image.c: Add support for ImageMagick version 7.
      Copyright-paperwork-exempt: yes
    • Paul Eggert's avatar
      Update from Gnulib · f1acdff5
      Paul Eggert authored
      * build-aux/config.sub, lib/intprops.h, lib/regex_internal.c:
      * lib/regex_internal.h, lib/unistd.in.h, m4/limits-h.m4:
      * m4/stdint.m4, m4/unistd_h.m4:
      Copy from Gnulib.
      * lib/gnulib.mk.in: Regenerate.
  2. 27 Aug, 2018 8 commits
  3. 26 Aug, 2018 5 commits
    • Glenn Morris's avatar
      Merge from origin/emacs-26 · 1afd3133
      Glenn Morris authored
      54fb383a (origin/emacs-26) Fix detection of freed emacs_values (Bug#32...
      769d0cda ; Fix out-of-tree build for mod-test.so
      9a1329e9 Avoid crashes with very wide TTY frames on MS-Windows
      9a613d3e Prevent `modify-file-local-variable-prop-line' from adding ex...
      624e7dc7 Update GNOME bugtracker URLs
      51ef6d55 Clarify in the Emacs manual that ChangeLog files are not used
      6e08019a Recognize codepage 65001 as a valid encoding
      1a350d77 ; * etc/NEWS: Fix format of first lines of some entries.
      22d1f534 Avoid compilation warning in nt/addpm.c
      7bc9ce74 Fix duplicate custom group names in bibtex.el
      a9cf9387 Fix outdated text in the Calc manual
    • Eli Zaretskii's avatar
      Fix a typo in alloc.c · 18d52b90
      Eli Zaretskii authored
      * src/alloc.c (Fmemory_use_counts): The list we return now has
      only 7 elements, not 8.  (Bug#32531)
    • Alan Mackenzie's avatar
      CC Mode: make c-display-defun-name work with a pointer return type. · 5c642b2d
      Alan Mackenzie authored
      Fixes bug #32403.
      * lisp/progmodes/cc-cmds.el (c-in-function-trailer-p): No longer insist on
      c-beginning-of-decl-1 returning 'same.
      (c-where-wrt-brace-construct): Tighten up the test for looking at a symbol by
      excluding keywords.  When point is after a }, do not return 'at-function-end
      for a struct/union/class/...
      (c-defun-name-1): Considerably simplify, by amalgamating the two cond arms
      which find structs etc., and by using functions like c-forward-declarator
      rather than the faulty analysis of the source by hand.
    • Stefan Monnier's avatar
    • Paul Eggert's avatar
      Improve format-seconds accuracy · 0edf6058
      Paul Eggert authored
      * doc/lispref/os.texi (Time Parsing): It works with bignums.
      * lisp/calendar/time-date.el (format-seconds):
      Take the floor so that the resulting arithmetic is exact.
  4. 25 Aug, 2018 6 commits
    • Sergey Vinokurov's avatar
      Fix detection of freed emacs_values (Bug#32479) · 54fb383a
      Sergey Vinokurov authored
      * src/emacs-module.c (module_free_global_ref): Compare a value to be
      freed with all entries of the list.
      * test/data/emacs-module/mod-test.c (Fmod_test_globref_free): New
      (emacs_module_init): Make it accessible from Lisp.
      * test/src/emacs-module-tests.el (mod-test-globref-free-test): New
      test which uses it.
    • Noam Postavsky's avatar
      ; Fix out-of-tree build for mod-test.so · 769d0cda
      Noam Postavsky authored
      * test/Makefile.in: Don't look for emacs-module.h in $(srcdir), since
      it is generated.
    • Paul Eggert's avatar
      Prefer CONSP etc. to XTYPE · 2daf8b7e
      Paul Eggert authored
      * src/nsmenu.m (process_dialog:):
      Prefer CONSP (x) to XTYPE (x) == Lisp_Cons,
      and similarly for STRINGP (x).
    • Paul Eggert's avatar
      Improve performance of CONSP, FIXNUMP, etc. · ccdb08ef
      Paul Eggert authored
      Optimization opportunity noted by Pip Cet in:
      On my platform (Fedora 28 x86-64, AMD Phenom II X4 910e,
      user+system time), this improved ‘make compile-always’
      performance by 0.4% and shrank text size by a similar amount.
      * src/lisp.h (TAGGEDP, lisp_h_TAGGEDP): New macros and function.
      (lisp_h_CONSP, lisp_h_FLOATP, lisp_h_SYMBOLP)
      (lisp_h_VECTORLIKEP, make_lisp_ptr, STRINGP): Use them.
      (lisp_h_FIXNUMP): Use the same idea that lisp_h_TAGGEDP uses.
    • Eli Zaretskii's avatar
      Avoid crashes with very wide TTY frames on MS-Windows · 9a1329e9
      Eli Zaretskii authored
      * src/w32console.c <glyph_base>: Reduce the number of elements
      to 80.
      <glyphs, glyphs_len>: New static variables.
      (w32con_clear_end_of_line): If the line is wider than the
      current size of the "empty row" in 'glyphs', reallocate
      'glyphs' to support the full width of the frame.  This
      avoids segfaults when the frame is wider than 256 columns.
    • Wenjamin Petrenko's avatar
      Prevent `modify-file-local-variable-prop-line' from adding extra ';' · 9a613d3e
      Wenjamin Petrenko authored
      * lisp/files-x.el (modify-file-local-variable-prop-line): Handle
      whitespace when checking if there's already a ';' before the
      variable (Bug#23294).
      Copyright-paperwork-exempt: yes
  5. 24 Aug, 2018 3 commits
    • Glenn Morris's avatar
      Update GNOME bugtracker URLs · 624e7dc7
      Glenn Morris authored
      * configure.ac, admin/notes/multi-tty, etc/PROBLEMS:
      * src/emacs.c (main):
      * src/xterm.c (x_connection_closed): Update GNOME bugtracker URLs.
      ; * src/gtkutil.c (xg_display_close):
      ; * src/image.c (svg_load_image): Update URLs in comments.
    • Noam Postavsky's avatar
      Detect Chinese sudo password prompts (Bug#31075) · 161139a4
      Noam Postavsky authored
      * lisp/comint.el (comint-password-prompt-regexp): Allow text between
      the prompt prefix and password equivalent.
      * lisp/eshell/esh-mode.el (eshell-password-prompt-regexp): Accept some
      unicode alternatives to ":".
      * test/lisp/comint-tests.el (comint-testsuite-password-strings): Add
      test case.
    • Noam Postavsky's avatar
      Fix comint-password-prompt-regexp · 74277b0e
      Noam Postavsky authored
      The change from 2017-12-22 "Support French password prompts in shell"
      tried to allow nonbreaking space in addition to whitespace syntax
      characters around the colon, but used square brackets which cause "\s"
      to be interpreted literally rather than as a backslash construct.
      * lisp/comint.el (comint-password-prompt-regexp): Use [[:blank:]]
      instead, which also has the benefit of not relying on the major mode's
      whitespace syntax setting.
      * test/lisp/comint-tests.el (comint-testsuite-password-strings):
      Update French localized entry to have a space before the colon, as
      reported in Bug#29729.
  6. 23 Aug, 2018 5 commits
    • Charles A. Roelli's avatar
      Replace 2 checks in rmailsum.el with 'pos-visible-in-window-p' · ca8dbde1
      Charles A. Roelli authored
      * lisp/mail/rmailsum.el (rmail-summary-scroll-msg-up)
      (rmail-summary-scroll-msg-down): Use 'pos-visible-in-window-p'
      instead of checking the condition by hand.
    • Eli Zaretskii's avatar
      Clarify in the Emacs manual that ChangeLog files are not used · 51ef6d55
      Eli Zaretskii authored
      * doc/emacs/trouble.texi (Sending Patches): Use "commit log"
      instead of "change log", to avoid the interpretation that we
      are talking about literal ChangeLog files.  (Bug#32359)
    • Lars Ingebrigtsen's avatar
      Fix binding error in nnfolder-read-folder · 3946e1db
      Lars Ingebrigtsen authored
      * lisp/gnus/nnfolder.el (nnfolder-read-folder): Fix previous
      checkin that left `active' unbound before using it.
    • Paul Eggert's avatar
      Prune most-positive-fixnum from Lisp source · a4a3c92e
      Paul Eggert authored
      I looked through all instances of most-negative-fixnum
      and most-positive-fixnum in the Lisp source code, and
      when it was easy I removed assumptions that integers
      fit in fixnums.  The remaining instances are either
      nontrivial to fix, or are inherent to the algorithm.
      * lisp/arc-mode.el (archive-l-e): Do not convert to float,
      since we have bignums now.  All uses changed.
      * lisp/calc/calc.el (math-bignum):
      Don’t special-case most-negative-fixnum.
      * lisp/calendar/parse-time.el (parse-time-string):
      * lisp/emacs-lisp/edebug.el (edebug-read-special):
      * lisp/emacs-lisp/package.el (package--remove-hidden):
      * lisp/gnus/nnfolder.el (nnfolder-read-folder):
      * lisp/international/mule-util.el (filepos-to-bufferpos--dos):
      * lisp/menu-bar.el (menu-bar-update-buffers):
      * lisp/net/rcirc.el (rcirc-handler-317):
      * lisp/org/org-agenda.el (org-cmp-ts):
      * lisp/window.el (window--resize-child-windows):
      Avoid arbitrary limit to most-positive-fixnum or to
      * lisp/calendar/time-date.el (days-to-time):
      * lisp/erc/erc-dcc.el (erc-unpack-int):
      Don’t worry about integer overflow.
      * lisp/cedet/semantic/wisent/comp.el (wisent-BITS-PER-WORD):
      * lisp/gnus/message.el (message-unique-id):
      * lisp/org/org-footnote.el (org-footnote-new):
      * lisp/erc/erc-dcc.el (erc-most-positive-int-bytes)
      (erc-most-positive-int-msb): Remove; no longer needed.
      * lisp/net/imap.el (imap-string-to-integer): Remove; unused.
      * lisp/org/org-element.el (org-element--cache-generate-key):
      Document fixnum limitation.
    • Paul Eggert's avatar
      Fix bugs when rounding to bignums · ee641b87
      Paul Eggert authored
      Also, since Emacs historically reported a range error when
      rounding operations overflowed, do that consistently for all
      bignum overflows.
      * doc/lispref/errors.texi (Standard Errors):
      * doc/lispref/numbers.texi (Integer Basics): Document range errors.
      * src/alloc.c (range_error): Rename from integer_overflow.
      All uses changed.
      * src/floatfns.c (rounding_driver): When the result of a floating
      point rounding operation does not fit into a fixnum, put it
      into a bignum instead of always signaling an range error.
      * test/src/floatfns-tests.el (divide-extreme-sign):
      These tests now return the mathematically-correct answer
      instead of signaling an error.
      (bignum-round): Check that integers round to themselves.
  7. 22 Aug, 2018 5 commits
    • Paul Eggert's avatar
      Undo part of previous change · be5fe618
      Paul Eggert authored
      Issue spotted by Pip Cet in:
      * lisp/vc/vc-hg.el (vc-hg--raw-dirstate-search):
      Go back to using eq on flen, since it must be a fixnum.
    • Paul Eggert's avatar
      Make vc-hg safe for bignums · ae38a3b8
      Paul Eggert authored
      * lisp/vc/vc-hg.el (vc-hg--raw-dirstate-search):
      Use eql, not eq, on integers that could be bignums.
      (vc-hg--time-to-integer): Rename from vc-hg--time-to-fixnum.
      All uses changed.
      (vc-hg-state-fast): Remove test that 32-bit unsigned values
      must be fixnums.
    • Paul Eggert's avatar
    • Paul Eggert's avatar
      Add bignum support to floor, ceiling, etc. · 30efb8ed
      Paul Eggert authored
      Problem reported by Andy Moreton (Bug#32463#35 (d)).
      * src/floatfns.c (rounding_driver): Change the signature
      of the integer rounder to use mpz_t rather than EMACS_INT.
      All uses changed.  Support bignums.
      (ceiling2, floor2, truncate2, round2): Remove.
      All uses changed to rounddiv_q or to a GMP library function.
      (rounddiv_q): New function.
      * test/src/floatfns-tests.el (bignum-round): New test.
    • Paul Eggert's avatar
      Move bignump, fixnump from C to Lisp · c79444c5
      Paul Eggert authored
      * doc/lispref/objects.texi (Integer Type): Mention
      most-negative-fixnum and most-positive-fixnum as alternatives
      to fixnump and bignump.
      * lisp/subr.el (fixnump, bignump): Now written in Lisp.
      * src/data.c (Ffixnump, Fbignump): No longer written in C,
      as these new functions are not crucial for performance.
  8. 21 Aug, 2018 3 commits
    • Paul Eggert's avatar
      Fix assertion failure when reading 'BIGNUM.' · f8069952
      Paul Eggert authored
      Problem reported by Stefan Monnier (Bug#32476).
      * src/lread.c (string_to_number): Don't pass leading "+"
      or trailing "." or junk to make_bignum_str.
      * test/src/lread-tests.el (lread-string-to-number-trailing-dot):
      New test.
    • Paul Eggert's avatar
      Audit use of lsh and fix glitches · f18af6cd
      Paul Eggert authored
      I audited use of lsh in the Lisp source code, and fixed the
      glitches that I found.  While I was at it, I replaced uses of lsh
      with ash when either will do.  Replacement is OK when either
      argument is known to be nonnegative, or when only the low-order
      bits of the result matter, and is a (minor) win since ash is a bit
      more solid than lsh nowadays, and is a bit faster.
      * lisp/calc/calc-ext.el (math-check-fixnum):
      Prefer most-positive-fixnum to (lsh -1 -1).
      * lisp/vc/vc-hg.el (vc-hg-state-fast): When testing fixnum width,
      prefer (zerop (ash most-positive-fixnum -32)) to (zerop (lsh -1
      32)) (Bug#32485#11).
      * lisp/emacs-lisp/bytecomp.el (byte-compile-lapcode):
      Tighten sanity-check for bytecode overflow, by checking that the
      result of (ash pc -8) is nonnegative.  Formerly this check was not
      needed since lsh was used and the number overflowed differently.
      * lisp/net/dns.el (dns-write): Fix some obvious sign typos in
      shift counts.  Evidently this part of the code has never been
      * lisp/progmodes/hideif.el (hif-shiftleft, hif-shiftright):
      * lisp/term/common-win.el (x-setup-function-keys):
      * admin/unidata/unidata-gen.el, admin/unidata/uvs.el:
      * doc/lispref/keymaps.texi, doc/lispref/syntax.texi:
      * doc/misc/calc.texi, doc/misc/cl.texi, etc/NEWS.19:
      * lisp/arc-mode.el, lisp/calc/calc-bin.el, lisp/calc/calc-comb.el:
      * lisp/calc/calc-ext.el, lisp/calc/calc-math.el:
      * lisp/cedet/semantic/wisent/comp.el, lisp/composite.el:
      * lisp/disp-table.el, lisp/dos-fns.el, lisp/edmacro.el:
      * lisp/emacs-lisp/bindat.el, lisp/emacs-lisp/byte-opt.el:
      * lisp/emacs-lisp/bytecomp.el, lisp/emacs-lisp/cl-extra.el:
      * lisp/erc/erc-dcc.el, lisp/facemenu.el, lisp/gnus/message.el:
      * lisp/gnus/nndoc.el, lisp/gnus/nnmaildir.el, lisp/image.el:
      * lisp/international/ccl.el, lisp/international/fontset.el:
      * lisp/international/mule-cmds.el, lisp/international/mule.el:
      * lisp/json.el, lisp/mail/binhex.el, lisp/mail/rmail.el:
      * lisp/mail/uudecode.el, lisp/md4.el, lisp/net/dns.el:
      * lisp/net/ntlm.el, lisp/net/sasl.el, lisp/net/socks.el:
      * lisp/net/tramp.el, lisp/obsolete/levents.el:
      * lisp/obsolete/pgg-parse.el, lisp/org/org.el:
      * lisp/org/ox-publish.el, lisp/progmodes/cc-defs.el:
      * lisp/progmodes/ebnf2ps.el, lisp/progmodes/hideif.el:
      * lisp/ps-bdf.el, lisp/ps-print.el, lisp/simple.el:
      * lisp/tar-mode.el, lisp/term/common-win.el:
      * lisp/term/tty-colors.el, lisp/term/xterm.el, lisp/vc/vc-git.el:
      * lisp/vc/vc-hg.el, lisp/x-dnd.el, test/src/data-tests.el:
      Prefer ash to lsh when either will do.
    • Paul Eggert's avatar
      Fix bignum bugs with nth, elt, = · 81e7eef8
      Paul Eggert authored
      * src/bytecode.c (exec_byte_code): Support bignums
      when implementing nth, elt, and =.
      * src/lisp.h (SMALL_LIST_LEN_MAX): New constant.
      * src/fns.c (Fnthcdr): Use it.
      (Felt): Do not reject bignum indexes.