1. 06 Jul, 2017 1 commit
    • Paul Eggert's avatar
      Convert hex digits more systematically · d6662694
      Paul Eggert authored
      This makes the code a bit smaller and presumably faster, as
      it substitutes a single lookup for conditional jumps.
      * src/character.c (hexdigit): New constant.
      (syms_of_character) [HEXDIGIT_IS_CONST]: Initialize it.
      * src/character.h (HEXDIGIT_CONST, HEXDIGIT_IS_CONST): New macros.
      (hexdigit): New decl.
      (char_hexdigit): New inline function.
      * src/charset.c: Do not include c-ctype.h.
      * src/charset.c (read_hex):
      * src/editfns.c (styled_format):
      * src/image.c (xbm_scan):
      * src/lread.c (read_escape):
      * src/regex.c (ISXDIGIT) [emacs]:
      Use char_hexdigit insted of doing it by hand.
      d6662694
  2. 22 Jun, 2017 7 commits
    • Paul Eggert's avatar
      Use unlocked stdio more systematically · f6ef15cf
      Paul Eggert authored
      This can improve performance significantly on stdio-bottlenecked code.
      E.g., make-docfile is 3x faster on my Fedora 25 x86-64 desktop.
      * admin/merge-gnulib (GNULIB_MODULES): Add unlocked-io.
      * lib-src/ebrowse.c, lib-src/emacsclient.c, lib-src/etags.c:
      * lib-src/hexl.c, lib-src/make-docfile.c, lib-src/movemail.c:
      * lib-src/profile.c, lib-src/update-game-score.c:
      Include unlocked-io.h instead of stdio.h, since these programs are
      single-threaded.
      * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
      * lib/unlocked-io.h, m4/unlocked-io.m4: New files, copied from Gnulib.
      * src/charset.c, src/cm.c, src/emacs.c, src/image.c, src/keyboard.c:
      * src/lread.c, src/term.c:
      Include sysstdio.h, possibly instead of stdio.h, to define
      the unlocked functions if the system does not provide them.
      * src/charset.c, src/lread.c (getc_unlocked):
      Remove, since sysstdio.h now defines it if needed.
      * src/cm.c (cmputc, cmcheckmagic):
      * src/dispnew.c (update_frame, update_frame_with_menu)
      (update_frame_1, Fsend_string_to_terminal, Fding, bitch_at_user):
      * src/emacs.c (main, Fdump_emacs):
      * src/fileio.c (Fdo_auto_save, Fset_binary_mode):
      * src/image.c (slurp_file, png_read_from_file, png_load_body)
      (our_stdio_fill_input_buffer):
      * src/keyboard.c (record_char, kbd_buffer_get_event, handle_interrupt):
      * src/lread.c (readbyte_from_file):
      * src/minibuf.c (read_minibuf_noninteractive):
      * src/print.c (printchar_to_stream, strout)
      (Fredirect_debugging_output):
      * src/sysdep.c (reset_sys_modes, procfs_ttyname)
      (procfs_get_total_memory):
      * src/term.c (tty_ring_bell, tty_send_additional_strings)
      (tty_set_terminal_modes, tty_reset_terminal_modes)
      (tty_update_end, tty_clear_end_of_line, tty_write_glyphs)
      (tty_write_glyphs_with_face, tty_insert_glyphs)
      (tty_menu_activate):
      * src/xfaces.c (Fx_load_color_file):
      Use unlocked stdio when it should be safe.
      * src/sysstdio.h (clearerr_unlocked, feof_unlocked, ferror_unlocked)
      (fflush_unlocked, fgets_unlocked, fputc_unlocked, fputs_unlocked)
      (fread_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked)
      (putc_unlocked, putchar_unloced): Provide substitutes if not declared.
      f6ef15cf
    • Martin Rudalics's avatar
      Fix make_hash_table calls in lread.c · 386a3da9
      Martin Rudalics authored
      * src/lread.c (readevalloop, read_internal_start): Fix
      make_hash_table calls to make build succeed.
      386a3da9
    • Ken Raeburn's avatar
      Create less garbage to collect while reading symbols. · 59f3c866
      Ken Raeburn authored
      * src/lread.c (read1): When interning a symbol, only create a new
      string object for the name if we're going to use it for a new symbol
      object.
      59f3c866
    • Ken Raeburn's avatar
      Replace read_objects assoc list with two hash tables. · b9145563
      Ken Raeburn authored
      For larger input files with lots of shared data structures, an
      association list is too slow.
      
      * src/lread.c (read_objects_map, read_objects_completed): New
      variables, replacing read_objects.
      (readevalloop): Initialize them with hash tables before starting a
      top-level read, if they're not already empty hash tables, and reset
      them to Qnil afterwards if something was added to the hash tables.
      (read_internal_start): Likewise.
      (read1): Store first the placeholder and later the newly read object
      into read_objects_map under the specified object number.  If the new
      object can contain a reference to itself, store it in
      read_objects_completed.
      (substitute_objects_recurse): Check read_objects_completed instead of
      read_objects for the known possibly-recursive objects.
      (syms_of_lread): Update initializations.
      b9145563
    • Ken Raeburn's avatar
      Use getc_unlocked. · efe200c1
      Ken Raeburn authored
      * configure.ac: Check for getc_unlocked.
      * src/charset.c (read_hex, load_charset_map_from_file): Use
      getc_unlocked instead of getc.
      (getc_unlocked) [!HAVE_GETC_UNLOCKED]: Fall back to getc.
      * src/lread.c (readbyte_from_file, Fget_file_char, read1,
      getc_unlocked): Likewise.
      efe200c1
    • Stefan Monnier's avatar
      Reduce lread substitutions. · 6af67b4a
      Stefan Monnier authored
      * src/lread.c (read1): After reading an object using the "#n=" syntax,
      if the read object is a cons cell, instead of recursively substituting
      the placeholder with the new object, mutate the placeholder cons cell
      itself to have the correct car and cdr values.
      6af67b4a
    • Ken Raeburn's avatar
      Short-circuit substitutions for some simple types. · 0b3a0f30
      Ken Raeburn authored
      Values that don't contain other values cannot be circular, so checking
      for circular objects is a waste of cycles.
      
      * src/lread.c (substitute_object_recurse): If the subtree being
      examined is a symbol, number, or property-less string, just return
      it.
      0b3a0f30
  3. 21 Jun, 2017 1 commit
  4. 01 Jun, 2017 2 commits
    • Paul Eggert's avatar
      Improve performance by avoiding strtoumax · 178d0cb5
      Paul Eggert authored
      This made (string-to-number "10") 20% faster on my old desktop,
      an AMD Phenom II X4 910e running Fedora 25 x86-64.
      * admin/merge-gnulib (GNULIB_MODULES): Remove strtoumax.
      * lib/gnulib.mk.in, m4/gnulib-comp.m4: Regenerate.
      * lib/strtoul.c, lib/strtoull.c, lib/strtoumax.c, m4/strtoull.m4:
      * m4/strtoumax.m4: Remove.
      * src/editfns.c (str2num): New function.
      (styled_format): Use it instead of strtoumax.  Use ptrdiff_t
      instead of uintmax_t.  Check for integer overflow.
      * src/lread.c (LEAD_INT, DOT_CHAR, TRAIL_INT, E_EXP):
      Move to private scope and make them enums.
      (string_to_number): Compute integer value directly during
      first pass instead of revisiting it with strtoumax later.
      178d0cb5
    • Glenn Morris's avatar
      Use true names for invocation- and source-directory · 6aacd4fb
      Glenn Morris authored
      * src/emacs.c (init_cmdargs) <Vinvocation_directory>:
      * src/lread.c (init_lread) <Vsource_directory>: Use true names.
      6aacd4fb
  5. 20 May, 2017 1 commit
  6. 16 May, 2017 1 commit
    • Paul Eggert's avatar
      Merge with gnulib, pacifying GCC 7 · 2e1bebe2
      Paul Eggert authored
      This incorporates:
      2017-05-16 manywarnings: update for GCC 7
      2017-05-15 sys_select: Avoid "was expanded before it was required"
      * configure.ac (nw): Suppress GCC 7’s new -Wduplicated-branches and
      -Wformat-overflow=2 options, due to too many false alarms.
      * doc/misc/texinfo.tex, lib/strftime.c, m4/manywarnings.m4:
      Copy from gnulib.
      * m4/gnulib-comp.m4: Regenerate.
      * src/coding.c (decode_coding_iso_2022):
      Fix bug uncovered by -Wimplicit-fallthrough.
      * src/conf_post.h (FALLTHROUGH): New macro.
      Use it to mark all switch cases that fall through.
      * src/editfns.c (styled_format): Use !, not ~, on bool.
      * src/gtkutil.c (xg_check_special_colors):
      When using sprintf, don’t trust Gtk to output colors in [0, 1] range.
      (xg_update_scrollbar_pos): Avoid use of possibly-uninitialized bool;
      this bug was actually caught by Clang.
      * src/search.c (boyer_moore):
      Tell GCC that CHAR_BASE, if nonzero, must be a non-ASCII character.
      * src/xterm.c (x_draw_glyphless_glyph_string_foreground):
      Tell GCC that glyph->u.glyphless.ch must be a character.
      2e1bebe2
  7. 13 May, 2017 2 commits
    • Philipp's avatar
      Make `old-style-backquotes' variable internal · a1d46159
      Philipp authored
      * src/lread.c (load_warn_old_style_backquotes, Fload, read1)
      (syms_of_lread): Rename `old-style-backquotes' to
      `lread--old-style-backquotes', and clarify that it's for internal
      use only.
      * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Rename
      variable.
      * test/src/lread-tests.el (lread-tests--old-style-backquotes): Add
      unit test.
      * emacs-lisp/bytecomp-tests.el
      (bytecomp-tests--old-style-backquotes): Add unit test.
      a1d46159
    • Philipp Stephani's avatar
      Improve unescaped character literal warnings · 16004397
      Philipp Stephani authored
      * src/lread.c (load_warn_unescaped_character_literals)
      (syms_of_lread):
      lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Improve
      formatting of unescaped character literal warnings.
      
      * test/src/lread-tests.el (lread-tests--unescaped-char-literals):
      test/lisp/emacs-lisp/bytecomp-tests.el
      (bytecomp-tests--unescaped-char-literals): Adapt unit tests.
      16004397
  8. 09 May, 2017 1 commit
    • Glenn Morris's avatar
      Put re-loaded file back at start of load-history (bug#26837) · db30296b
      Glenn Morris authored
      * src/lread.c (readevalloop): Fix the "whole buffer" check to
      operate in the correct buffer.
      (Feval_buffer): Move point back to the start after checking
      for lexical binding.
      * test/src/lread-tests.el (lread-test-bug26837): New test.
      * test/data/somelib.el, test/data/somelib2.el: New test data files.
      db30296b
  9. 01 May, 2017 1 commit
    • Philipp Stephani's avatar
      Warn about missing backslashes during load · c2bbdc33
      Philipp Stephani authored
      * src/lread.c (load_warn_unescaped_character_literals, Fload, read1)
      (syms_of_lread): Warn if unescaped character literals are
      found (Bug#20152).
      * lisp/emacs-lisp/bytecomp.el (byte-compile-from-buffer): Check for
      unescaped character literals during byte compilation.
      * test/src/lread-tests.el (lread-tests--unescaped-char-literals): New
      unit test.
      (lread-tests--with-temp-file, lread-tests--last-message): Helper
      functions for unit test.
      * test/lisp/emacs-lisp/bytecomp-tests.el
      (bytecomp-tests--unescaped-char-literals): New unit test.
      * test/lisp/emacs-lisp/bytecomp-tests.el (bytecomp-tests--with-temp-file):
      Helper macro for unit test.
      c2bbdc33
  10. 10 Apr, 2017 1 commit
    • Lars Brinkhoff's avatar
      Add PVSIZE function to return the size of a pseudovector. · 3ccd0ff1
      Lars Brinkhoff authored
      * src/lisp.h (PVSIZE): New function.
      
      * src/chartab.c (copy_char_table):
      * src/data.c (Ftype_of, Finteractive_form, Faref, Faset):
      * src/doc.c (Fdocumentation, store_function_docstring):
      * src/eval.c (Fcommandp, funcall_lambda, lambda_arity, Ffetch_bytecode):
      * src/fns.c (Flength, Fcopy_sequence):
      * src/font.h (FONT_SPEC_P, FONT_ENTITY_P, FONT_OBJECT_P):
      * src/lread.c (substitute_object_recurse):
      * src/src/print.c (print_object):
        Use it.
      3ccd0ff1
  11. 08 Apr, 2017 1 commit
  12. 04 Apr, 2017 1 commit
    • Lars Brinkhoff's avatar
      Add record objects with user-defined types. · a2c33430
      Lars Brinkhoff authored
      * src/alloc.c (allocate_record): New function.
      (Fmake_record, Frecord, Fcopy_record): New functions.
      (syms_of_alloc): defsubr them.
      (purecopy): Work with records.
      
      * src/data.c (Ftype_of): Return slot 0 for record objects, or type
      name if record's type holds class.
      (Frecordp): New function.
      (syms_of_data): defsubr it.  Define `Qrecordp'.
      (Faref, Faset): Work with records.
      
      * src/fns.c (Flength): Work with records.
      
      * src/lisp.h (prec_type): Add PVEC_RECORD.
      (RECORDP, CHECK_RECORD, CHECK_RECORD_TYPE): New functions.
      
      * src/lread.c (read1): Add syntax for records.
      
      * src/print.c (PRINT_CIRCLE_CANDIDATE_P): Add RECORDP.
      (print_object): Add syntax for records.
      
      * test/lisp/emacs-lisp/cl-print-tests.el (cl-print-tests-2):
      New test.
      
      * test/src/alloc-tests.el (record-1, record-2, record-3):
      New tests.
      
      * doc/lispref/elisp.texi, doc/lispref/objects.texi,
      doc/lispref/records.texi: Add documentation for records.
      a2c33430
  13. 02 Mar, 2017 1 commit
    • Paul Eggert's avatar
      Restore XFLOATINT but with restricted args · 56aaaf9b
      Paul Eggert authored
      Turn instances of extract_float into XFLOAT_DATA when possible,
      and to a resurrected XFLOATINT when the arg is a number.
      The resurrected XFLOATINT is more like XFLOAT and XINT in
      that is valid only if its arg is a number.  This clarifies
      the ways in which floats can be extracted at the C level.
      * src/editfns.c (styled_format):
      * src/floatfns.c (extract_float, Fexpt):
      Use XFLOATINT rather than open-coding it.
      * src/fns.c (internal_equal):
      * src/image.c (imagemagick_load_image):
      * src/xdisp.c (resize_mini_window):
      Prefer XFLOAT_DATA to extract_float on values known to be floats.
      * src/frame.c (x_set_screen_gamma):
      * src/frame.h (NUMVAL):
      * src/image.c (x_edge_detection, compute_image_size):
      * src/lread.c (read_filtered_event):
      * src/window.c (Fset_window_vscroll):
      * src/xdisp.c (handle_single_display_spec, try_scrolling)
      (redisplay_window, calc_pixel_width_or_height, x_produce_glyphs)
      (on_hot_spot_p):
      Prefer XFLOATINT to extract_float on values known to be numbers.
      * src/lisp.h (XFLOATINT): Bring back this function, except
      it now assumes its argument is a number.
      56aaaf9b
  14. 24 Feb, 2017 1 commit
    • Gemini Lasswell's avatar
      Support read syntax for circular objects in Edebug (Bug#23660) · 8b912ab4
      Gemini Lasswell authored
      * lisp/emacs-lisp/edebug.el (edebug-read-special): New name
      for edebug-read-function. Handle the read syntax for circular
      objects.
      (edebug-read-objects): New variable.
      (edebug-read-and-maybe-wrap-form1): Reset edebug-read-objects.
      
      * src/lread.c (Fsubstitute_object_in_subtree): Make
      substitute_object_in_subtree into a Lisp primitive.
      8b912ab4
  15. 01 Feb, 2017 1 commit
    • Paul Eggert's avatar
      Revamp quitting and fix infloops · b01ac672
      Paul Eggert authored
      This fixes some infinite loops that cannot be quitted out of,
      e.g., (defun foo () (nth most-positive-fixnum '#1=(1 . #1#)))
      when byte-compiled and when run under X.  See:
      http://lists.gnu.org/archive/html/emacs-devel/2017-01/msg00577.html
      This also attempts to keep the performance improvements I recently
      added, as much as possible under the constraint that the infloops
      must be caught.  In some cases this fixes infloop bugs recently
      introduced when I removed immediate_quit.
      * src/alloc.c (Fmake_list):
      Use rarely_quit, not maybe_quit, for speed in the usual case.
      * src/bytecode.c (exec_byte_code):
      * src/editfns.c (Fcompare_buffer_substrings):
      * src/fns.c (Fnthcdr):
      * src/syntax.c (scan_words, skip_chars, skip_syntaxes)
      (Fbackward_prefix_chars):
      Use rarely_quit so that users can C-g out of long loops.
      * src/callproc.c (call_process_cleanup, call_process):
      * src/fileio.c (read_non_regular, Finsert_file_contents):
      * src/indent.c (compute_motion):
      * src/syntax.c (scan_words, Fforward_comment):
      Remove now-unnecessary maybe_quit calls.
      * src/callproc.c (call_process):
      * src/doc.c (get_doc_string, Fsnarf_documentation):
      * src/fileio.c (Fcopy_file, read_non_regular, Finsert_file_contents):
      * src/lread.c (safe_to_load_version):
      * src/sysdep.c (system_process_attributes) [GNU_LINUX]:
      Use emacs_read_quit instead of emacs_read in places where
      C-g handling is safe.
      * src/eval.c (maybe_quit): Move comment here from lisp.h.
      * src/fileio.c (Fcopy_file, e_write):
      Use emacs_write_quit instead of emacs_write_sig in places where
      C-g handling is safe.
      * src/filelock.c (create_lock_file): Use emacs_write, not
      plain write, as emacs_write no longer has a problem.
      (read_lock_data): Use emacs_read, not read, as emacs_read
      no longer has a problem.
      * src/fns.c (rarely_quit): Move to lisp.h and rename to
      incr_rarely_quit.  All uses changed..
      * src/fns.c (Fmemq, Fmemql, Fassq, Frassq, Fplist_put, Fplist_member):
      * src/indent.c (compute_motion):
      * src/syntax.c (find_defun_start, back_comment, forw_comment)
      (Fforward_comment, scan_lists, scan_sexps_forward):
      Use incr_rarely_quit so that users can C-g out of long loops.
      * src/fns.c (Fnconc): Move incr_rarely_quit call to within
      inner loop, so that it catches C-g there too.
      * src/keyboard.c (tty_read_avail_input): Remove commented-out
      and now-obsolete code dealing with interrupts.
      * src/lisp.h (rarely_quit, incr_rarely_quit): New functions,
      the latter moved here from fns.c and renamed from rarely_quit.
      (emacs_read_quit, emacs_write_quit): New decls.
      * src/search.c (find_newline, search_buffer, find_newline1):
      Add maybe_quit to catch C-g.
      * src/sysdep.c (get_child_status): Always invoke maybe_quit
      if interruptible, so that the caller need not bother.
      (emacs_nointr_read, emacs_read_quit, emacs_write_quit):
      New functions.
      (emacs_read): Rewrite in terms of emacs_nointr_read.
      Do not handle C-g or signals; that is now for emacs_read_quit.
      (emacs_full_write): Replace PROCESS_SIGNALS two-way arg
      with INTERRUPTIBLE three-way arg.  All uses changed.
      b01ac672
  16. 30 Jan, 2017 1 commit
    • Vibhav Pant's avatar
      Fix hash tables not being purified correctly. · 9c4dfdd1
      Vibhav Pant authored
      * src/alloc.c
      (purecopy_hash_table) New function, makes a copy of the given hash
      table in pure storage.
      Add new struct `pinned_object' and `pinned_objects' linked list for
      pinning objects.
      (Fpurecopy) Allow purifying hash tables
      (purecopy) Pin hash tables that are either weak or not declared with
      `:purecopy t`, use purecopy_hash_table otherwise.
      (marked_pinned_objects) New function, marks all objects in pinned_objects.
      (garbage_collect_1) Use it. Mark all pinned objects before sweeping.
      * src/lisp.h Add new field `pure' to struct `Lisp_Hash_Table'.
      * src/fns.c: Add `purecopy' parameter to hash tables.
      (Fmake_hash_table): Check for a `:purecopy PURECOPY' argument, pass it
      to make_hash_table.
      (make_hash_table): Add `pure' parameter, set h->pure to it.
      (Fclrhash, Fremhash, Fputhash): Enforce that the table is impure with
      CHECK_IMPURE.
      * src/lread.c: (read1) Parse for `purecopy' parameter while reading
        hash tables.
      * src/print.c: (print_object) add the `purecopy' parameter while
        printing hash tables.
      * src/category.c, src/emacs-module.c, src/image.c, src/profiler.c,
        src/xterm.c: Use new (make_hash_table).
      9c4dfdd1
  17. 26 Jan, 2017 1 commit
    • Paul Eggert's avatar
      Replace QUIT with maybe_quit · b3a3ed52
      Paul Eggert authored
      There’s no longer need to have QUIT stand for a slug of C statements.
      Use the more-obvious function-call syntax instead.
      Also, use true and false when setting immediate_quit.
      These changes should not affect the generated machine code.
      * src/lisp.h (QUIT): Remove.  All uses replaced by maybe_quit.
      b3a3ed52
  18. 01 Jan, 2017 1 commit
  19. 30 Dec, 2016 1 commit
    • Ken Raeburn's avatar
      Increase the obarray size. · 064701dc
      Ken Raeburn authored
      In a typical GNU/Linux/X11 build, we wind up with over 15k symbols by
      the time we've started.  The old obarray size ensured an average chain
      length of 10 or more.
      
      * src/lread.c (OBARRAY_SIZE): Increase to 15121.
      064701dc
  20. 23 Dec, 2016 1 commit
    • Philipp Stephani's avatar
      Treat incomplete integer literals as errors · 6eaadcc7
      Philipp Stephani authored
      See Bug#25120.
      
      * src/lread.c (read_integer): Treat incomplete integer literals as errors.
      * test/src/lread-tests.el (lread-empty-int-literal): New unit test for
      incomplete integer literals.
      6eaadcc7
  21. 19 Dec, 2016 1 commit
    • Glenn Morris's avatar
      Improve default load-path for uninstalled CANNOT_DUMP builds · 504e3846
      Glenn Morris authored
      * src/lread.c (load_path_default) [CANNOT_DUMP]:
      Use build load-path if we seem to be running uninstalled.  (Bug#24974)
      I think this became an issue several years ago when we stopped
      using EMACSLOADPATH in the Makefiles; however this change should
      improve the CANNOT_DUMP uninstalled case in general.
      504e3846
  22. 08 Dec, 2016 1 commit
    • Paul Eggert's avatar
      Make read1 more reentrant · f0a1e9ec
      Paul Eggert authored
      This is needed if ‘read’ is called soon after startup, before the
      Unicode tables have been set up, and it reads a \N escape and
      needs to look up a value the Unicode tables, a lookup that in turn
      calls read1 recursively.  Although this change doesn’t make ‘read’
      fully reentrant, it’s good enough to handle this case.
      * src/lread.c (read_buffer_size, read_buffer): Remove static vars.
      (grow_read_buffer): Revamp to use locals, not statics, and to
      record memory allocation un the specpdl.  All callers changed.
      (read1): Start with a stack-based buffer, and use the heap
      only if the stack buffer is too small.  Use unbind_to to
      free any heap buffer allocated.  Use bool for boolean.
      Redo symbol loop so that only one call to grow_read_buffer
      is needed.
      (init_obarray): Remove no-longer-needed initialization.
      f0a1e9ec
  23. 03 Dec, 2016 1 commit
    • Noam Postavsky's avatar
      Add lisp watchpoints · 22721316
      Noam Postavsky authored
      This allows calling a function whenever a symbol-value is changed.
      
      * src/lisp.h (lisp_h_SYMBOL_TRAPPED_WRITE_P):
      (SYMBOL_TRAPPED_WRITE_P): New function/macro.
      (lisp_h_SYMBOL_CONSTANT_P): Check for SYMBOL_NOWRITE specifically.
      (enum symbol_trapped_write): New enumeration.
      (struct Lisp_Symbol): Rename field constant to trapped_write.
      (make_symbol_constant): New function.
      
      * src/data.c (Fadd_variable_watcher, Fremove_variable_watcher):
      (set_symbol_trapped_write, restore_symbol_trapped_write):
      (harmonize_variable_watchers, notify_variable_watchers): New functions.
      
      * src/data.c (Fset_default): Call `notify_variable_watchers' for trapped
      symbols.
      (set_internal): Change bool argument BIND to 3-value enum and call
      `notify_variable_watchers' for trapped symbols.
      
      * src/data.c (syms_of_data):
      * src/data.c (syms_of_data):
      * src/font.c (syms_of_font):
      * src/lread.c (intern_sym, init_obarray):
      * src/buffer.c (syms_of_buffer): Use make_symbol_constant.
      
      * src/alloc.c (init_symbol):
      * src/bytecode.c (exec_byte_code): Use SYMBOL_TRAPPED_WRITE_P.
      * src/data.c (Fmake_variable_buffer_local, Fmake_local_variable):
      (Fmake_variable_frame_local):
      * src/eval.c (Fdefvaralias, specbind): Refer to Lisp_Symbol's
      trapped_write instead of constant.
      (Ffuncall): Move subr calling code into separate function.
      (funcall_subr): New function.
      22721316
  24. 22 Nov, 2016 1 commit
  25. 04 Nov, 2016 1 commit
  26. 14 Oct, 2016 1 commit
  27. 30 Sep, 2016 1 commit
    • Paul Eggert's avatar
      Limit <config.h>’s includes · f4eb8900
      Paul Eggert authored
      This follows up on recent problems with the fact that config.h
      includes stdlib.h etc.; some files need to include stdlib.h later.
      config.h generally should limit itself to includes that are
      universally safe; outside of MS-Windows, only stdbool.h makes
      the cut among the files currently included.  So, move the
      other includes to just the files that need them (Bug#24506).
      * configure.ac (config_opsysfile): Remove, as this generic hook
      is no longer needed.
      * lib-src/etags.c, src/unexmacosx.c, src/w32.c, src/w32notify.c:
      * src/w32proc.c (_GNU_SOURCE):
      Remove, as it’s OK for config.h to do this now.
      * src/conf_post.h: Include <ms-w32.h>, instead of the generic
      config_opsysfile, for simplicity as this old way of configuring is
      now done only for the MS-Windows port.  Do not include <ms-w32.h>
      if DEFER_MS_W32_H, for the benefit of the few files that want its
      effects later.  Do not include <alloca.h>, <string.h>, or
      <stdlib.h>.  Other files modified to include these headers as
      needed, or to not include headers that are no longer needed.
      * src/lisp.h: Include <alloca.h> and <string.h> here, since
      some of the inline functions need them.
      * src/regex.c: Include <alloca.h> if not emacs.  (If emacs,
      we can rely on SAFE_ALLOCA.)  There is no longer any need to
      worry about HAVE_ALLOCA_H.
      * src/unexmacosx.c: Rely on config.h not including stdlib.h.
      * src/w32.c, src/w32notify.c, src/w32proc.c (DEFER_MS_W32_H):
      Define before including <config.h> first, and include <ms-w32.h>
      after the troublesome headers.
      f4eb8900
  28. 24 Sep, 2016 1 commit
    • Paul Eggert's avatar
      Improve integer overflow handling a bit · b3e1b382
      Paul Eggert authored
      * src/charset.c (read_hex): Use INT_LEFT_SHIFT_OVERFLOW for clarity.
      The machine code is the same on my platform.
      * src/doprnt.c (doprnt):
      * src/emacs-module.c (module_funcall):
      * src/font.c (font_intern_prop):
      * src/keyboard.c (Frecursion_depth):
      * src/lread.c (read1):
      Use WRAPV macros instead of checking overflow by hand.
      * src/editfns.c (hi_time, time_arith, decode_time_components):
      * src/emacs-module.c (Fmodule_load):
      Simplify by using FIXNUM_OVERFLOW_P.
      * src/emacs-module.c: Include intprops.h.
      * src/xdisp.c (percent99): New function.
      (decode_mode_spec): Use it to simplify overflow avoidance and
      formatting of %p and %P.
      b3e1b382
  29. 15 Sep, 2016 1 commit
    • Paul Eggert's avatar
      Prefer now-standard int width macros · 0bbf00c7
      Paul Eggert authored
      * src/data.c (ULL_WIDTH):
      * src/lisp.h (EMACS_INT_WIDTH, BITS_PER_BITS_WORD):
      * src/lread.c (read_integer):
      * src/term.c (produce_glyphless_glyph):
      * src/xterm.c (x_send_scroll_bar_event):
      Use *_WIDTH macros instead of CHAR_BIT * sizeof.
      * src/data.c (ULL_WIDTH): Rename from BITS_PER_ULL for consistency
      with the *_WIDTH standard macros.  All uses changed.
      * src/gmalloc.c (INT_BIT): Remove.  All uses replaced with INT_WIDTH.
      * src/lisp.h (EMACS_INT_WIDTH): Rename from BITS_PER_EMACS_INT
      for consistency with the *_WIDTH standard macros.  All uses changed.
      (BITS_PER_CHAR): Remove; all uses replaced by CHAR_BIT.  This must
      be the same as CHAR_WIDTH and avoids confusion with Elisp
      char-width, which counts columns not bits.
      (BITS_PER_SHORT): Remove; all uses replaced by SHRT_WIDTH.
      (BITS_PER_LONG): Remove; all uses replaced by LONG_WIDTH.
      * src/lread.c: Do not include limits.h since CHAR_BIT is no longer
      used directly.
      0bbf00c7
  30. 30 Jun, 2016 1 commit
    • Dmitry Antipov's avatar
      Minor tweaks to openp · fd6a133f
      Dmitry Antipov authored
      * src/lread.c (openp): Move invariant code out of the loop
      and thus avoid redundant calls to memcpy.  Adjust comments.
      fd6a133f
  31. 22 Jun, 2016 1 commit
  32. 12 Jun, 2016 1 commit
    • Paul Eggert's avatar
      emacs_strerror cleanups · 5932ffcd
      Paul Eggert authored
      * src/buffer.c, src/emacs.c, src/lread.c: Don’t include coding.h;
      no longer needed, now that emacs_strerror is declared by lisp.h.
      * src/coding.c (emacs_strerror): Remove; moved to emacs.c.
      * src/coding.h (emacs_strerror) [emacs]: Remove decl; moved
      to lisp.h.
      * src/emacs.c (emacs_strerror): Move here from coding.c.  Do not
      convert result string; this is now the caller’s responsibility,
      as some need conversion and others don’t.
      * src/fileio.c (report_file_errno, report_file_notify_error):
      Use emacs_strerror rather than rolling it ourselves.
      * src/lisp.h (emacs_strerror): Move decl here from coding.h.
      * src/lread.c (dir_warning): Just call emacs_strerror rather than
      both strerror and emacs_strerror.  Convert its result from
      locale-coding-system, since it no longer does that conversion.
      * src/sound.c (sound_perror):
      * src/sysdep.c (emacs_perror, str_collate):
      Use emacs_strerror, not strerror.
      5932ffcd