1. 15 Jun, 2018 8 commits
    • Paul Eggert's avatar
      Avoid allocating Lisp_Save_Value for arrays · d98670eb
      Paul Eggert authored
      * src/alloc.c (mark_maybe_objects): New function.
      * src/eval.c (default_toplevel_binding)
      (backtrace_eval_unrewind, Fbacktrace__locals):
      Treat array unwindings like other miscellaneous pdl types.
      (record_unwind_protect_array): New function.
      (do_one_unbind): Free the array while unwinding.
      (mark_specpdl): Mark arrays directly.
      * src/lisp.h (SPECPDL_UNWIND_ARRAY): New constant.
      (union specbinding): New member unwind_array.
      (SAFE_ALLOCA_LISP_EXTRA): Use record_unwind_protect_array
      instead of make_save_memory + record_unwind_protect.
      d98670eb
    • Paul Eggert's avatar
      Avoid allocating Lisp_Save_Value for excursions · aca938d1
      Paul Eggert authored
      * src/editfns.c (save_excursion_save): New arg PDL,
      specifying where to save the state.  All uses changed.
      (save_excursion_restore): Args are now the marker and info
      rather than a pointer to a Lisp_Save_Value containing them.
      All uses changed.
      * src/eval.c (default_toplevel_binding, Fbacktrace__locals):
      Treat excursions like other miscellaneous pdl types.
      (record_unwind_protect_excursion): Save data directly
      into the pdl rather than creating an object on the heap.
      This avoids the need to allocate and free an object.
      (do_one_unbind, backtrace_eval_unrewind):
      Unwind excursions directly.
      (mark_specpdl): Mark excursions directly.
      * src/lisp.h (SPECPDL_UNWIND_EXCURSION): New constant.
      (union specbinding): New member unwind_excursion.
      aca938d1
    • Paul Eggert's avatar
      Just use cons in macfont_descriptor_entity · 6c04c848
      Paul Eggert authored
      * src/macfont.m (macfont_descriptor_entity): Use cons instead
      of make_save_ptr_int, as this avoids the need for a special
      type and function for this one-off.
      6c04c848
    • Paul Eggert's avatar
      Avoid allocating a Lisp_Save_Value in ftfont.c · 888bf987
      Paul Eggert authored
      * src/ftfont.c (struct ftfont_cache_data): New member face_refcount.
      (ftfont_lookup_cache): Clear it when initializing.
      Use make_mint_ptr, since this typically avoids the need to
      allocate a Lisp_Save_Value as refcount is now stored elsewhere.
      (ftfont_open2, ftfont_close): Manipulate the reference
      count in the struct, not in the save object.
      888bf987
    • Paul Eggert's avatar
      Use record_unwind_protect_ptr to avoid allocation · 3f0a8a2e
      Paul Eggert authored
      * src/term.c (struct tty_pop_down_menu): New type.
      (tty_pop_down_menu, tty_menu_show): Use it, along with
      record_unwind_protect_ptr, to avoid allocating a Lisp_Misc.
      * src/xmenu.c (struct pop_down_menu): New type.
      (pop_down_menu, x_menu_show): Use it, likewise.
      * src/xterm.c (x_cr_destroy, x_cr_export_frames):
      Use record_unwind_protect_pointer to avoid possibly allocating
      a Lisp_Misc.
      3f0a8a2e
    • Paul Eggert's avatar
      Avoid Lisp_Misc allocation if C stack suffices · 12fd59bb
      Paul Eggert authored
      * src/fileio.c (union read_non_regular): New type.
      (read_non_regular, Finsert_file_contents):
      Use it to avoid	allocating a Lisp_Misc.
      * src/keymap.c (union map_keymap): New type.
      (map_keymap_char_table_item, map_keymap_internal):
      Use it to avoid	allocating a Lisp_Misc.
      12fd59bb
    • Paul Eggert's avatar
      Simplify init_module_assertions · ef66660c
      Paul Eggert authored
      * src/emacs-module.c (init_module_assertions): Just use NULL
      instead of allocating a dummy on the stack and then using
      eassert.  Practical platforms check for null pointer
      dereferencing nowadays, so this is good enough.
      ef66660c
    • Paul Eggert's avatar
      New mint_ptr representation for C pointers · 30d393f9
      Paul Eggert authored
      * src/lisp.h (make_mint_ptr, mint_ptrp, xmint_pointer): New functions.
      * src/dbusbind.c (xd_lisp_dbus_to_dbus, Fdbus__init_bus):
      * src/emacs-module.c (module_free_global_ref, Fmodule_load)
      (module_assert_runtime, module_assert_env, value_to_lisp)
      (lisp_to_value, initialize_environment)
      (finalize_environment, finalize_runtime_unwind)
      (mark_modules):
      * src/font.c (otf_open, font_put_frame_data)
      (font_get_frame_data):
      * src/macfont.m (macfont_invalidate_family_cache)
      (macfont_get_family_cache_if_present)
      (macfont_set_family_cache):
      * src/nsterm.h (XNS_SCROLL_BAR):
      * src/nsterm.m (ns_set_vertical_scroll_bar)
      (ns_set_horizontal_scroll_bar):
      * src/w32fns.c (w32_monitor_enum)
      (w32_display_monitor_attributes_list):
      * src/xterm.c (x_cr_destroy, x_cr_export_frames):
      * src/xwidget.c (webkit_javascript_finished_cb)
      (save_script_callback, Fxwidget_webkit_execute_script)
      (kill_buffer_xwidgets):
      Use mint pointers instead of merely save pointers.
      30d393f9
  2. 14 Jun, 2018 3 commits
    • João Távora's avatar
      Also allow custom false and null when serializing to JSON · 51adab5d
      João Távora authored
      * doc/lispref/text.texi (Parsing JSON): Describe new arguments of
      json-serialize and json-insert.
      
      * src/json.c (enum json_object_type, struct json_configuration):
      Move up in file before first usage.
      (lisp_to_json_toplevel, lisp_to_json_toplevel_1, lisp_to_json):
      Accept a struct json_configuration*.
      (Fjson_serialize, Fjson_insert): Accept multiple args.
      (json_parse_args): Accept new boolean configure_object_type.
      
      * test/src/json-tests.el
      (json-serialize, json-insert): Update forward decls.
      (json-parse-with-custom-null-and-false-objects): Add assertions for
      json-serialize.
      51adab5d
    • João Távora's avatar
      Support custom null and false objects when parsing JSON · 9348039e
      João Távora authored
      * doc/lispref/text.texi (Parsing JSON): Describe new :null-object
      and :false-object kwargs to json-parse-string and
      json-parse-buffer.
      
      * src/json.c
      (struct json_configuration): New type.
      (json_to_lisp): Accept a struct json_configuration* param.
      (json_parse_args): Rename from json_parse_object_type.
      (Fjson_parse_string): Rework docstring.
      (Fjson_parse_string, Fjson_parse_buffer): Update call to
      json_to_lisp.
      (syms_of_json): Two new syms, QCnull_object and QCfalse_object.
      
      * test/src/json-tests.el
      (json-parse-with-custom-null-and-false-objects): New test.
      9348039e
    • Damien Cassou's avatar
      Fix pretty-printing empty objects as null · 8cb9beb3
      Damien Cassou authored
      * lisp/json.el (json-pretty-print): Force distinction between empty
        objects and null.
      (json-encode-list): Remove responsibility to print "null" as this
      value is not a list.
      (json-encode): Give higher precedence to lists so that an empty list
      is printed as an empty object, not as "null".
      
      * test/lisp/json-tests.el (test-json-encode): Add many tests to check
        the behavior of pretty-printing.
      8cb9beb3
  3. 13 Jun, 2018 3 commits
    • Paul Eggert's avatar
      Remove some wrong 8-byte alignment assumptions · 967d2c55
      Paul Eggert authored
      Do not assume that 8-byte alignment suffices for all C objects,
      as some platforms require 16-byte alignment for some objects,
      and this will start to bite us as time goes on (e.g., if an
      Emacs module ever uses an object containing a long
      double, which requires 16-byte alignment on x86-64).
      Conversely, on !USE_LSB_TAG platforms, do not insist on
      aligning Lisp objects to a multiple of 8, as this is not
      needed for high-order tag bits.
      * src/alloc.c (LISP_ALIGNMENT, MALLOC_IS_LISP_ALIGNED):
      New constants.
      (XMALLOC_BASE_ALIGNMENT, XMALLOC_HEADER_ALIGNMENT):
      Removed.  All uses replaced by LISP_ALIGNMENT.
      (aligned_alloc, laligned, lmalloc, lrealloc, union aligned_Lisp_Misc)
      (maybe_lisp_pointer, pure_alloc):
      Use LISP_ALIGNMENT rather than GCALIGNMENT.
      (aligned_alloc): Do not worry about an alignment of
      LISP_ALIGNMENT when MALLOC_IS_LISP_ALIGNED, as the code never
      uses aligned_alloc with alignment == LISP_ALIGNMENT in that case.
      (__alignof__): Remove.  All uses removed.
      (MALLOC_IS_GC_ALIGNED): Remove.
      All uses replaced with MALLOC_IS_LISP_ALIGNED.
      (vector_alignment): Remove.
      All uses replaced with LISP_ALIGNMENT.
      * src/alloc.c (mark_maybe_pointer):
      * src/emacs-module.c (value_to_lisp_bits):
      Do not assume GCALIGNMENT == 1 << GCTYPEBITS, as GCALIGNMENT
      is 1 on !USE_LSB_TAG platforms now.
      * src/lisp.h (GCALIGNMENT) [!USE_LSB_TAG]: Now 1.
      (struct Lisp_Symbol, union vectorlike_header, struct Lisp_Cons)
      (struct Lisp_String): Simplify test for verifying alignment.
      967d2c55
    • Daniel Colascione's avatar
      Clarify that enabling a theme does not disable other themes · b8478b2a
      Daniel Colascione authored
      Avoid user confusion by explicitly stating that enabling a theme does
      not imply disabling other themes and that theme load functions are not
      theme switch functions.
      
      * lisp/custom.el (load-theme, enable-theme): Clarify docstrings.
      b8478b2a
    • Daniel Colascione's avatar
      Ignore focus events for dead frames · 5ed11914
      Daniel Colascione authored
      Frames can die between the time we generate a focus event and the time
      we get around to processing it.  Do run after-focus-change-function,
      since that's idempotent and we want to make sure not to miss
      any changes.
      
      * lisp/frame.el (handle-focus-in, handle-focus-out): Check for dead frames.
      5ed11914
  4. 12 Jun, 2018 7 commits
  5. 11 Jun, 2018 8 commits
    • Daniel Colascione's avatar
      Add after-delete-frame-functions · 0626d5ab
      Daniel Colascione authored
      Instead of working around the behavior delete-frame-functions, just
      add an after-delete-frame-functions hook.
      
      * doc/lispref/frames.texi (Deleting Frames): Document
      `after-delete-frame-functions'.
      
      * etc/NEWS: Mention `after-delete-frame-functions'.
      
      * lisp/frame.el (blink-cursor--should-blink):
      (blink-cursor--rescan-frames, blink-frame-mode): Get rid of the
      ugly ignored-frame parameter and switch from
      `delete-frame-functions' to `after-delete-frame-functions'.
      
      * src/frame.c (syms_of_frame): New variable
      `after-delete-frame-functions'.
      (delete_frame): Use it.
      0626d5ab
    • Daniel Colascione's avatar
      Make blink-cursor-mode use new focus functions · 4ff438a4
      Daniel Colascione authored
      * lisp/frame.el (blink-cursor--should-blink): New function.
      (blink-cursor-check): Call it.
      (blink-cursor--rescan-frames): New function.
      (blink-cursor-mode): Wire up `blink-cursor--rescan-frames`; stop
      using `focus-in-hook' and `focus-out-hook'.
      4ff438a4
    • Daniel Colascione's avatar
      Losing focus should not stop idleness · 6a1dfa71
      Daniel Colascione authored
      * src/keyboard.c (read_char): Make Qfocus_out not break idle.
      6a1dfa71
    • Daniel Colascione's avatar
      New focus management interface · 2f6c6820
      Daniel Colascione authored
      focus-in-hook and focus-out-hook don't accurately reflect actual
      user-visible focus states.  Add a new focus interface and mark the old
      one obsolete.
      
      * doc/lispref/frames.texi (Input Focus): Document new focus
      functions.  Remove references to the now-obsolete focus hooks.
      
      * lisp/frame.el (frame-focus-state): New function.
      (after-focus-change-function): New variable.
      (focus-in-hook, focus-out-hook): Move to lisp from C;
      mark obsolete.
      
      * lisp/term/xterm.el (xterm-translate-focus-in)
      (xterm-translate-focus-out): Track tty focus in `tty-focus-state'
      terminal parameter; call `after-focus-change-function'.
      (xterm--suspend-tty-function): New function.
      
      * src/frame.c (Fhandle_switch_frame): Update docstring; don't call
      focus hooks.
      (focus-in-hook, focus-out-hook): Remove: moved to lisp.
      (syms_of_frame): Remove unread_switch_frame; add
      Vunread_switch_frame.
      
      * src/keyboard.c:
      (Finternal_handle_focus_in): New function.
      (make_lispy_event): Always report focus events to lisp; don't
      translate them to switch events sometimes.  Lisp can take care of
      creating synthetic switch-frame events via
      `internal-handle-focus-in'.
      
      * src/w32term.c (x_focus_changed): Remove switch-avoidance logic:
      just directly report focus changes to lisp.
      
      * src/xterm.c (x_focus_changed): Remove switch-avoidance logic:
      just directly report focus changes to lisp.
      2f6c6820
    • Daniel Colascione's avatar
      Remove code #if-0-ed terminal-local code · a20fe5a7
      Daniel Colascione authored
      This code hasn't been used since 2005.
      
      * src/data.c
      (get_terminal, Fterminal_local_value, Fset_terminal_local_value): Remove.
      a20fe5a7
    • Daniel Colascione's avatar
      Remove obsolete keyboard.c code · b4e953ba
      Daniel Colascione authored
      * src/keyboard.c (any_kboard_state, single_kboard_state): Remove
      #if-0-ed functions.
      b4e953ba
    • Lars Ingebrigtsen's avatar
      Don't have shr bug out on degenerate <img> tags · 94d60f59
      Lars Ingebrigtsen authored
      * lisp/net/shr.el (shr-tag-img): Protect against contructs like
      <img src=" ">.
      94d60f59
    • Stefan Monnier's avatar
  6. 10 Jun, 2018 11 commits
    • Noam Postavsky's avatar
      Merge from emacs-26 · 96254779
      Noam Postavsky authored
      8a1576cc Fix term.el cursor movement at bottom margin (Bug#31690)
      96254779
    • Noam Postavsky's avatar
      ; Merge from emacs-26 · eaeb69c5
      Noam Postavsky authored
      The following commit was skipped:
      
      4c3fae3c Call enchant-lsmod correctly when Enchant is installed wit...
      eaeb69c5
    • Noam Postavsky's avatar
      Merge from emacs-26 · 7adf1a36
      Noam Postavsky authored
      3434edc7 Enlarge DUMPED_HEAP_SIZE for 64-bit Windows builds
      36bbdfc0 Update Unicode data files to version 11.0.0 of Unicode
      b7b7a5f4 * etc/NEWS: Belatedly call out vc-hg changes in v26.1.  (B...
      5b6f8b54 Clarify the documentation of 'dired-recursive-deletes'
      9db97b49 ; * etc/DEBUG: Add information about debugging libXft prob...
      0214ffbe Clarify doc string of 'update-glyphless-char-display'
      ef35d405 Clarify subtle issues with 'eq' in byte-compiled code
      c6ef3c83 Make cl-print respect print-quoted (bug#31649)
      26b52ac4 Fix unexpected jumps of window-point in 'set-window-config...
      4af077ab * etc/emacs.appdata.xml: Update Emacs screenshot.
      e5ab25de Fix cursor movement by 'next-logical-line' after 'next-line'
      d20beef5 Fix prompt in bookmark.el (Bug#24726)
      c57e7eaa Improve documentation of 'empty' whitespace-style
      
      # Conflicts:
      #	etc/NEWS
      7adf1a36
    • Noam Postavsky's avatar
      ; Merge from emacs-26 · 78ac2480
      Noam Postavsky authored
      The following commits were skipped:
      
      acaebed0 ; * src/ftfont.c (ftfont_spec_pattern): Fix whitespace.
      97d61f87 Port FC_COLOR change to older fontconfig
      78ac2480
    • Noam Postavsky's avatar
      Merge from emacs-26 · 23e9beff
      Noam Postavsky authored
      55c9bb9f Fix comint-get-old-input-default for output field case (Bu...
      26819cd1 ; ChangeLog.3: Fix typo.
      e35a08ea Prevent infloop in 'delete-trailing-whitespace'
      
      * lisp/progmodes/cperl-mode.el:
      * lisp/progmodes/cc-engine.el:
      * lisp/progmodes/cc-mode.el: Fix tabs mixed with space preventing
      commit hook from succeeding.
      23e9beff
    • Noam Postavsky's avatar
      Fix term.el cursor movement at bottom margin (Bug#31690) · 8a1576cc
      Noam Postavsky authored
      * lisp/term.el (term-handle-ansi-escape) <\E[B cud>: Allow moving the
      cursor to the bottom margin line, rather than stopping one line
      before.
      8a1576cc
    • Paul Eggert's avatar
      Pacify gcc -Wnull-dereference some more · f4e9ceac
      Paul Eggert authored
      * src/keyboard.c (read_char): Use xevent_start in a couple
      more places where it is safe.  This is needed with
      --enable-gcc-warnings --enable-checking on Fedora 28 x86-64.
      f4e9ceac
    • Paul Eggert's avatar
      Use native alignment to access Lisp object data · 0303fab3
      Paul Eggert authored
      Instead of using __builtin_assume_aligned (P, GCALIGNMENT) to
      tell GCC that P has alignment 8, use (T *) P where T is the
      type of the pointed-to object, to tell GCC that P has native
      alignment.  This is simpler, matches the intent better, and
      should help simplify future improvements.  Some of these
      changes are to pacify gcc -Wnull-dereference, since GCC is
      smarter about pointers now that Emacs no longer uses
      __builtin_assume_aligned; these minor changes should improve
      code efficiency slightly.  On Fedora 28 x86-64 with default
      optimization this patch shrinks the size of the Emacs text
      segment by 0.36%.
      * src/conf_post.h (__has_builtin, __builtin_assume_aligned):
      Remove; no longer used.
      * src/dbusbind.c (XD_OBJECT_TO_DBUS_TYPE):
      Pacify -Wnull-dereference by using XCAR instead of CAR_SAFE
      and XCDR instead of CDR_SAFE when this is safe.
      * src/fileio.c (Fexpand_file_name):
      * src/font.c (clear_font_cache):
      Pacify -Wnull-dereference by removing unnecessary NILP test.
      * src/keyboard.c (xevent_start): New function.
      (read_char, read_key_sequence): Pacify -Wnull-dereference by
      using xevent_start instead of EVENT_START.
      * src/lisp.h (lisp_h_XUNTAG): Remove; XUNTAG is always a macro
      now, since it can no longer be implemented as a function.
      (XUNTAG): New third argument CTYPE.  All uses changed.
      Cast result to CTYPE * instead of using __builtin_assume_aligned.
      Simplify by using LISP_WORD_TAG.
      (LISP_WORD_TAG): New macro.
      (TAG_PTR): Use it.
      * src/menu.c (x_popup_menu_1):
      Pacify -Wnull-dereference by using XCAR instead of Fcar and
      XCDR instead of Fcdr where this is safe.
      0303fab3
    • Reuben Thomas's avatar
      Call enchant-lsmod correctly when Enchant is installed with a suffix · 4c3fae3c
      Reuben Thomas authored
      * lisp/textmodes/ispell.el (ispell--call-enchant-lsmod): Cope with a
      version suffix on the binary name, so enchant-2 is converted to
      enchant-lsmod-2, not enchant-2-lsmod.  (Bug#31761)
      
      (cherry picked from commit a402d9aa)
      4c3fae3c
    • Paul Eggert's avatar
      Simplify read_key_sequence · efa750e6
      Paul Eggert authored
      * src/keyboard.c (READ_KEY_ELTS): New constant.
      (keyremap_step, read_key_sequence): Omit BUFSIZE arg, since it's
      always READ_KEY_ELTS.  All callers changed.
      (grow_bool_vector): Remove; no longer needed.
      (read_key_sequence): Use a bool array instead of a Lisp bool
      vector, since it's small and this puts less pressure on the GC.
      efa750e6
    • Daniel Colascione's avatar
      Unbreak echoing · cace203d
      Daniel Colascione authored
      * src/keyboard.c (read_key_sequence): Don't echo_truncate the first time.
      cace203d