]> git.eshelyaron.com Git - emacs.git/log
emacs.git
9 years agoByte compiler: fix spurious warnings "might not be defined at runtime". fix/not-defined-at-runtime
Alan Mackenzie [Sat, 21 Nov 2015 18:43:57 +0000 (18:43 +0000)]
Byte compiler: fix spurious warnings "might not be defined at runtime".

Also initialize byte-compile-noruntime-functions between runs.

bytecomp.el (byte-compile-new-defuns): New variable.
(byte-compile-initial-macro-environment): For eval-when-compile: bind
byte-compile-unresolved-functions and byte-compile-new-defuns around
byte-compile-top-level, to prevent spurious entries being made.
(byte-compile-warn-about-unresolved-functions): Check whether function is in
byte-compile-new-defuns before emitting a warning about it.
(byte-compile-from-buffer): Initialize new variable and
byte-compile-noruntime-functions to nil.
(byte-compile-file-form-require): record all new functions defined by a
`require' in byte-compile-new-defuns.
(byte-compile-file-form-defmumble): record the new alias in
byte-compile-new-defuns.

9 years agoSimplify recording of main thread's ID on MS-Windows
Eli Zaretskii [Sat, 21 Nov 2015 17:44:02 +0000 (19:44 +0200)]
Simplify recording of main thread's ID on MS-Windows

* 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.

9 years agoBackport: Fix issue where a new tempfile was created every refresh
Mark Oteiza [Wed, 18 Nov 2015 18:42:40 +0000 (13:42 -0500)]
Backport: Fix issue where a new tempfile was created every refresh

* lisp/mpc.el (mpc-format): Leave dir as relative path

9 years ago; * src/lread.c (Fload): Fix last change.
Eli Zaretskii [Sat, 21 Nov 2015 12:01:25 +0000 (14:01 +0200)]
; * src/lread.c (Fload): Fix last change.

9 years agoCall 'window-size-change-functions' for mini-windows
Eli Zaretskii [Sat, 21 Nov 2015 11:30:30 +0000 (13:30 +0200)]
Call 'window-size-change-functions' for mini-windows

* 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'.

9 years agoImprove documentation of dynamic modules
Eli Zaretskii [Sat, 21 Nov 2015 10:49:57 +0000 (12:49 +0200)]
Improve documentation of dynamic modules

* 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.

9 years agoInitial documentation for dynamic modules
Philipp Stephani [Sat, 21 Nov 2015 09:47:32 +0000 (11:47 +0200)]
Initial documentation for dynamic modules

* etc/NEWS: Mention the new support for dynamically loaded modules.

Copyright-paperwork-exempt: yes

9 years agoAdd xref--etags-backend to xref-backing-functions using add-hook
Dmitry Gutov [Fri, 20 Nov 2015 23:57:00 +0000 (01:57 +0200)]
Add xref--etags-backend to xref-backing-functions using add-hook

* 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.

9 years agoFix double-decrement bug when freeing global refs
Paul Eggert [Fri, 20 Nov 2015 21:48:54 +0000 (13:48 -0800)]
Fix double-decrement bug when freeing global refs

* 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.

9 years agoDeclare emacs_module_init in the module API
Paul Eggert [Fri, 20 Nov 2015 20:20:26 +0000 (12:20 -0800)]
Declare emacs_module_init in the module API

* 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.

9 years agoFix module test to use ptrdiff_t nargs too
Paul Eggert [Fri, 20 Nov 2015 20:17:55 +0000 (12:17 -0800)]
Fix module test to use ptrdiff_t nargs too

* 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.

9 years agoFix reindent-introduced typo in module code
Paul Eggert [Fri, 20 Nov 2015 20:15:22 +0000 (12:15 -0800)]
Fix reindent-introduced typo in module code

* 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.

9 years agoFixed bug#19576: `write-file' saves wrong buffer.
Anders Lindgren [Fri, 20 Nov 2015 20:07:29 +0000 (21:07 +0100)]
Fixed bug#19576: `write-file' saves wrong buffer.

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.

9 years agoCorrect a documentation error in frames.texi
John Wiegley [Fri, 20 Nov 2015 19:24:21 +0000 (11:24 -0800)]
Correct a documentation error in frames.texi

9 years ago* lisp/cedet/mode-local.el: Delete obsolete comment
Stephen Leake [Fri, 20 Nov 2015 18:27:31 +0000 (12:27 -0600)]
* lisp/cedet/mode-local.el: Delete obsolete comment

