1. 23 Nov, 2015 4 commits
  2. 22 Nov, 2015 6 commits
    • Eli Zaretskii's avatar
      Allow loading modules by 'load-file' · 40ed767b
      Eli Zaretskii authored
      * src/lread.c (Fload): Call 'unbind_to' with 'Fmodule_load' as the
      2nd arg, to avoid the "binding stack not balanced" error.
      (syms_of_lread) <module-file-suffix>: New Lisp variable.
      
      * lisp/files.el (module-file-suffix): Declare.
      (load-file): Remove 'module-file-suffix' from
      'completion-ignored-extensions', to allow completion on modules.
      
      * etc/NEWS: Mention 'module-file-suffix'.
      40ed767b
    • Eli Zaretskii's avatar
      Fix unoptimized builds · 9f0d19f2
      Eli Zaretskii authored
      * src/lisp.h (XTYPE): Move before XSYMBOL, to fix unoptimized
      builds.
      9f0d19f2
    • Dmitry Gutov's avatar
      Work around the asynchronous-empty-diff problem · 2a4362ba
      Dmitry Gutov authored
      * lisp/vc/vc-rcs.el (vc-rcs-diff):
      * lisp/vc/vc-mtn.el (vc-mtn-diff):
      * lisp/vc/vc-hg.el (vc-hg-diff):
      * lisp/vc/vc-git.el (vc-git-diff): Ignore the ASYNC argument,
      do a synchronous process call (bug#21969).
      2a4362ba
    • Karl Fogel's avatar
      Finish excising electric indent from `open-line' · 8726de66
      Karl Fogel authored
      * lisp/simple.el (open-line): Remove INTERACTIVE argument.
      
      * test/automated/simple-test.el (open-line-indent, open-line-hook):
        Adjust accordingly.
      
      This change finishes what my commit of Thu Nov 19 17:32:37 2015 -0600
      (git commit c5935389) started.  It turns out that having INTERACTIVE
      cause `post-self-insert-hook' to run (via `newline') meant `open-line'
      still had the electric indent behavior, as `post-self-insert-hook'
      normally contains `electric-indent-post-self-insert-function' ever
      since `electric-indent-mode' has been on by default.  Tracing the code
      change in `open-line' is mildly twisty, because Artur Malabarba's
      earliest two commits of 24 Oct 2015 first removed the `interactive'
      form entirely (git commit 6939896e) and then restored it with the new
      extra "p" already added (git commit bd4f04f8), such that there is no
      single-commit diff in which one sees the second "p" appear.  Thus this
      change is effectively a reversion of parts of each of those commits.
      
      This could close bug#21884, at least until further discussion.
      8726de66
    • Dmitry Gutov's avatar
      Adhere closer to the "implicit tag name" definition · 51fd4a01
      Dmitry Gutov authored
      * lisp/progmodes/etags.el (etags-tags-completion-table):
      Adhere closer to the "implicit tag name" definition.  Simplify
      the regexp.  Search for the explicit tag name first, and when
      not found, search locally for the implicit one.  (Bug#21934)
      51fd4a01
    • Stefan Monnier's avatar
      Unrevert most of regexp reentrancy abort patch · 702d76db
      Stefan Monnier authored
      The problem was in:
        * src/syntax.c (update_syntax_table_forward): Propertize even when truncated
      which is hence not unreverted.
      The rest is:
      * src/syntax.h (UPDATE_SYNTAX_TABLE_FORWARD_FAST):
      (UPDATE_SYNTAX_TABLE_FAST): Re-introduce.
      All callers in regex.c changed back to the _FAST versions.
      
      * test/automated/message-mode-tests.el: Tweak the test to rely on auto
      propertization in backward-sexp.
      702d76db
  3. 21 Nov, 2015 8 commits
    • Paul Eggert's avatar
      Revert regexp reentrancy abort patch · 8e84823f
      Paul Eggert authored
      Although the patch does fix Bug#21688 and prevents a core dump,
      it also makes the message-mode-propertize test fail; see:
      http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg01667.html
      Perhaps someone else can come up with a better fix some day.
      * src/syntax.c (update_syntax_table_forward):
      Propertize even when truncated.
      * src/syntax.h (UPDATE_SYNTAX_TABLE_FORWARD_FAST):
      (UPDATE_SYNTAX_TABLE_FAST): Remove.
      All callers changed back to the non-_FAST versions.
      8e84823f
    • Paul Eggert's avatar
      Add a few safety checks when ENABLE_CHECKING · 8afaa132
      Paul Eggert authored
      This was motivated by the recent addition of module code,
      which added some ENABLE_CHECKING-enabled checks that are
      useful elsewhere too.
      * src/alloc.c (compact_font_cache_entry):
      * src/fns.c (sweep_weak_table):
      * src/lread.c (oblookup):
      Use gc_asize rather than doing it by hand.
      * src/emacs-module.c (module_make_global_ref)
      (module_free_global_ref, module_vec_size):
      Omit assertions that lisp.h now checks.
      * src/lisp.h (XFASTINT, ASIZE): In functional implementations,
      check that the result is nonnegative.  Use eassume, as this
      info can help a bit when optimizing production code.
      (XSYMBOL) [!USE_LSB_TAG]: Assert that argument is a symbol,
      to be consistent with the USE_LSB_TAG case.
      (gc_asize): New function, when ASIZE is needed in the gc.
      (gc_aset): Use it.
      (HASH_TABLE_P): Move definition up, so that it can be used ...
      (XHASH_TABLE): ... here, to assert that the arg is a hash table.
      8afaa132
    • Eli Zaretskii's avatar
      Simplify recording of main thread's ID on MS-Windows · d696d62f
      Eli Zaretskii authored
      * src/w32term.c (w32_initialize):
      * src/w32console.c (initialize_w32_display):
      * src/w32fns.c (globals_of_w32fns): Don't record the main thread
      ID independently for each type of session (GUI, TTY, batch).
      * src/w32term.c (w32_init_main_thread): New function, records the
      main thread's thread ID.
      * src/w32term.h: Add prototype for w32_init_main_thread.
      * src/emacs.c (main) [WINDOWSNT]: Call w32_init_main_thread.
      
      * src/emacs-module.c [WINDOWSNT]: Rename main_thread_id to
      main_thread, for consistency with other threading libraries.  All
      users changed.  Include w32term.h.
      (check_main_thread) [WINDOWSNT]: Simplify the test: no need to
      make sure the main thread is alive, as we hold a handle on it
      opened by w32_init_main_thread.
      (module_init) [WINDOWSNT]: Reuse the thread ID recorded by
      w32_init_main_thread, instead of calling the requisite APIs once
      more.
      d696d62f
    • Mark Oteiza's avatar
      Backport: Fix issue where a new tempfile was created every refresh · e6b1818f
      Mark Oteiza authored
      * lisp/mpc.el (mpc-format): Leave dir as relative path
      e6b1818f
    • Eli Zaretskii's avatar
      ; * src/lread.c (Fload): Fix last change. · 3c407d29
      Eli Zaretskii authored
      3c407d29
    • Eli Zaretskii's avatar
      Call 'window-size-change-functions' for mini-windows · 3ca44a1a
      Eli Zaretskii authored
      * src/window.c (grow_mini_window, shrink_mini_window): Set the
      frame's 'window_sizes_changed' flag.
      * src/xdisp.c (redisplay_internal): Call the hooks on
      'window-size-change-functions' if the call to 'echo_area_display'
      sets the frame's 'window_sizes_changed' flag.
      (syms_of_xdisp) <window-size-change-functions>:
      Update doc string to indicate the mini-window resizes trigger a
      call to the hooks, and don't promise that will happen "before
      redisplay".  (Bug#19576, Bug#21333)
      
      * doc/lispref/windows.texi (Window Hooks): Update the description
      of 'window-size-change-functions'.
      3ca44a1a
    • Eli Zaretskii's avatar
      Improve documentation of dynamic modules · 3858b794
      Eli Zaretskii authored
      * src/fns.c (Frequire): Doc fix to include the dynamic module
      support.
      * src/lread.c (Fload, Vload_suffixes): Doc fixes to include the
      dynamic module support.
      (Fload): Treat the module suffix the same as '*.el' and '*.elc'
      wrt the MUST-SUFFIX argument.
      
      * etc/NEWS: Expand documentation of dynamically loaded modules.
      3858b794
    • Philipp Stephani's avatar
      Initial documentation for dynamic modules · 22992678
      Philipp Stephani authored
      * etc/NEWS: Mention the new support for dynamically loaded modules.
      
      Copyright-paperwork-exempt: yes
      22992678
  4. 20 Nov, 2015 17 commits
    • Dmitry Gutov's avatar
      Add xref--etags-backend to xref-backing-functions using add-hook · a5fd38c3
      Dmitry Gutov authored
      * lisp/progmodes/xref.el (xref-backend-functions): Move the
      default value into a separate `add-hook' call (bug#21964).
      
      * lisp/progmodes/elisp-mode.el (emacs-lisp-mode):
      Don't declare the xref-backend-functions variable.
      It doesn't make any difference.
      a5fd38c3
    • Paul Eggert's avatar
      Fix double-decrement bug when freeing global refs · 033811ce
      Paul Eggert authored
      * src/emacs-module.c (module_free_global_ref): Add a FIXME
      comment about error reporting.  Fix a recently-introduced typo
      that double-decremented the refcount.
      033811ce
    • Paul Eggert's avatar
      Declare emacs_module_init in the module API · d0e07e0e
      Paul Eggert authored
      * src/emacs-module.h (emacs_module_init): New decl.
      Without it, GCC might complain about a module that defines
      emacs_module_init without using it.  This also checks the
      API better.
      d0e07e0e
    • Paul Eggert's avatar
      Fix module test to use ptrdiff_t nargs too · 39d13206
      Paul Eggert authored
      * modules/mod-test/mod-test.c (Fmod_test_return_t)
      (Fmod_test_sum, Fmod_test_signal, Fmod_test_throw)
      (Fmod_test_non_local_exit_funcall, Fmod_test_globref_make)
      (Fmod_test_string_a_to_b, Fmod_test_userptr_make)
      (Fmod_test_userptr_get, Fmod_test_vector_fill)
      (Fmod_test_vector_eq): Arg counts are ptrdiff_t, not int.
      (finalizer): Remove; no longer used.
      39d13206
    • Paul Eggert's avatar
      Fix reindent-introduced typo in module code · 95f69f2c
      Paul Eggert authored
      * src/emacs-module.c (MODULE_SETJMP_1): Fix typo that I
      introduced while reindenting the code earlier, and add a
      comment explaining the unusual use of do-while here.
      95f69f2c
    • Anders Lindgren's avatar
      Fixed bug#19576: `write-file' saves wrong buffer. · 75a1d009
      Anders Lindgren authored
      If a function on the hook `window-size-change-functions' doesn't
      restore the current buffer, functions that save and restore the
      current window configuration (like `y-or-no-p') could silently
      change the current buffer.  When `write-file' asked the user
      confirmation to overwrite a file, `y-or-no-p' changed the current
      buffer, and the wrong buffer was saved to the file.
      
      * lisp/follow.el (follow-windows-start-end): Call `select-frame'
      using the `norecord' parameter.
      (follow-window-size-change): Restore current buffer. Call
      `select-frame' using the `norecord' parameter. Cleanup.
      75a1d009
    • John Wiegley's avatar
      eb3f6754
    • Stephen Leake's avatar
      9dcdf99d
    • Paul Eggert's avatar
      Module function arg counts are ptrdiff_t, not int · e61f1c3c
      Paul Eggert authored
      * src/emacs-module.c (struct module_fun_env)
      (module_make_function, module_funcall, Fmodule_call):
      * src/emacs-module.h (struct emacs_runtime, struct emacs_env_25):
      Use ptrdiff_t, not int, for arg counts.
      * src/emacs-module.c (module_make_function): Don’t bother
      checking arity against MOST_POSITIVE_FIXNUM, as that’s
      unnecessary here.  Make the checking clearer by negating it.
      (module_make_function, Fmodule_call): No need to use xzalloc
      since the storage doesn’t need to be cleared.
      (module_funcall): Don’t use VLA, since C11 doesn’t guarantee support
      for it, and many implementations are buggy with large VLAs anyway.
      Use SAFE_ALLOCA_LISP instead.
      (module_vec_set): Don’t crash if i < 0.
      (module_vec_get): Don’t crash if i < MOST_NEGATIVE_FIXNUM.
      (module_vec_set, module_vec_get): Do fixnum checks only when
      i is out of array bounds, for efficiency in the usual case.
      (Fmodule_load): Simplify fixnum range check.
      (Fmodule_call): Simplify arity check.  Use xnmalloc to detect
      integer overflow in array allocation size.
      e61f1c3c
    • Eli Zaretskii's avatar
      Minor improvements in module test · c0c309e4
      Eli Zaretskii authored
      * modules/mod-test/mod-test.c: Include stdlib.h, to avoid warnings
      about missing prototype of malloc.
      * modules/mod-test/Makefile (CFLAGS): Add -std=gnu99, to avoid
      compiler warnings.
      c0c309e4
    • Eli Zaretskii's avatar
      Improve MS-Windows implementation in dynlib.c · 24be1c84
      Eli Zaretskii authored
      * src/dynlib.c [WINDOWSNT]: Include errno.h, lisp.h, and w32.h.
      No need to include windows.h, as w32.h already does that.
      <dynlib_last_err>: New static variable.
      (dynlib_reset_last_error): New function.
      (dynlib_open): Convert forward slashes to backslashes.  Convert
      file names from UTF-8 to either UTF-16 or the current ANSI
      codepage, and call either LoadLibraryW or LoadLibraryA.  If the
      argument is NULL, return a handle to the main module, like
      'dlopen' does.  Record the error, if any, for use by dynlib_error.
      (dynlib_sym): Check the handle for validity. Record the error, if
      any, for use by dynlib_error.
      (dynlib_error): Call w32_strerror to produce the error string, and
      zero out the last error code, like dlerror does.
      (dynlib_close): Check the handle for validity.  Record the error,
      if any, for use by dynlib_error.  Don't call FreeLibrary with a
      handle for the main module.
      * src/w32.c (globals_of_w32): Call dynlib_reset_last_error.
      24be1c84
    • Eli Zaretskii's avatar
      ; Update the description of Windows 10 pinned icon issue · bd715e3d
      Eli Zaretskii authored
      * etc/PROBLEMS: Mention that the issue was fixed in later
      Windows 10 builds.
      bd715e3d
    • Paul Eggert's avatar
      Include-file tweaks for modules · c69cec40
      Paul Eggert authored
      * src/dynlib.c, src/emacs-module.c: Include <config.h> first.
      * src/dynlib.h: Do not include config.h.
      It’s every .c file’s responsibility to include config.h first.
      * src/emacs-module.c: Include emacs-module.h immediately after
      config.h, to test that emacs-module.h doesn’t depend on
      include files other than config.h.
      c69cec40
    • Paul Eggert's avatar
      Simplify push_handler and profile its malloc · aa7dac89
      Paul Eggert authored
      * src/lisp.h (PUSH_HANDLER): Remove.
      All callers changed to use push_handler directly.
      * src/eval.c (internal_condition_case)
      (internal_condition_case_1, internal_condition_case_2)
      (internal_condition_case_n):
      Use same pattern as for other invokers of push_handler.
      (push_handler, push_handler_nosignal): Use call-by-value
      instead of call-by-reference.  All uses changed.
      (push_handler): Simplify by rewriting in terms of
      push_handler_nosignal.
      (push_handler_nosignal): Profile any newly allocated memory.
      aa7dac89
    • Paul Eggert's avatar
      de67fa42
    • Juanma Barranquero's avatar
      Discover repository version in linked worktrees (bug#21930) · c210b8b1
      Juanma Barranquero authored
      * lisp/version.el (emacs-repository--version-git-1): Do not assume
      HEAD is at .git/HEAD, it can also be at .git/worktrees/<branch>/HEAD.
      (emacs-repository-get-version): Grok linked worktrees when EXTERNAL
      is nil too.
      c210b8b1
    • Juri Linkov's avatar
      * lisp/replace.el (occur-regexp-descr): New function. · 32845e3a
      Juri Linkov authored
      (occur-1, occur-engine): Use it.
      
      * lisp/isearch.el (isearch-occur): Propertize regexp with
      isearch-string and isearch-regexp-function-descr for
      occur-regexp-descr to display the correct description
      message in the header (bug#21176, bug#21180).
      32845e3a
  5. 19 Nov, 2015 5 commits
    • Karl Fogel's avatar
      Revert `open-line' electric-indent sensitivity · c5935389
      Karl Fogel authored
      * lisp/simple.el (open-line): Remove electric indent code.
        (electric-indent-just-newline): Don't declare.
      
      * test/automated/simple-test.el (open-line-indent): Adjust test.
      
      This partly reverts Artur Malabarba's change that added electric
      indent sensitivity to `open-line' (Oct 24 22:26:27 2015 +0100, git
      commit bd4f04f8), and adjusts a new test he added right afterwards
      (Sat Oct 24 23:43:06 2015 +0100, git commit 207f235e) accordingly.
      However, the new INTERACTIVE argument to `open-line', which he also
      added in the first commit, is not reverted here.
      
      See the thread "Questioning the new behavior of `open-line'." on the
      Emacs Devel mailing list, and in particular this message:
      
        From: Artur Malabarba
        Subject: Re: Questioning the new behavior of `open-line'.
        To: Karl Fogel
        Cc: David Kastrup, Pierpaolo Bernardi, emacs-devel
        Date: Wed, 18 Nov 2015 21:03:58 +0000
        Message-ID: \
          <CAAdUY-KN06pvCMy5bt3+Buk3yeKjf6n9iB2FaSTTOPpCqPwyhA@mail.gmail.com>
      
        https://lists.gnu.org/archive/html/emacs-devel/2015-11/msg01707.html
      c5935389
    • Paul Eggert's avatar
      Omit unnecessary clear in Fmodule_load · d81b0e13
      Paul Eggert authored
      * src/emacs-module.c (Fmodule_load):
      Simplify and avoid unnecessary initialization of priv member to 0.
      
      * src/emacs-module.c: (module_vec_set, module_vec_get, module_vec_size)
      d81b0e13
    • Paul Eggert's avatar
      Prefer signed integer types in module code · 92949781
      Paul Eggert authored
      Generally speaking, at the C level the Emacs source code prefers
      signed types like ‘ptrdiff_t’ to unsigned types like ‘size_t’,
      partly to avoid the usual signedness confusion when comparing values.
      Change the module API to follow this convention.
      Use ‘int’ for small values that can’t exceed INT_MAX.
      * modules/mod-test/mod-test.c (Fmod_test_globref_make)
      (Fmod_test_string_a_to_b, Fmod_test_vector_fill)
      (Fmod_test_vector_eq):
      * src/emacs-module.c (struct emacs_value_frame)
      (module_make_global_ref, module_free_global_ref)
      (module_copy_string_contents, module_make_string)
      (module_vec_set, module_vec_get, module_vec_size):
      * src/emacs-module.h (struct emacs_runtime, struct emacs_env_25):
      * src/lread.c (suffix_p):
      Prefer signed to unsigned integer types.
      92949781
    • Paul Eggert's avatar
      Omit ‘const’ on locals · d9b300af
      Paul Eggert authored
      Remove ‘const’ qualifier from locals that were newly added.
      We don’t normally bother declaring locals with ‘const’ even
      though they are not modified, for the same reason we don’t
      bother declaring them with ‘register’ even though their
      addresses are not taken; the advantage in compile-time
      checking isn’t worth the loss of readability.
      * modules/mod-test/mod-test.c (Fmod_test_non_local_exit_funcall)
      (Fmod_test_vector_fill, Fmod_test_vector_eq):
      * src/emacs-module.c (MODULE_SETJMP_1)
      (module_make_global_ref, module_free_global_ref)
      (module_non_local_exit_get, module_make_function)
      (module_extract_integer, module_extract_float)
      (module_get_user_ptr, module_set_user_ptr)
      (module_get_user_finalizer, module_set_user_finalizer)
      (module_vec_get, Fmodule_call)
      (module_non_local_exit_signal_1)
      (module_non_local_exit_throw_1, lisp_to_value)
      (finalize_storage, allocate_emacs_value, mark_modules)
      (module_handle_signal, module_handle_throw)
      (module_format_fun_env):
      * src/eval.c (push_handler, push_handler_nosignal)
      (init_handler):
      * src/lread.c (suffix_p):
      Omit unnecessary ‘const’.
      d9b300af
    • Paul Eggert's avatar
      Prefer intmax_t to int64_t in module code · 68d58e69
      Paul Eggert authored
      * modules/mod-test/mod-test.c (sum, Fmod_test_sum):
      * src/emacs-module.c (module_extract_integer)
      (module_make_integer):
      * src/emacs-module.h (struct emacs_env_25):
      Prefer intmax_t to int64_t.  This doesn’t change the generated
      code on any of the machines Emacs currently ports to, but it’s
      at least in theory more future-proof as C99 doesn’t guarantee
      that int64_t exists.
      68d58e69