]> code.delx.au - gnu-emacs/log
gnu-emacs
8 years ago* modules/mod-test/mod-test.c (Fmod_test_sum): Verify there are 2 args.
Philipp Stephani [Tue, 24 Nov 2015 19:08:22 +0000 (21:08 +0200)]
* modules/mod-test/mod-test.c (Fmod_test_sum): Verify there are 2 args.

8 years agoImplement dynlib_addr for MS-Windows
Eli Zaretskii [Tue, 24 Nov 2015 19:04:56 +0000 (21:04 +0200)]
Implement dynlib_addr for MS-Windows

* src/dynlib.c [WINDOWSNT]: Include w32common.h.
<g_b_init_get_module_handle_ex> [WINDOWSNT]: New static variable.
(GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS)
(GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT) [WINDOWSNT]: Define
if undefined.
(dynlib_reset_last_error): Reset g_b_init_get_module_handle_ex to
zero.
(dynlib_addr) [WINDOWSNT]: Non-trivial implementation to report
the full file name of the module for a given address.

8 years agoMerge branch 'emacs-25' of git.sv.gnu.org:/srv/git/emacs into emacs-25
Alan Mackenzie [Tue, 24 Nov 2015 17:43:52 +0000 (17:43 +0000)]
Merge branch 'emacs-25' of git.sv.gnu.org:/srv/git/emacs into emacs-25

8 years agoSquashed commit of the following:
Alan Mackenzie [Tue, 24 Nov 2015 17:37:49 +0000 (17:37 +0000)]
Squashed commit of the following:

commit e1ecf76585bef2eb87995f7a7f92cc12003a6f70
Author: Alan Mackenzie <acm@muc.de>
Date:   Tue Nov 24 16:50:09 2015 +0000

    Byte compile: minor amendments.

    * lisp/emacs-lisp/bytecomp.el (byte-compile-initial-macro-environment):
    add a comment to explain the binding of variables around a subsidiary
    compilation.
    (byte-compile-new-defuns): Amend the doc string.

commit c537bfed1dda1593d218956ff00c6105a3ff0316
Author: Alan Mackenzie <acm@muc.de>
Date:   Sat Nov 21 18:43:57 2015 +0000

    Byte compiler: fix spurious warnings "might not be defined at runtime".

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

    * lisp/emacs-lisp/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.

8 years agoFix crash at startup related to GC of font entities
Eli Zaretskii [Tue, 24 Nov 2015 16:08:39 +0000 (18:08 +0200)]
Fix crash at startup related to GC of font entities