9 years agoModule function arg counts are ptrdiff_t, not int
Paul Eggert [Fri, 20 Nov 2015 16:51:13 +0000 (08:51 -0800)]
Module function arg counts are ptrdiff_t, not int

* 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.

9 years agoMinor improvements in module test
Eli Zaretskii [Fri, 20 Nov 2015 11:37:25 +0000 (13:37 +0200)]
Minor improvements in module test

* 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.

9 years agoImprove MS-Windows implementation in dynlib.c
Eli Zaretskii [Fri, 20 Nov 2015 11:34:15 +0000 (13:34 +0200)]
Improve MS-Windows implementation in dynlib.c

* 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.

9 years ago; Update the description of Windows 10 pinned icon issue
Eli Zaretskii [Fri, 20 Nov 2015 09:08:40 +0000 (11:08 +0200)]
; Update the description of Windows 10 pinned icon issue

* etc/PROBLEMS: Mention that the issue was fixed in later
Windows 10 builds.

9 years agoInclude-file tweaks for modules
Paul Eggert [Fri, 20 Nov 2015 08:40:45 +0000 (00:40 -0800)]
Include-file tweaks for modules

* 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.

9 years agoSimplify push_handler and profile its malloc
Paul Eggert [Fri, 20 Nov 2015 04:09:11 +0000 (20:09 -0800)]
Simplify push_handler and profile its malloc

* 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.

9 years ago* src/emacs-module.h: Include stddef.h, not stdlib.h.
Paul Eggert [Fri, 20 Nov 2015 00:00:18 +0000 (16:00 -0800)]
* src/emacs-module.h: Include stddef.h, not stdlib.h.

9 years agoDiscover repository version in linked worktrees (bug#21930)
Juanma Barranquero [Thu, 19 Nov 2015 20:32:43 +0000 (21:32 +0100)]
Discover repository version in linked worktrees (bug#21930)

* 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.

9 years ago* lisp/replace.el (occur-regexp-descr): New function.
Juri Linkov [Fri, 20 Nov 2015 00:00:48 +0000 (02:00 +0200)]
* lisp/replace.el (occur-regexp-descr): New function.
(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).

9 years agoRevert `open-line' electric-indent sensitivity
Karl Fogel [Thu, 19 Nov 2015 23:32:37 +0000 (17:32 -0600)]
Revert `open-line' electric-indent sensitivity

* 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 bd4f04f86), and adjusts a new test he added right afterwards
(Sat Oct 24 23:43:06 2015 +0100, git commit 207f235e3) 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

9 years agoOmit unnecessary clear in Fmodule_load
Paul Eggert [Thu, 19 Nov 2015 23:24:30 +0000 (15:24 -0800)]
Omit unnecessary clear in Fmodule_load

* 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)

9 years agoPrefer signed integer types in module code
Paul Eggert [Thu, 19 Nov 2015 23:01:26 +0000 (15:01 -0800)]
Prefer signed integer types in module code

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.

9 years agoOmit ‘const’ on locals
Paul Eggert [Thu, 19 Nov 2015 22:24:50 +0000 (14:24 -0800)]
Omit ‘const’ on locals

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’.

9 years agoPrefer intmax_t to int64_t in module code
Paul Eggert [Thu, 19 Nov 2015 22:03:29 +0000 (14:03 -0800)]
Prefer intmax_t to int64_t in module code

* 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.

9 years agoRename module.c to emacs-module.c, etc.
Paul Eggert [Thu, 19 Nov 2015 21:50:23 +0000 (13:50 -0800)]
Rename module.c to emacs-module.c, etc.

* src/emacs-module.c: Rename from src/module.c.
* src/emacs-module.h: Rename from src/module.h.
All uses changed.

9 years agoFix minor module problems found by static checking
Paul Eggert [Thu, 19 Nov 2015 19:49:27 +0000 (11:49 -0800)]
Fix minor module problems found by static checking

* 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.

9 years agoStyle fixes for indenting etc. in module code
Paul Eggert [Thu, 19 Nov 2015 19:31:45 +0000 (11:31 -0800)]
Style fixes for indenting etc. in module code

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.

9 years agoMinor improvements in modules testing Makefile
Eli Zaretskii [Thu, 19 Nov 2015 17:49:29 +0000 (19:49 +0200)]
Minor improvements in modules testing Makefile

* modules/mod-test/Makefile (EMACS, SO): New variables.
(CFLAGS): When SO = dll, don't use -fPIC.
(check): New target, runs the test.

