1. 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
  2. 19 Nov, 2015 17 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
    • Paul Eggert's avatar
      Rename module.c to emacs-module.c, etc. · f2c00259
      Paul Eggert authored
      * src/emacs-module.c: Rename from src/module.c.
      * src/emacs-module.h: Rename from src/module.h.
      All uses changed.
      f2c00259
    • Paul Eggert's avatar
      Fix minor module problems found by static checking · 62d787ed
      Paul Eggert authored
      * src/dynlib.c (dynlib_close): #ifdef out for now, as it’s not used.
      * src/eval.c, src/lisp.h (lisp_eval_depth): Now static.
      * src/module.c (Fmodule_load): Fix pointer signedness bug.
      (Fmodule_call): Tell GCC that the default case is unreachable.
      62d787ed
    • Paul Eggert's avatar
      Style fixes for indenting etc. in module code · c8a972b0
      Paul Eggert authored
      This is mostly indenting and spacing changes.  Also, remove
      some unnecessary static decls instead of bothering to reindent them.
      * src/module.h (EMACS_EXTERN_C_BEGIN): Remove, and do this inline,
      as most other Emacs files do for this sort of thing.
      c8a972b0
    • Eli Zaretskii's avatar
      Minor improvements in modules testing Makefile · 7cd728c8
      Eli Zaretskii authored
      * modules/mod-test/Makefile (EMACS, SO): New variables.
      (CFLAGS): When SO = dll, don't use -fPIC.
      (check): New target, runs the test.
      7cd728c8
    • Eli Zaretskii's avatar
      * .gitignore: Add "*.dll". · d4869dde
      Eli Zaretskii authored
      d4869dde
    • Paul Eggert's avatar
      Migrate modules/.gitignore into .gitignore · ca3bc790
      Paul Eggert authored
      * .gitignore: Add former contents of modules/.gitignore.
      * modules/.gitignore: Remove.
      ca3bc790
    • Paul Eggert's avatar
      Add copyright notices to module code · c8404f48
      Paul Eggert authored
      Put them in the usual format for GNU Emacs copyright notices.
      c8404f48
    • Paul Eggert's avatar
      Rename emacs_module.h to module.h · 80f19fb8
      Paul Eggert authored
      * src/module.h: Rename from src/emacs_module.h.
      All uses changed.
      80f19fb8
    • Juanma Barranquero's avatar
    • Juanma Barranquero's avatar
    • Alan Mackenzie's avatar
    • Dmitry Gutov's avatar
      Prioritize looking inside vc-parent-buffer over log-view-mode fallback · 3c5989da
      Dmitry Gutov authored
      * lisp/vc/vc.el (vc-deduce-fileset): Prioritize looking inside
      vc-parent-buffer over log-view-mode fallback (bug#21955).
      3c5989da
  3. 18 Nov, 2015 6 commits
    • Ken Brown's avatar
      e8bbdc46
    • Eli Zaretskii's avatar
      Fix MS-Windows build --with-modules · 520dc85f
      Eli Zaretskii authored
      * src/module.c: Reformat copyright commentary.
      (module_vec_get): Use explicit cast to size_t to avoid compiler
      warning in 32-bit builds.
      (check_main_thread) [WINDOWSNT]: Fix letter-case in Windows APIs.
      Compare thread IDs directly, as GetThreadId is not available
      before Windows Vista.
      (check_main_thread) [WINDOWSNT]: Duplicate the thread handle
      without using APIs and constants not available on XP and older
      systems.  Obtain and store the thread ID as well.
      520dc85f
    • Eli Zaretskii's avatar
    • Aurélien Aptel's avatar
      Add dynamic module test and helper script · 955e25db
      Aurélien Aptel authored
      
      
      Add 'modhelp.py' script (python2) to automate module testing and
      module generation.
      
      To build and test all modules in the modules/ dir
        $ ./modhelp.py test
      
      To generate a module from template code (good starting point)
        $ ./modhelp init mynewtestmodule
      
      See the script -h option for more documentation.
      
      * modules/modhelp.py: New module helper script.
      * modules/mod-test/Makefile: New file. Makefile for the test module.
      * modules/mod-test/mod-test.c: New file. Test module source file.
      * modules/mod-test/test.el: New file. ert test suite for the test module.
      * modules/.gitignore: New file. Local .gitignore file.
      Co-authored-by: default avatarPhilipp Stephani <phst@google.com>
      955e25db
    • Aurélien Aptel's avatar
      Make 'Fload' look for modules · 218caccd
      Aurélien Aptel authored
      'Fload' can now load dynamic modules. This also makes 'require' work.
      
      * src/lread.c:
        (suffix_p): New function.
        (Fload): Use 'suffix_p'.  Call 'Fmodule_load' when we try to load a file
        with a module suffix.
        (syms_of_lread): Append module suffix to 'Vload_suffixes'.
      218caccd
    • Aurélien Aptel's avatar
      Add dynamic module module support · 307e76c7
      Aurélien Aptel authored
      
      
      * configure.ac: Add '--with-modules' option.  Conditionally add
        dynlib.o and module.o to the list of objects.  Add any system
        specific flags to the linker flags to support dynamic libraries.
      * m4/ax_gcc_var_attribute.m4: Add autoconf extension to test gcc
        attributes.
      * src/Makefile.in: Conditionally add module objects and linker flags.
      * src/alloc.c (garbage_collect_1): protect module local values from
        GC.
      * src/lisp.h: Add 'module_init' and 'syms_of_module' prototypes.
      * src/emacs_module.h: New header file included by modules.  Public
        module API.
      * src/module.c: New module implementation file.
      Co-authored-by: default avatarPhilipp Stephani <phst@google.com>
      307e76c7