* src/font.h (GC_FONT_SPEC_P, GC_FONT_ENTITY_P)
(GC_FONT_OBJECT_P, GC_XFONT_SPEC, GC_XFONT_ENTITY)
(GC_XFONT_OBJECT): New macros, for use in garbage collector.
* src/alloc.c (compact_font_cache_entry, compact_font_caches):
Don't ifdef away font cache compaction on NT_GUI, as the problems
which led to that seem to have been solved.
(compact_font_cache_entry): Use GC_FONT_SPEC_P, GC_XFONT_SPEC,
GC_XFONT_ENTITY, and GC_XFONT_OBJECT, instead of their non-GC_
cousins.  (Bug#21999)

8 years agoByte compile: Output an error, not a warning, for odd number of args to setq
Alan Mackenzie [Tue, 24 Nov 2015 12:40:39 +0000 (12:40 +0000)]
Byte compile: Output an error, not a warning, for odd number of args to setq

* lisp/emacs-lisp/bytecomp.el (byte-compile-setq): Amend.

8 years agoFix kbd_buffer iteration loop in readable_events
Ken Raeburn [Tue, 24 Nov 2015 06:16:10 +0000 (01:16 -0500)]
Fix kbd_buffer iteration loop in readable_events

* src/keyboard.c (readable_events): Wrap the event pointer back to the
start of the kbd_buffer array inside the top of the loop instead of
right before checking the loop condition, since kbd_fetch_ptr and
kbd_store_ptr point past the end of the array to mean that element 0
is next. (bug#21935)

8 years agoImprove text-quoting-style doc again
Paul Eggert [Tue, 24 Nov 2015 05:49:25 +0000 (21:49 -0800)]
Improve text-quoting-style doc again

* doc/lispref/help.texi (Keys in Documentation):
Omit overkill discussion of ‘setq’.  Mention Emacs versions
where ‘grave’ style was standard.

8 years agoImprove text-quoting-style doc
Paul Eggert [Tue, 24 Nov 2015 03:22:42 +0000 (19:22 -0800)]
Improve text-quoting-style doc

8 years agoSimplify module_make_function
Paul Eggert [Tue, 24 Nov 2015 03:00:03 +0000 (19:00 -0800)]
Simplify module_make_function

* src/emacs-module.c (module_make_function):
Simplify by calling build_unibyte_string.

8 years agoPort better to FreeBSD’s dlfunc vs dlsym
Paul Eggert [Tue, 24 Nov 2015 02:48:42 +0000 (18:48 -0800)]
Port better to FreeBSD’s dlfunc vs dlsym

This avoids warnings when converting between void * and
function pointers, which strict C11 does not allow.
* configure.ac (dlfunc): Check for existence.
* src/dynlib.c (dlfunc) [!HAVE_DLFUNC]: New macro.
(dynlib_func): New function.
* src/dynlib.h (dynlib_function_ptr, dynlib_func): New decls.
* src/emacs-module.c (Fmodule_load): Use dynlib_func, not
dynlib_sym, for function pointers.

8 years agoSimplify use of emacs_finalizer_function type
Paul Eggert [Tue, 24 Nov 2015 02:35:43 +0000 (18:35 -0800)]
Simplify use of emacs_finalizer_function type

* src/emacs-module.h (emacs_finalizer_function):
Now EMACS_NOEXCEPT.  All users simplified to omit EMACS_NOEXCEPT.
(struct emacs_env_25): Use emacs_finalizer_function where applicable.

8 years agomodule_format_fun_env fixes
Paul Eggert [Mon, 23 Nov 2015 23:45:29 +0000 (15:45 -0800)]
module_format_fun_env fixes

* src/doprnt.c (exprintf) [HAVE_MODULES]: Also define in this case.
* src/emacs-module.c (module_format_fun_env):
Convert path and sym to UTF-8.
Don’t use VLAs, as the C11 standard says they’re optional,
and anyway they can cause core dumps with large allocations.
Use exprintf rather than snprintf, as exprintf handles arbitrarily
long strings.  Simplify the code a bit.

8 years agoDon't use package-user-dir in elisp-library-roots if it's not bound
Dmitry Gutov [Mon, 23 Nov 2015 22:11:51 +0000 (00:11 +0200)]
Don't use package-user-dir in elisp-library-roots if it's not bound

* lisp/progmodes/elisp-mode.el (elisp-library-roots): Don't
use package-user-dir if it's not bound (bug#19759).

8 years agoNew visible-bell for NextStep (OS X El Capitan compatible).
Anders Lindgren [Mon, 23 Nov 2015 21:03:56 +0000 (22:03 +0100)]
New visible-bell for NextStep (OS X El Capitan compatible).

Instead of inverting a rectangle in the middle of the frame, use
the standard NextStep image "caution", represented using an
warning sign with an exclamation mark.  (Bug#21662)

Implemented based on a suggestion drafted by Mustafa Kocaturk.

* src/nsterm.m (EmacsBell): New class for managing the caution
image.  Support multiple active bells, the image is removed once
all bells have timed out.
(ns_timeout): Removed, no longer used.
(ns_ring_bell): Reimplemented to use EmacsBell.

8 years ago* lisp/emacs-lisp/nadvice.el (add-function): Fix debug spec.
Johan Bockgård [Mon, 23 Nov 2015 19:11:10 +0000 (20:11 +0100)]
* lisp/emacs-lisp/nadvice.el (add-function): Fix debug spec.

(remove-function): Ditto. (Bug#20376)

8 years ago* lisp/leim/quail/tamil-dvorak.el: Add necessary escapes.
Mark Oteiza [Mon, 23 Nov 2015 18:10:38 +0000 (13:10 -0500)]
* lisp/leim/quail/tamil-dvorak.el: Add necessary escapes.

8 years agoImprove how non-ASCII strings are accepted from modules
Eli Zaretskii [Mon, 23 Nov 2015 18:08:01 +0000 (20:08 +0200)]
Improve how non-ASCII strings are accepted from modules

* src/emacs-module.c (module_make_function, module_make_string):
Build a unibyte Lisp string and then decode it by UTF-8, instead
of building a multibyte string without decoding.  This is more
tolerant to deviations from UTF-8.

8 years agoPort recent module changes to pickier compilers
Paul Eggert [Mon, 23 Nov 2015 17:53:13 +0000 (09:53 -0800)]
Port recent module changes to pickier compilers

* src/emacs-module.c (module_make_function)
(module_make_string): Add casts to fix pointer signedness issues.

8 years agoFix how strings are accepted from modules
Philipp Stephani [Mon, 23 Nov 2015 17:46:17 +0000 (19:46 +0200)]
Fix how strings are accepted from modules

* emacs-module.c (module_make_function, module_make_string): Use
make_multibyte_string.
(module_copy_string_contents): Encode before reading the byte
size.  Return false if and only if an error occurred.

8 years agoMerge branch 'emacs-25' of git.savannah.gnu.org:/srv/git/emacs into emacs-25
Eli Zaretskii [Mon, 23 Nov 2015 17:41:32 +0000 (19:41 +0200)]
Merge branch 'emacs-25' of git.savannah.gnu.org:/srv/git/emacs into emacs-25

8 years agoAdd the tamil-dvorak input method
Shakthi Kannan [Mon, 23 Nov 2015 17:40:08 +0000 (19:40 +0200)]
Add the tamil-dvorak input method

* lisp/leim/quail/tamil-dvorak.el: New file.  (Bug#21768)

* etc/NEWS: Mention the new input method.

8 years agoMove setting FRAME_WINDOW_SIZES_CHANGED to resize_frame_windows.
Martin Rudalics [Mon, 23 Nov 2015 17:39:18 +0000 (18:39 +0100)]
Move setting FRAME_WINDOW_SIZES_CHANGED to resize_frame_windows.

* src/frame.c (adjust_frame_size): Don't set
FRAME_WINDOW_SIZES_CHANGED here ...
* src/window.c (resize_frame_windows): ... but here, as suggested
by Stefan Monnier.  Also remove some dead code along the way.

8 years ago* /etc/NEWS (Incompatible Lisp Changes): Also `setf' needs an even # of args.
Alan Mackenzie [Mon, 23 Nov 2015 17:20:12 +0000 (17:20 +0000)]
* /etc/NEWS (Incompatible Lisp Changes): Also `setf' needs an even # of args.

8 years agoSignal an error when `setf' gets an odd number of arguments.
Alan Mackenzie [Mon, 23 Nov 2015 17:13:55 +0000 (17:13 +0000)]
Signal an error when `setf' gets an odd number of arguments.

* lisp/emacs-lisp/gv.el (setf): Amend.

8 years ago* lisp/emacs-lisp/smie.el (smie-backward-sexp): Handle BOB better.
Stefan Monnier [Mon, 23 Nov 2015 16:26:16 +0000 (11:26 -0500)]
* lisp/emacs-lisp/smie.el (smie-backward-sexp): Handle BOB better.

8 years ago* etc/NEWS (Incompatible Lisp Changes): Document new restriction on `setq'.
Alan Mackenzie [Mon, 23 Nov 2015 14:59:49 +0000 (14:59 +0000)]
* etc/NEWS (Incompatible Lisp Changes): Document new restriction on `setq'.

8 years agoExpunge occurrences of `setq' with an odd number of arguments.
Alan Mackenzie [Mon, 23 Nov 2015 14:49:23 +0000 (14:49 +0000)]
Expunge occurrences of `setq' with an odd number of arguments.

* lisp/apropos.el (apropos-documentation):
* lisp/obsolete/complete.el (PC-include-file-all-completions):
* lisp/progmodes/compile.el (compilation-goto-locus):
* lisp/vc/vc-cvs.el (vc-cvs-parse-root): (twice)
Insert missing nil at end of `setq' forms.

* lisp/emacs-lisp/bytecomp.el (byte-compile-file-form-autoload): Remove an
erroneous trailing variable name from a setq, thus allowing a compilation
properly to track functions not defined at runtime.

8 years agoAdd a note about a questionable use of bool in xdisp.c
John Wiegley [Mon, 23 Nov 2015 14:42:22 +0000 (06:42 -0800)]
Add a note about a questionable use of bool in xdisp.c

8 years agoIssue a warning from the byte compiler on a malformed `setq' form.
Alan Mackenzie [Mon, 23 Nov 2015 14:25:15 +0000 (14:25 +0000)]
Issue a warning from the byte compiler on a malformed `setq' form.

Partly fixes bug#20241.
* lisp/emacs-lisp/bytecomp.el (byte-compile-setq): Issue a warning when a
`setq' form with an odd number of arguments is compiled.

8 years agoDon't let cconv_convert insert a nil argument into a `setq' form.
Alan Mackenzie [Mon, 23 Nov 2015 14:10:36 +0000 (14:10 +0000)]
Don't let cconv_convert insert a nil argument into a `setq' form.

Fixes bug#21983.
* lisp/emacs-lisp/cconv.el (cconv-convert): Don't silently insert a nil last
argument into a `setq' when there're an odd number of args.  This enables the
byte compiler to issue a message in this case.

8 years agoSignal an error when `setq' has an odd number of arguments. Fixes bug#20241.
Alan Mackenzie [Mon, 23 Nov 2015 13:56:37 +0000 (13:56 +0000)]
Signal an error when `setq' has an odd number of arguments.  Fixes bug#20241.

* src/eval.c (Fsetq): Signal an error on an odd number of arguments.
(syms_of_eval): Add a DEFSYM for Qsetq.

8 years ago* doc/lispref/windows.texi (Window Sizes): Fix indices and references.
Martin Rudalics [Mon, 23 Nov 2015 07:37:45 +0000 (08:37 +0100)]
* doc/lispref/windows.texi (Window Sizes): Fix indices and references.

8 years ago* src/frame.c (adjust_frame_size): Set FRAME_WINDOW_SIZES_CHANGED (Bug#21975).
Martin Rudalics [Mon, 23 Nov 2015 07:19:58 +0000 (08:19 +0100)]
* src/frame.c (adjust_frame_size): Set FRAME_WINDOW_SIZES_CHANGED (Bug#21975).

8 years agoAdd EUDC BBDB 3 entry in NEWS
Thomas Fitzsimmons [Mon, 23 Nov 2015 02:33:48 +0000 (21:33 -0500)]
Add EUDC BBDB 3 entry in NEWS

* NEWS: Mention EUDC BBDB backend support for BBDB 3.

8 years agoImprove EUDC to BBDB 3 export
Thomas Fitzsimmons [Sun, 22 Nov 2015 16:29:13 +0000 (11:29 -0500)]
Improve EUDC to BBDB 3 export

* eudc-vars.el (eudc-ldap-bbdb-conversion-alist): Change phone
entry to single item.  Add company conversion.
* eudc-export.el (eudc-bbdbify-company): New function.
(bbdb-parse-phone): Declare function.
(eudc-bbdbify-phone): Add BBDB 3 support.
(Bug#21971)

8 years agoAdd BBDB 3 support for EUDC export
Thomas Fitzsimmons [Sun, 22 Nov 2015 22:30:50 +0000 (17:30 -0500)]
Add BBDB 3 support for EUDC export

* eudc.el: Add bbdb-version defvar.
(eudc--using-bbdb-3-or-newer-p): New function.
* eudc-export.el (eudc-create-bbdb-record): Add support for
bbdb-create-internal argument list changes introduced in BBDB 3.
* eudcb-bbdb.el: Remove bbdb-version defvar.
(eudc-bbdb-field): Call eudc--using-bbdb-3-or-newer-p.
(Bug#21971)

8 years agoAllow loading modules by 'load-file'
Eli Zaretskii [Sun, 22 Nov 2015 18:38:51 +0000 (20:38 +0200)]
Allow loading modules by 'load-file'

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

8 years agoFix unoptimized builds
Eli Zaretskii [Sun, 22 Nov 2015 18:19:13 +0000 (20:19 +0200)]
Fix unoptimized builds

* src/lisp.h (XTYPE): Move before XSYMBOL, to fix unoptimized
builds.

8 years agoWork around the asynchronous-empty-diff problem
Dmitry Gutov [Sun, 22 Nov 2015 04:59:50 +0000 (06:59 +0200)]
Work around the asynchronous-empty-diff problem

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

8 years agoFinish excising electric indent from `open-line'
Karl Fogel [Sun, 22 Nov 2015 04:50:05 +0000 (22:50 -0600)]
Finish excising electric indent from `open-line'

* 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 c59353896) 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 6939896e2) and then restored it with the new
extra "p" already added (git commit bd4f04f86), 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.

8 years agoAdhere closer to the "implicit tag name" definition
Dmitry Gutov [Sun, 22 Nov 2015 04:33:22 +0000 (06:33 +0200)]
Adhere closer to the "implicit tag name" definition

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

8 years agoUnrevert most of regexp reentrancy abort patch
Stefan Monnier [Sun, 22 Nov 2015 03:05:28 +0000 (22:05 -0500)]
Unrevert most of regexp reentrancy abort patch

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.

8 years agoRevert regexp reentrancy abort patch
Paul Eggert [Sat, 21 Nov 2015 22:13:56 +0000 (14:13 -0800)]
Revert regexp reentrancy abort patch

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.

8 years agoAdd a few safety checks when ENABLE_CHECKING
Paul Eggert [Sat, 21 Nov 2015 18:38:19 +0000 (10:38 -0800)]
Add a few safety checks when ENABLE_CHECKING

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.

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

8 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

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

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

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

8 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

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

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

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

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

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

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

8 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

8 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

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

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

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

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

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

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

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

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

8 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).

8 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

8 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".

8 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).

8 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

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

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

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

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

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

8 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

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

8 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

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

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

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