9 years ago* .gitignore: Add "*.dll".
Eli Zaretskii [Thu, 19 Nov 2015 17:21:50 +0000 (19:21 +0200)]
* .gitignore: Add "*.dll".

9 years agoMigrate modules/.gitignore into .gitignore
Paul Eggert [Thu, 19 Nov 2015 16:21:10 +0000 (08:21 -0800)]
Migrate modules/.gitignore into .gitignore

* .gitignore: Add former contents of modules/.gitignore.
* modules/.gitignore: Remove.

9 years agoAdd copyright notices to module code
Paul Eggert [Thu, 19 Nov 2015 16:14:00 +0000 (08:14 -0800)]
Add copyright notices to module code

Put them in the usual format for GNU Emacs copyright notices.

9 years agoRename emacs_module.h to module.h
Paul Eggert [Thu, 19 Nov 2015 15:53:51 +0000 (07:53 -0800)]
Rename emacs_module.h to module.h

* src/module.h: Rename from src/emacs_module.h.
All uses changed.

9 years ago* src/module.c (Fmodule_load): Remove unused vars `doc_name', `args'
Juanma Barranquero [Thu, 19 Nov 2015 10:07:10 +0000 (11:07 +0100)]
* src/module.c (Fmodule_load): Remove unused vars `doc_name', `args'

9 years ago* src/lread.c (Fload): Remove unused variable `size'
Juanma Barranquero [Thu, 19 Nov 2015 10:02:38 +0000 (11:02 +0100)]
* src/lread.c (Fload): Remove unused variable `size'

9 years agosrc/keyboard.c (pre-command-hook): Fix typo in doc string: "pre" -> "post".
Alan Mackenzie [Thu, 19 Nov 2015 09:38:48 +0000 (09:38 +0000)]
src/keyboard.c (pre-command-hook): Fix typo in doc string: "pre" -> "post".

9 years agoPrioritize looking inside vc-parent-buffer over log-view-mode fallback
Dmitry Gutov [Thu, 19 Nov 2015 01:37:55 +0000 (03:37 +0200)]
Prioritize looking inside vc-parent-buffer over log-view-mode fallback

