1. 03 Aug, 2016 2 commits
  2. 02 Aug, 2016 9 commits
    • Stefan Monnier's avatar
      * src/window.c: Fix bootstrap failure due to window.el changes · 49e0c276
      Stefan Monnier authored
      (sanitize_window_sizes): Adjust to new calling convention of
      window--sanitize-window-sizes and only call it if defined.
      (Fwindow__sanitize_window_sizes): Remove.
      (syms_of_window): Don't defsubr it.
    • Paul Eggert's avatar
      Port regex changes to strict ISO C · 0100805a
      Paul Eggert authored
      * src/regex.c (regex_compile): Redo casts.
    • Michal Nazarewicz's avatar
      Remove unused STREQ macro · edd5dd80
      Michal Nazarewicz authored
      This fixes the following compilation warning:
          regex.c:516:0: warning: macro "STREQ" is not used [-Wunused-macros]
           #define STREQ(s1, s2) ((strcmp (s1, s2) == 0))
      * src/regex.c (STREQ): Remove unused macro.  It should have been removed
      in a [4538a5e3: Refactor regex character class parsing in [:name:]]
      commit but was mistakenly left out.
    • Michal Nazarewicz's avatar
      Hardcode regex syntax to remove dead code handling different syntax · 54a3c0c9
      Michal Nazarewicz authored
      Emacs only ever uses its own regex syntax so support for other syntaxes
      is never used.  Hardcode the syntax so that the compilar can detect such
      dead code and remove it from compiled code.
      The only exception is RE_NO_POSIX_BACKTRACKING which can be separatelly
      specified.  Handle this separatelly with a function argument (replacing
      now unnecessary syntax argument).
      With this patchset, size of Emacs binary on x86_64 machine is reduced by
      around 60 kB:
      	new-sizes:-rwx------ 3 mpn eng 30254720 Jul 27 23:31 src/emacs
      	old-sizes:-rwx------ 3 mpn eng 30314828 Jul 27 23:29 src/emacs
      * src/regex.h (re_pattern_buffer): Don’t define syntax field #ifdef emacs.
      (re_compile_pattern): Replace syntax with posix_backtracking argument.
      * src/regex.c (print_compiled_pattern): Don’t print syntax #ifdef emacs.
      (regex_compile): #ifdef emacs, replace syntax argument with
      posix_backtracking which is now used instead of testing for
      (re_match_2_internal): Don’t access bufp->syntax #ifndef emacs.
      (re_compile_pattern): Replace syntax with posix_backtracking argument.
      * src/search.c (compile_pattern_1): Pass boolean posix_backtracking
      instead of syntax to re_compile_pattern.
    • Michal Nazarewicz's avatar
      Get rid of re_set_whitespace_regexp · da9c55dd
      Michal Nazarewicz authored
      * src/regex.h (re_set_whitespace_regexp): Delete.
      (re_compile_pattern): Add whitespace_regexp argument #ifdef emacs.
      * src/regex.c (re_set_whitespace_regexp, whitespace_regexp): Delete.
      (regex_compile): Add whitespace_regexp argument #ifdef emacs and wrap
      whitespace_regexp-related code in an #ifdef emacs so it’s compiled out
      unless building Emacs.
      (re_compile_pattern): Pass whitespace_regexp argument to regex_compile
      * src/search.c (compile_pattern_1): Don’t use re_set_whitespace_regexp,
      pass the regex as argument to re_compile_pattern instead.
    • Michal Nazarewicz's avatar
      Get rid of re_set_syntax · 04d96eca
      Michal Nazarewicz authored
      Instead of using a global variable for storing regex syntax, pass it
      to re_compile_pattern.  This is only enabled when compiling Emacs (i.e.
      ‘#ifdef emacs’).
      * src/regex.h (re_set_syntax): Declare only #ifndef emacs.
      (re_compile_pattern): Now takes syntax argument #ifdef emacs.
      * src/regex.c (re_syntax_options): Define only #ifndef emacs.
      (re_compile_pattern): Use the new syntax argument #ifdef emacs.
      * src/search.c (compile_pattern_1): Don’t use re_set_syntax and
      instead pass syntax to re_compile_pattern directly.
    • Michal Nazarewicz's avatar
      Remove dead opcodes in regex bytecode · 9a418e0f
      Michal Nazarewicz authored
      There is no way to specify before_dot and after_dot opcodes in a regex
      so code handling those ends up being dead.  Remove it.
      * src/regex.c (print_partial_compiled_pattern, regex_compile,
      analyze_first, re_match_2_internal): Remove handling and references to
      before_dot and after_dot opcodes.
    • Michal Nazarewicz's avatar
      Refactor regex character class parsing in [:name:] · 4538a5e3
      Michal Nazarewicz authored
      re_wctype function is used in three separate places and in all of
      those places almost exact code extracting the name from [:name:]
      surrounds it.  Furthermore, re_wctype requires a NUL-terminated
      string, so the name of the character class is copied to a temporary
      The code duplication and unnecessary memory copying can be avoided by
      pushing the responsibility of parsing the whole [:name:] sequence to
      the function.
      Furthermore, since now the function has access to the length of the
      character class name (since it’s doing the parsing), it can take
      advantage of that information in skipping some string comparisons and
      using a constant-length memcmp instead of strcmp which needs to take
      care of NUL bytes.
      * src/regex.c (re_wctype): Delete function.  Replace it with:
      (re_wctype_parse): New function which parses a whole [:name:] string
      and returns a RECC_* constant or -1 if the string is not of [:name:]
      (regex_compile): Use re_wctype_parse.
      * src/syntax.c (skip_chars): Use re_wctype_parse.
    • Paul Eggert's avatar
      Fix use-after-close in connect_network_socket · 53917616
      Paul Eggert authored
      * src/process.c (connect_network_socket):
      Reverse sense of previous fix.  Problem reported by Ken Brown in:
  3. 30 Jul, 2016 2 commits
    • Martin Rudalics's avatar
      Fix calculation of tool bar width reported by `frame-geometry' (Bug#24107) · 8cbaf342
      Martin Rudalics authored
      * src/w32fns.c (Fw32_frame_geometry): Fix calculation of tool
      bar width (Bug#24107).  Reindent.
      * src/xfns.c (frame_geometry): Fix calculation of tool bar
      width on non-GTK builds.
    • Eli Zaretskii's avatar
      Avoid warnings about undo list while decoding · 9c542a23
      Eli Zaretskii authored
      * src/coding.c (coding_restore_undo_list): New function.
      (decode_coding_gap, decode_coding_object): Temporarily set the
      buffer's undo list to t, to avoid warnings when decoding changes
      the buffer many times, e.g. due to post-read-conversion.  Use
      coding_restore_undo_list to make sure the undo list is restored.
  4. 27 Jul, 2016 1 commit
  5. 26 Jul, 2016 1 commit
    • Eli Zaretskii's avatar
      Avoid segfaults in compute_motion · c54238db
      Eli Zaretskii authored
      * src/indent.c (compute_motion): Don't turn on and don't use the
      width cache unless the buffer's width-table is non-nil.  This
      avoids segfaults because code that uses the width cache assumes
      the width-table exists.  (Bug#24064)
  6. 25 Jul, 2016 1 commit
    • Michal Nazarewicz's avatar
      Fix ‘[[🇨🇨]]*literal’ regex failing to match ‘literal’ (bug#24020) · 6dc6b007
      Michal Nazarewicz authored
      The regex engine tries to optimise Kleene star by avoiding backtracking
      when it can detect that star’s operand cannot match what follows it in
      the pattern.
      For example, when ‘[[:alpha:]]*1’ tries to match a ‘foo’, the engine
      will test the longest match for ‘[[:alpha:]]*’, namely ’foo’ which is
      the entire string.  Literal digit one still present in the pattern will
      however not match the remaining empty string.
      Normally, backtracking would be performed trying a shorter match for the
      character class (namely ‘fo’ leaving ‘o’ in the string), but since the
      engine knows whatever would be put back into the string cannot possibly
      match literal digit one so no backtracking will be attempted.
      In the regexes of the form ‘[[:CC:]]*X’, the optimisation can be applied
      if the character class CC does not match character X.  In the above
      example, this holds because digit one is not in alpha character class.
      This test is performed by mutually_exclusive_p function but it did not
      check class bits of a charset opcode.  This resulted in an assumption
      that character classes do not match multibyte characters.  For example,
      it would incorrectly conclude that [[:alpha:]] doesn’t match ‘ż’.
      This, in turn, led to the aforementioned Kleene star optimisation being
      incorrectly applied in patterns such as ‘[[:graph:]]*’ (which should
      match ‘’ but doesn’t as can be tested by executing
          (string-match-p "[[:graph:]]*" "")
      which should return 0 but instead yields nil.
      This issue affects any class witch matches multibyte characters, i.e.
      if ‘[[🇨🇨]]’ matches a multibyte character X then ‘[[🇨🇨]]*X’ will
      fail to match ‘X’.
      * src/regex.c (executing_charset): A new function for executing the
      charset and charset_not opcodes.  It performs check on the character
      taking into consideration existing bitmap, range table and class bits.
      It also advances the pointer in the regex bytecode past the parsed
      Code now included in executing_charset.
      (mutually_exclusive_p, re_match_2_internal): Changed to take advantage
      of executing_charset function.
      * test/src/regex-tests.el: New file with tests for the character class
  7. 24 Jul, 2016 1 commit
    • Paul Eggert's avatar
      ‘signal’ no longer returns · 50cc08bf
      Paul Eggert authored
      Although for decades ‘signal’ has been documented to not return,
      a corner case in the Lisp debugger causes ‘signal’ to return.
      Remove the corner case and adjust Emacs internals accordingly.
      An alternative would be to document the corner case, but this
      would complicate the Lisp API unnecessarily.  (Bug#24047)
      * src/eval.c (signal_or_quit): New function, with most of the
      old contents of Fsignal.
      (quit): New function, which uses signal_or_quit and which
      might return.  All keyboard-based callers of Fsignal (Qquit,
      Qnil) changed to use this new function instead.
      (Fsignal): Use signal_or_quit.  Now _Noreturn.  All callers
      (xsignal): Move to lisp.h.
      * src/lisp.h (xsignal): Now an inline function, as it's now
      just an alias for Fsignal.
  8. 21 Jul, 2016 2 commits
  9. 20 Jul, 2016 4 commits
    • Paul Eggert's avatar
      Fix lifetime bug in tzlookup · 852111f3
      Paul Eggert authored
      * src/editfns.c (tzlookup): Fix storage lifetime bug when
      INTEGERP (zone) && settz.  Problem found by Coverity Scan.
    • Paul Eggert's avatar
      Remove CHECK_FRAME_FONT cruft from bytecode.c · 60dd094a
      Paul Eggert authored
      * src/bytecode.c [CHECK_FRAME_FONT]: Do not include frame.h, xterm.h.
      Remove some old ‘#if 0’ code.
    • Paul Eggert's avatar
      Work around GCC bug 54561 in a better way · 3e71e437
      Paul Eggert authored
      The new approach is less selective, but also less intrusive on C code.
      * src/bytecode.c, src/image.c, src/keyboard.c: Ignore -Wclobbered.
      * src/conf_post.h (NONVOLATILE): Remove.  All uses removed.
    • Paul Eggert's avatar
      Fix port to glibc 2.24 (pre-release) + ppc64 · 63750fd4
      Paul Eggert authored
      * src/callproc.c (child_setup): Use emacs_exec_file
      so that ASLR is enabled in the child process.
      * src/emacs.c: Move some personality details into sys/sysdep.c.
      Do not include <sys/personality.h>.
      (main): Disable ASLR earlier, so that we don’t chdir twice.
      * src/lisp.h (disable_address_randomization): New decl.
      * src/sysdep.c (disable_address_randomization)
      [HAVE_PERSONALITY_ADDR_NO_RANDOMIZE]: Move personality details
      here from emacs.c.
      (emacs_exec_file): New function.
  10. 19 Jul, 2016 3 commits
    • Alan Third's avatar
      Prevent bar cursor overwriting next glyph (bug#16856) · bf5ddded
      Alan Third authored
      * src/nsterm.m (ns_draw_window_cursor): Test glyph width vs cursor width
      before setting final size.
    • Paul Eggert's avatar
      ; Spelling fix · a80ee12a
      Paul Eggert authored
    • Eli Zaretskii's avatar
      Fix 'transpose-regions' when LEAVE-MARKERS arg is non-nil · 00b66476
      Eli Zaretskii authored
      * src/insdel.c (adjust_markers_bytepos): New function.
      * src/lisp.h (adjust_markers_bytepos): Add prototype.
      * src/insdel.c (replace_range, replace_range_2):
      * src/editfns.c (Ftranspose_regions): Call
      adjust_markers_bytepos.  (Bug#5131)
      * test/src/editfns-tests.el (transpose-test-reverse-word)
      (transpose-test-get-byte-positions): New functions.
      (transpose-nonascii-regions-test-2): New tests.
  11. 18 Jul, 2016 1 commit
    • Noam Postavsky's avatar
      Keep w32 environment settings internal only · 73f0715d
      Noam Postavsky authored
      * src/emacs.c (main) [WINDOWSNT]: Move init_environment calls after the
      set_initial_environment call.  This prevents Emacs' modifications to the
      environment from contaminating Vprocess_environment and
      Vinitial_environment (Bug #10980).
      * src/callproc.c (getenv_internal) [WINDOWSNT]: Consult Emacs' internal
      environment in as a fallback to Vprocess_environment.
      * test/src/callproc-tests.el (initial-environment-preserved): New Test.
  12. 17 Jul, 2016 1 commit
  13. 16 Jul, 2016 1 commit
  14. 15 Jul, 2016 4 commits
    • Paul Eggert's avatar
      Stop worrying about Alliant in bytecode.c · 9569916d
      Paul Eggert authored
      * src/bytecode.c (PUSH): Remove workaround for long-obsolete compiler.
    • Paul Eggert's avatar
      Remove BYTE_MAINTAIN_TOP · 4ba72d32
      Paul Eggert authored
      It is no longer needed now that we assume GC_MARK_STACK ==
      * src/bytecode.c (BYTE_MAINTAIN_TOP): Remove.
      All uses removed, and code simplified accordingly.
      are always no-ops now.  All uses removed.
      (MAYBE_GC): Remove.  All uses replaced by maybe_gc,
      since it is now equivalent.
    • Paul Eggert's avatar
      Remove now-inaccurate bytecode comments · 1873ef3b
      Paul Eggert authored
      * src/bytecode.c: Remove comments that are no longer accurate.
      Most of these are actually old ChangeLog entries.
    • Paul Eggert's avatar
      Port to glibc 2.24 (pre-release) + ppc64 · e95b0231
      Paul Eggert authored
      Inspired by a suggestion by Florian Weimer in:
      Rename from HAVE_PERSONALITY_LINUX32, and check for
      ADDR_NO_RANDOMIZE (the crucial thing) instead of for LINUX32.
      All uses changed.
      * src/emacs.c (main) [HAVE_PERSONALITY_ADDR_NO_RANDOMIZE]:
      Use ADDR_NO_RANDOMIZE from personality.h rather than inventing the
      flag ourselves.  Just set that flag, rather than also setting the
      persona.  When doing it, avoid functions like putenv that may
      allocate memory.
  15. 14 Jul, 2016 1 commit
  16. 13 Jul, 2016 2 commits
  17. 12 Jul, 2016 4 commits
    • John Wiegley's avatar
      Revert "Cleanup tooltips" · 54b7eb0d
      John Wiegley authored
      This reverts commit 20038f8a.
      I am reverting this change because it was applied without prior discussion
      on emacs-devel, and has been found to break the NS port.  It needs more
      testing and review before it should be applied here.
    • Eli Zaretskii's avatar
      Don't install keyboard hook when debugged on MS-Windows · 1048151c
      Eli Zaretskii authored
      * src/w32fns.c (setup_w32_kbdhook): Don't install the keyboard
      hook if we are being debugged.  This avoids hosing the debugger,
      because the hook is global, and is called in the context of the
      thread which installed it, and that thread is stopped when GDB has
      control.  Reported by Fabrice Popineau <fabrice.popineau@gmail.com>.
    • Dmitry Antipov's avatar
      Cleanup tooltips · 20038f8a
      Dmitry Antipov authored
      * src/dispextern.h (toplevel): Remove 'tip_frame' and 'tip_window' decls.
      * src/frame.h (struct frame): New bitfield to indicate tooltip frame.
      (FRAME_TOOLTIP_P): New macro.
      * src/frame.c (make_frame): Mark new frame as regular frame by default.
      (Fframe_list, delete_frame): Redesign to use FRAME_TOOLTIP_P.
      (syms_of_frame): Don't DEFSYM 'Qtooltip' but use 'Qtooltip_timer'
      and 'Qtooltip_parameters' instead.
      * src/gtkutil.h (toplevel): Add 'xg_hide_tip' decl.
      * src/gtkutil.c (xg_hide_tip): New function.
      (xg_hide_tooltip): Adjust to cancel GTK event loop timeout if needed.
      * src/menu.c (Fx_popup_menu): Adjust call to Fx_hide_tip.
      * src/nsfns.c (toplevel): Remove 'tip_frame' leftover.
      * src/w32fns.c (unwind_create_tip_frame): Remove.
      (w32_display_monitor_attributes_list_fallback): Use FRAME_TOOLTIP_P.
      (toplevel): Remove 'tip_frame', 'tip_window' and 'last_show_tip_args'.
      (x_create_tip_frame): Use do_unwind_create_frame.  Mark new frame
      as a tooltip frame and record it using appropriate display info.
      (x_hide_tooltip): Add frame arg.
      (Fx_show_tip): Adjust to avoid globals, store tooltip parameters among
      base frame parameters, store tooltip hide timer among tooltip frame
      (Fx_hide_tip): Add frame arg, hide tooltips on all displays by default.
      (syms_of_w32fns): Don't DEFSYM 'Qtip_frame', don't initialize
      and GC-protect 'tip_timer', 'tip_frame' and 'last_show_tip_args'.
      * src/w32term.c (w32_read_socket): Extract tooltip window id from
      per-display data.  Use FRAME_TOOLTIP_P where appropriate.
      (x_new_font): Use FRAME_TOOLTIP_P.
      (x_free_frame_resources): Reset pointer to tooltip frame.
      * src/w32term.h (struct w32_display_info): New member 'w32_tooltip_frame'.
      * src/xdisp.c (init_iterator, x_consider_frame_title, prepare_menu_bars):
      * src/xfns.c (x_make_monitor_attribute_list)
      (Fx_display_monitor_attributes_list): Likewise.
      (unwind_create_tip_frame): Remove.
      (toplevel): Remove 'tip_frame', 'tip_window' and 'last_show_tip_args'.
      (x_create_tip_frame): Use do_unwind_create_frame.  Mark new frame
      as a tooltip frame and record it using appropriate display info.
      (x_hide_tooltip): Add frame arg.
      (Fx_show_tip): Adjust to avoid globals, store tooltip parameters among
      base frame parameters, store tooltip hide timer among tooltip frame
      parameters.  To hide GTK system tooltip, use timeout hooked into GTK
      event loop.
      (Fx_hide_tip): Add frame arg, hide tooltips on all displays by default.
      (syms_of_xfns): Don't DEFSYM 'Qtip_frame', don't initialize
      and GC-protect 'tip_timer', 'tip_frame' and 'last_show_tip_args'.
      * src/xterm.c (handle_one_xevent): Extract tooltip window id from
      per-display data.  Use FRAME_TOOLTIP_P where appropriate.
      (x_new_font, x_set_window_size): Use FRAME_TOOLTIP_P.
      (x_free_frame_resources): Reset pointer to tooltip frame.
      * src/xterm.h (struct x_display_info): New member 'x_tooltip_frame'.
      (struct x_output) [USE_GTK_TOOLTIP]: New member 'ttip_timeout'.
    • Stefan Monnier's avatar