* lisp/vc/vc.el (vc-deduce-fileset): Prioritize looking inside
vc-parent-buffer over log-view-mode fallback (bug#21955).

9 years ago* configure.ac (LIBMODULES): Don’t define on Cygwin
Ken Brown [Wed, 18 Nov 2015 20:17:58 +0000 (15:17 -0500)]
* configure.ac (LIBMODULES): Don’t define on Cygwin

9 years agoFix MS-Windows build --with-modules
Eli Zaretskii [Wed, 18 Nov 2015 20:09:08 +0000 (22:09 +0200)]
Fix MS-Windows build --with-modules

* 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.

9 years ago; * admin/release-process: Minor copyedits and additions.
Eli Zaretskii [Wed, 18 Nov 2015 19:33:12 +0000 (21:33 +0200)]
; * admin/release-process: Minor copyedits and additions.

9 years agoAdd dynamic module test and helper script
Aurélien Aptel [Mon, 16 Nov 2015 00:00:25 +0000 (01:00 +0100)]
Add dynamic module test and helper script

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: Philipp Stephani <phst@google.com>
9 years agoMake 'Fload' look for modules
Aurélien Aptel [Sun, 15 Nov 2015 23:53:15 +0000 (00:53 +0100)]
Make 'Fload' look for modules

'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'.

9 years agoAdd dynamic module module support
Aurélien Aptel [Sun, 15 Nov 2015 23:47:04 +0000 (00:47 +0100)]
Add dynamic module module support

* 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: Philipp Stephani <phst@google.com>
9 years agoAdd new User Pointer (User_Ptr) type
Aurélien Aptel [Sun, 15 Nov 2015 23:42:14 +0000 (00:42 +0100)]
Add new User Pointer (User_Ptr) type

* src/lisp.h: Add new Lisp_Misc_User_Ptr type.
(XUSER_PTR): New User_Ptr accessor.
* src/alloc.c (make_user_ptr): New function.
(mark_object, sweep_misc): Handle Lisp_Misc_User_Ptr.
* src/data.c (Ftype_of): Return 'user-ptr' for user pointer.
(Fuser-ptrp): New user pointer type predicate function.
(syms_of_data): New 'user-ptrp', 'user-ptr' symbol.  New 'user-ptrp'
subr.
* src/print.c (print_object): Add printer for User_Ptr type.

9 years agoAdd portable layer for dynamic loading
Aurélien Aptel [Sun, 15 Nov 2015 23:36:35 +0000 (00:36 +0100)]
Add portable layer for dynamic loading

* src/dynlib.h: New file.
* src/dynlib.c: New file.

Co-authored-by: Philipp Stephani <phst@google.com>
9 years agoAdd catch-all & no-signal version of PUSH_HANDLER
Philipp Stephani [Sun, 15 Nov 2015 23:31:56 +0000 (00:31 +0100)]
Add catch-all & no-signal version of PUSH_HANDLER

Ground work for modules. Add a non-signaling version of PUSH_HANDLER and
a new "catch-all" handler type.

* src/eval.c (init_handler, push_handler, push_handler_nosignal): New
  functions.
* src/fns.c (hash_remove_from_table): Expose function public.
* src/lisp.h: New handler type, define macro to push_handler call.

9 years ago; * lisp/server.el (server-process-filter): Simplify last change
Ken Brown [Wed, 18 Nov 2015 19:16:40 +0000 (14:16 -0500)]
; * lisp/server.el (server-process-filter): Simplify last change

9 years agoSilence byte-compiler warning
Ken Brown [Wed, 18 Nov 2015 18:34:47 +0000 (13:34 -0500)]
Silence byte-compiler warning

* lisp/server.el (server-process-filter): Silence byte-compiler
warning.

9 years agoQuote symbols in docstrings using `'
Paul Eggert [Wed, 18 Nov 2015 17:17:20 +0000 (09:17 -0800)]
Quote symbols in docstrings using `'

Be more systematic about quoting symbols `like-this' rather than
`like-this or 'like-this' in docstrings.  This follows up Artur
Malabarba's email in:
http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg01647.html

9 years agoFix savegames in dunnet
Peder O. Klingenberg [Tue, 17 Nov 2015 20:47:27 +0000 (21:47 +0100)]
Fix savegames in dunnet

* lisp/play/dunnet.el (dun-rot13): Use the standard rot13-region instead
  of separate implementation.

9 years ago* lisp/emacs-lisp/package.el (package--with-response-buffer):
Artur Malabarba [Wed, 18 Nov 2015 10:28:02 +0000 (10:28 +0000)]
* lisp/emacs-lisp/package.el (package--with-response-buffer):

Ensure we're at the start of the buffer before searching for
the end of headers.

9 years ago* admin/release-process: Improve wording.
Xue Fuqiao [Wed, 18 Nov 2015 00:56:50 +0000 (08:56 +0800)]
* admin/release-process: Improve wording.

9 years agoBackport: * CONTRIBUTE: Remove information about feature freeze.
Xue Fuqiao [Sun, 15 Nov 2015 02:05:17 +0000 (10:05 +0800)]
Backport: * CONTRIBUTE: Remove information about feature freeze.

(cherry picked from commit ae0653b5ab9ee223751ec389b87011963e1cbbef)

9 years agoBackport: Document the release process
Xue Fuqiao [Sun, 15 Nov 2015 01:35:50 +0000 (09:35 +0800)]
Backport: Document the release process

* admin/notes/versioning: Add information about RC releases.
* admin/release-process: Document the release process.
* admin/authors.el (authors-ignored-files):
* admin/README: Change FOR-RELEASE to release-process.
* CONTRIBUTE:
* admin/notes/bugtracker: Don't mention FOR-RELEASE.

(cherry picked from commit 9a4aa0f5945a03611ae29c516025dbd353bd26ab)

9 years agoBackport: * admin/release-process: Rename from admin/FOR-RELEASE.
Xue Fuqiao [Sun, 15 Nov 2015 01:32:12 +0000 (09:32 +0800)]
Backport: * admin/release-process: Rename from admin/FOR-RELEASE.

(cherry picked from commit f8cc14b59700e51a4e31139c0a65c8154995e055)

9 years agoBackport: Mention CONTRIBUTE in README
Xue Fuqiao [Sat, 14 Nov 2015 04:49:17 +0000 (12:49 +0800)]
Backport: Mention CONTRIBUTE in README

Mention CONTRIBUTE in README, since it was moved from etc/ to root.
* etc/TODO: Remove the reference to `etc/CONTRIBUTE'.
* README: Mention CONTRIBUTE.

(cherry picked from commit ed2e7e20ae0945288c98091f308f5460c3453873)

9 years agoFix docstring quoting problems with ‘ '’
Paul Eggert [Tue, 17 Nov 2015 23:28:50 +0000 (15:28 -0800)]
Fix docstring quoting problems with ‘ '’

Problem reported by Artur Malabarba in:
http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg01513.html
Most of these fixes are to documentation; many involve fixing
longstanding quoting glitches that are independent of the
recent substitute-command-keys changes.  The changes to code are:
* lisp/cedet/mode-local.el (mode-local-augment-function-help)
(describe-mode-local-overload):
Substitute docstrings before displaying them.
* lisp/emacs-lisp/cl-macs.el (cl--transform-lambda):
Quote the generated docstring for later substitution.

9 years agoImprove configure --help text for wide ints
Eli Zaretskii [Tue, 17 Nov 2015 19:07:37 +0000 (21:07 +0200)]
Improve configure --help text for wide ints

* configure.ac (wide-int): Clarify user-level advantages and
disadvantages.

9 years agoImprove doc string
Stephen Leake [Tue, 17 Nov 2015 13:46:11 +0000 (07:46 -0600)]
Improve doc string

* lisp/progmodes/xref.el (xref-backend-references): Improve doc string.

9 years agoeval_sub followed dangling pointer when debugging
Paul Eggert [Tue, 17 Nov 2015 07:08:54 +0000 (23:08 -0800)]
eval_sub followed dangling pointer when debugging

Problem reported by Pip Cet (Bug#21245).
This bug could occur in eval_sub if the C compiler reused
storage associated with the ‘argvals’ local after ‘argvals’
went out of scope, and if the Elisp debugger stopped on Elisp
function exit and accessed ‘argvals’.  It could also occur if
a variadic function was called with so many arguments (over
2048 args on x86-64) that SAFE_ALLOCA_LISP called malloc, then
SAFE_FREE freed the arguments, then the memory manager used
the storage for other purposes, then the debugger accessed the
arguments.
* src/eval.c (eval_sub): Declare ‘argvals’ at top level of
function body. Simplify local decls.
When allocating args via SAFE_ALLOCA, call
debugger before invoking SAFE_FREE, as the debugger needs
access to the args.
(eval_sub, apply_lambda): Rework to avoid need for
set_backtrace_debug_on_exit hack.  This is cleaner,
and should work better with buggy custom debuggers.

9 years ago* lisp/image-mode.el: Support encrypted file
Daiki Ueno [Tue, 17 Nov 2015 02:27:51 +0000 (11:27 +0900)]
* lisp/image-mode.el: Support encrypted file

(image-toggle-display-image): Read content from the buffer instead
of the file, if the buffer holds a decrypted data.  (Bug#21870)

9 years agoELF unexec: align section header
Paul Eggert [Tue, 17 Nov 2015 01:48:08 +0000 (17:48 -0800)]
ELF unexec: align section header

This ports the recent unexelf.c changes to Fedora x86-64
when configured with GCC’s -fsanitize=undefined option.
* src/unexelf.c (unexec): Align new_data2_size to a multiple
of ElfW (Shdr)’s alignment, so that NEW_SECTION_H returns a
pointer aligned appropriately for its type.

9 years ago; lisp/window.el (display-buffer-at-bottom): Fix indentation
Juanma Barranquero [Tue, 17 Nov 2015 01:02:07 +0000 (02:02 +0100)]
; lisp/window.el (display-buffer-at-bottom): Fix indentation

9 years agoDo more checks on bytecode objects (Bug#21929)
Andreas Schwab [Mon, 16 Nov 2015 22:47:17 +0000 (23:47 +0100)]
Do more checks on bytecode objects (Bug#21929)

* src/eval.c (funcall_lambda): Check size of compiled function
object.
(Ffetch_bytecode): Likewise.

9 years agopcase.el: Fix edebugging of backquoted cons patterns
Johan Bockgård [Sun, 15 Nov 2015 23:07:06 +0000 (00:07 +0100)]
pcase.el: Fix edebugging of backquoted cons patterns

* lisp/emacs-lisp/pcase.el (pcase-QPAT): Fix edebugging of backquoted
cons patterns. (Bug#21920)

9 years agoImprove fix for regex reentrancy abort
Paul Eggert [Mon, 16 Nov 2015 21:09:46 +0000 (13:09 -0800)]
Improve fix for regex reentrancy abort

Suggested by Stefan Monnier (Bug#21688).
* src/syntax.c (update_syntax_table_forward):
Remove recently-added PROPERTIZE arg, and assume it is true.
All callers changed.
* src/syntax.h (UPDATE_SYNTAX_TABLE_FORWARD_FAST):
Invoke update_syntax_table directly.

9 years ago; Fix breakage in elisp-mode-tests.el
Dmitry Gutov [Mon, 16 Nov 2015 17:15:28 +0000 (19:15 +0200)]
; Fix breakage in elisp-mode-tests.el

9 years ago* lisp/faces.el (faces--attribute-at-point): Use `face-list-p'
Artur Malabarba [Mon, 16 Nov 2015 14:35:31 +0000 (14:35 +0000)]
* lisp/faces.el (faces--attribute-at-point): Use `face-list-p'

9 years ago* lisp/emacs-lisp/package.el (package--with-response-buffer): Missing require
Artur Malabarba [Mon, 16 Nov 2015 13:53:45 +0000 (13:53 +0000)]
* lisp/emacs-lisp/package.el (package--with-response-buffer): Missing require

9 years ago* lisp/emacs-lisp/nadvice.el (add-function): Escape quote
Artur Malabarba [Mon, 16 Nov 2015 09:49:00 +0000 (09:49 +0000)]
* lisp/emacs-lisp/nadvice.el (add-function): Escape quote

9 years agoRecognize .rbw and .pyw files (bug#18753)
Vasily Korytov [Sun, 15 Nov 2015 23:32:01 +0000 (01:32 +0200)]
Recognize .rbw and .pyw files (bug#18753)

* lisp/progmodes/python.el (auto-mode-alist):
Recognize .pyw files.

* lisp/progmodes/ruby-mode.el (auto-mode-alist):
Recognize .rbw files.

9 years agoFix ruby-mode auto-mode-alist entry
Dmitry Gutov [Sun, 15 Nov 2015 23:14:54 +0000 (01:14 +0200)]
Fix ruby-mode auto-mode-alist entry

* lisp/progmodes/ruby-mode.el (auto-mode-alist): Add grouping
around the extensions (bug#21257).

9 years agoFix etags completion near eob
Dmitry Gutov [Sun, 15 Nov 2015 22:30:12 +0000 (00:30 +0200)]
Fix etags completion near eob

* lisp/progmodes/etags.el (tags-completion-at-point-function):
Use `goto-char', to avoid the end-of-buffer error (bug#20061).

9 years agoDe-pessimize detection of C++ member initialization lists.
Alan Mackenzie [Sun, 15 Nov 2015 21:59:40 +0000 (21:59 +0000)]
De-pessimize detection of C++ member initialization lists.

list/progmodes/cc-engine.el (c-back-over-list-of-member-inits): New macro.
(c-back-over-member-initializers): Reformulate such that c-at-toplevel-p
is only called when a construct "looks right" rather than continually.
(c-guess-basic-syntax, CASE 5R): Add a check for the mode being C++ Mode.

9 years agoBackport: * lisp/emacs-lisp/package.el: Fix a decoding issue.
Artur Malabarba [Sun, 15 Nov 2015 21:28:37 +0000 (21:28 +0000)]
Backport: * lisp/emacs-lisp/package.el: Fix a decoding issue.

* lisp/url/url-handlers.el (url-insert-file-contents): Move some code to
`url-insert-buffer-contents'.
(url-insert-buffer-contents): New function

(package--with-response-buffer): Use `url-insert-buffer-contents'.
The previous code had some issues with decoding. Refactoring that
function allows us to use the decoding from url-handlers while still
treating both sync and async requests the same.

9 years agoImprove a few doc strings, comments
Stephen Leake [Sat, 14 Nov 2015 22:44:58 +0000 (16:44 -0600)]
Improve a few doc strings, comments

* lisp/cedet/cedet-global.el (cedet-gnu-global-expand-filename):
* lisp/cedet/ede/locate.el (ede-locate-base):
* lisp/cedet/semantic/symref.el (semantic-symref-calculate-rootdir):
* src/fns.c (Fdelq): Improve doc string.

* lisp/progmodes/elisp-mode.el (elisp--xref-find-definitions): Add FIXME.

9 years agoEnhance NSTRACE (trace output for NextStep).
Anders Lindgren [Sun, 15 Nov 2015 19:19:34 +0000 (20:19 +0100)]
Enhance NSTRACE (trace output for NextStep).

Trace can be disabled for groups of functions. By default, event
functions and functions that generate lots of output are disabled.

Trace output of Objective-C functions now use the "[ClassName
parameter:]" form.

* src/nsterm.h (NSTRACE_ALL_GROUPS, NSTRACE_GROUP_EVENTS)
(NSTRACE_GROUP_UPDATES, NSTRACE_GROUP_FRINGE, NSTRACE_GROUP_COLOR)
(NSTRACE_GROUP_GLYPHS, NSTRACE_GROUP_FOCUS): New macros,
controlling in which function groups trace should be active.
(NSTRACE_WHEN): Support for silencing a function, this also
silencing all called functions.
(NSTRACE_UNSILENCE): New macro, used to re-enable trace.
(NSTRACE_FMT_FSTYPE, NSTRACE_ARG_FSTYPE): New macros, used to
print the full screen state in NSTRACE functions.

* src/nsterm.m (nstrace_depth, nstrace_num): Made volatile as they
can be accessed from multiple threads.
(nstrace_enabled_global): New variable, when FALSE, trace is
silenced.
(nstrace_restore_global_trace_state): New function, used to
restore `nstrace_enabled_global' at end of block.
([EmacsView setFrame:], [EmacsWindow setFrame:display:])
([EmacsWindow setFrame:display:animation:])
([EmacsWindow setFrameTopLeftPoint:]): New functions, print trace
and call corresponding super function.
(Many functions): Add or enhance trace output.

* src/nsimage.m (ns_image_from_file): Enhanced trace output.

* src/nsfns.m (x_set_tool_bar_lines): Add trace output.

* src/nsmenu.m ([EmacsToolbar setVisible:]): New function, print trace
and call corresponding super function.

9 years ago; Cleanup of change log. Removed obsolete email addresses.
Anders Lindgren [Sun, 15 Nov 2015 18:28:32 +0000 (19:28 +0100)]
; Cleanup of change log. Removed obsolete email addresses.

9 years agoFixed a toolbar related issue on OS X.
Anders Lindgren [Sun, 15 Nov 2015 18:17:53 +0000 (19:17 +0100)]
Fixed a toolbar related issue on OS X.

Earlier, when toggling the tool-bar in a maximized frame, the
frame size didn't match the number of text lines, leaving an
unused area at the bottom of the frame.

* nsfns.m (x_set_tool_bar_lines): Exit maximized and full height
fullscreen modes when tool bar is disabled.

9 years agoFixed OS X 10.6.8 build issue (bug#21862).
Anders Lindgren [Sun, 15 Nov 2015 17:46:04 +0000 (18:46 +0100)]
Fixed OS X 10.6.8 build issue (bug#21862).

* src/nsterm.h (EmacsView): Add missing declarations.
* src/nsterm.m ([EmacsView windowDidBecomeKey]): New method, like
the standard method but without the notification parameter.
Intended to be used for direct calls.
([EmacsView windowDidEnterFullScreen]): Call the non-notification
version of `windowDidBecomeKey'. Made the notification method call
the non-notification method instead of the vice versa.
(NSWindowDidEnterFullScreenNotification): Deleted, no longer
needed.

9 years ago* lisp/faces.el (faces--attribute-at-point): Fix an issue
Artur Malabarba [Sun, 15 Nov 2015 18:42:20 +0000 (18:42 +0000)]
* lisp/faces.el (faces--attribute-at-point): Fix an issue

Previous code would signal an error when the face at point was
a manually built list of attributes such as '(:foregroud "white").

* test/automated/faces-tests.el (faces--test-color-at-point): Add a test

9 years agoFix regex abort when it tries to reenter itself
Paul Eggert [Sun, 15 Nov 2015 09:14:39 +0000 (01:14 -0800)]
Fix regex abort when it tries to reenter itself

Problem reported by Ken Raeburn.
Solution suggested by Stefan Monnier (Bug#21688).
* src/regex.c (re_match_2_internal):
Use new _FAST functions to avoid regex code reentering itself.
* src/syntax.c (update_syntax_table_forward): New arg PROPERTIZE.
All callers changed.
* src/syntax.h (UPDATE_SYNTAX_TABLE_FORWARD_FAST)
(UPDATE_SYNTAX_TABLE_FAST): New inline functions.

9 years agoImprove Ruby 1.9-style keyword keys highlighting
Dmitry Gutov [Sun, 15 Nov 2015 05:25:19 +0000 (07:25 +0200)]
Improve Ruby 1.9-style keyword keys highlighting

* lisp/progmodes/ruby-mode.el (ruby-font-lock-keywords):
Handle required keyword arguments (bug#21367).
And highlight the colon together with the name.

9 years agoUnify the absolutely equal xref-backend-references implementations
Dmitry Gutov [Sun, 15 Nov 2015 05:00:45 +0000 (07:00 +0200)]
Unify the absolutely equal xref-backend-references implementations

* lisp/progmodes/elisp-mode.el (xref-backend-references):
Remove.

* lisp/progmodes/etags.el (xref-backend-references):
Remove.

* lisp/progmodes/xref.el (xref-backend-references):
Define the default implementation.

9 years agoUpdate project-find-regexp for the new xref API
Dmitry Gutov [Sun, 15 Nov 2015 04:31:51 +0000 (06:31 +0200)]
Update project-find-regexp for the new xref API

* lisp/progmodes/project.el (project--read-regexp):
Update to use the new xref API methods.

* lisp/progmodes/xref.el (xref-find-backend): Autoload.

9 years agoFix replacing a match with a shorter string
Dmitry Gutov [Sun, 15 Nov 2015 03:59:34 +0000 (05:59 +0200)]
Fix replacing a match with a shorter string

In effect, partially reverting fe973fc.

* lisp/progmodes/xref.el (xref-query-replace): Store the end
of each match as a marker again, instead of length.
(xref--query-replace-1): Update accordingly.

9 years ago* lisp/progmodes/xref.el (xref-pop-marker-stack): Downgrade errors
Artur Malabarba [Sat, 14 Nov 2015 21:13:12 +0000 (21:13 +0000)]
* lisp/progmodes/xref.el (xref-pop-marker-stack): Downgrade errors

Signal user-errors instead.

9 years agoDocument 'describe-symbol'
Eli Zaretskii [Sat, 14 Nov 2015 20:02:26 +0000 (22:02 +0200)]
Document 'describe-symbol'

* doc/emacs/help.texi (Help Summary): Mention "C-h o".
(Name Help): Document "C-h o" and describe-symbol.

* lisp/help-fns.el (describe-symbol): Doc fix.

9 years agoChange test name to avoid spellcheck issue.
Paul Eggert [Sat, 14 Nov 2015 19:48:16 +0000 (11:48 -0800)]
Change test name to avoid spellcheck issue.

9 years ago; * etc/NEWS: Minor improvements in wording.
Eli Zaretskii [Sat, 14 Nov 2015 19:38:47 +0000 (21:38 +0200)]
; * etc/NEWS: Minor improvements in wording.

9 years agoAvoid signaling an error in 'describe-symbol'
Eli Zaretskii [Sat, 14 Nov 2015 17:27:52 +0000 (19:27 +0200)]
Avoid signaling an error in 'describe-symbol'

* lisp/help-fns.el (describe-symbol): Avoid errors when the symbol
exists as a function/variable/face/etc., but is undocumented.

* test/automated/help-fns.el (help-fns-test-describe-symbol): New
test.

9 years ago; * etc/NEWS: Fix formatting
Eli Zaretskii [Sat, 14 Nov 2015 16:25:24 +0000 (18:25 +0200)]
; * etc/NEWS: Fix formatting

9 years ago; * etc/NEWS: Some easily fixed documentation marks
Eli Zaretskii [Sat, 14 Nov 2015 16:22:45 +0000 (18:22 +0200)]
; * etc/NEWS: Some easily fixed documentation marks

9 years ago* INSTALL (--with-cairo): Document this new configure option.
Eli Zaretskii [Sat, 14 Nov 2015 16:20:36 +0000 (18:20 +0200)]
* INSTALL (--with-cairo): Document this new configure option.

9 years agoDocument that GNU Make >= 3.81 is required to build Emacs
Eli Zaretskii [Sat, 14 Nov 2015 16:12:25 +0000 (18:12 +0200)]
Document that GNU Make >= 3.81 is required to build Emacs

* doc/lispref/internals.texi (Building Emacs): Document that GNU
Make 3.81 or later is now required.

9 years agoBackport: * lisp/emacs-lisp/package.el: Refactor -with-work-buffer-async.
Artur Malabarba [Sat, 14 Nov 2015 15:44:44 +0000 (15:44 +0000)]
Backport: * lisp/emacs-lisp/package.el: Refactor -with-work-buffer-async.

(package--with-work-buffer-async): Reimplement as
`package--with-response-buffer'.
(package--with-work-buffer): Mark obsolete.
(package--with-response-buffer): New macro. This is a more self
contained and less contrived version of
`package--with-work-buffer-async'.  It uses keyword arguments,
doesn't have async on the name, doesn't fallback on
`package--with-work-buffer', and has _much_ simpler error
handling.  On master, this macro will soon be part of another
library (either standalone or inside url.el), which is why this
commit is not to be merged back.

(package--check-signature, package--download-one-archive)
(package-install-from-archive, describe-package-1): Use it.

(package--download-and-read-archives): Let
`package--download-one-archive' take care of calling
`package--update-downloads-in-progress'.