aboutsummaryrefslogtreecommitdiffstats
path: root/src (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Simplify the prologue of emacs-module.c functionsPhilipp Stephani2015-11-281-86/+46
| | | | | | | | | | | | | * emacs-module.c (MODULE_FUNCTION_BEGIN): New macro. (module_make_global_ref) (module_free_global_ref, module_make_function, module_funcall) (module_intern, module_type_of, module_extract_integer) (module_make_integer, module_extract_float, module_make_float) (module_copy_string_contents, module_make_string) (module_make_user_ptr, module_get_user_ptr, module_set_user_ptr) (module_get_user_finalizer, module_set_user_finalizer) (module_vec_set, module_vec_get, module_vec_size): Use new helper macro MODULE_FUNCTION_BEGIN.
* Don't reject module calls with no argumentsEli Zaretskii2015-11-281-2/+3
| | | | * src/emacs-module.c (Finternal_module_call): Allow ARGLIST be nil.
* Make module-call be visible from LispPhilipp Stephani2015-11-281-19/+17
| | | | | | | | * src/emacs-module.c (module_make_function): Use internal--module-call. (Finternal_module_call): Renamed from Fmodule_call. Add safety checks. (syms_of_module): DEFSYM save-value-p and save-pointer-p. Do defsubr internal--module-call.
* Fix minor problems found by static checkingPaul Eggert2015-11-271-10/+7
| | | | * src/undo.c (prepare_record): Add proper prototype for C.
* * src/emacs-module.c (struct env_storage): DeleteStefan Monnier2015-11-271-66/+63
| | | | | | | | | (struct emacs_runtime_private): Keep an emacs_env instead. (Fmodule_load, Fmodule_call): Declare emacs_env_private separately. (initialize_environment): Split the arg in two. Adjust all callers. Only store the private part in Vmodule_environments. (finalize_environment): Change the arg to only be the private env. Adjust all callers.
* Improve handling of signals and 'throw' in modulesEli Zaretskii2015-11-271-37/+96
| | | | | | | | | | | | | | | | | | | | * src/emacs-module.c: Add commentary explaining how to write functions in this file. (module_make_global_ref, module_free_global_ref) (module_non_local_exit_signal, module_non_local_exit_throw) (module_make_function, module_funcall, module_intern) (module_type_of, module_is_not_nil, module_eq) (module_extract_integer, module_make_integer) (module_extract_float, module_make_float) (module_copy_string_contents, module_make_string) (module_make_user_ptr, module_get_user_ptr, module_set_user_ptr) (module_get_user_finalizer, module_set_user_finalizer) (module_vec_set, module_vec_get, module_vec_size) (module_non_local_exit_signal_1, module_non_local_exit_throw_1): Do nothing and return with failure indication immediately, if some previous module call signaled an error or wants to throw. See http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg02133.html for the relevant discussions.
* Improve documentation of 'eval-buffer' and 'eval-region'Eli Zaretskii2015-11-271-7/+13
| | | | | | | * src/lread.c (Feval_buffer, Feval_region): Doc fixes. (Bug#22023) * doc/lispref/eval.texi (Eval): Mention narrowing to clarify "accessible portion of buffer".
* Unbreak the Cygwin w32 buildEli Zaretskii2015-11-271-1/+1
| | | | | * src/emacs.c (main): Call w32_init_main_thread in the Cygwin w32 build as well. Reported by Andy Moreton <andrewjmoreton@gmail.com>.
* Improve commentary of prepare_to_modify_buffer_1Eli Zaretskii2015-11-261-1/+6
| | | | | | * src/insdel.c (prepare_to_modify_buffer_1): Mention in commentary that this function runs Lisp. Suggested by Richard Stallman <rms@gnu.org>.
* Merge branch 'emacs-25' of git.sv.gnu.org:/srv/git/emacs into emacs-25Phillip Lord2015-11-262-5/+9
|\
| * Fix compiler warnings in w32.cEli Zaretskii2015-11-262-5/+9
| | | | | | | | | | | | | | | | * src/w32.c (sys_socket): In case of error, use -1 as return value, not INVALID_SOCKET, which causes compiler warnings. (maybe_load_unicows_dll): Cast the return value of GetProcAddress to the appropriate function signature, to avoid compiler errors. Reported by Andy Moreton <andrewjmoreton@gmail.com>. (Bug#21953)
* | Fix regression after merge.Phillip Lord2015-11-261-2/+0
| | | | | | | | * undo.c (prepare_record): Remove call to run_undoable_change.
* | After delete, record point location in undo.Phillip Lord2015-11-263-25/+52
|/ | | | | | | | | | | | | | | | | | | Addresses Bug #21968. * lisp/simple.el (undo-auto--add-boundary): Clean up code to better support intercalating calls. * src/keyboard.c,src/keyboard.h (command_loop_1): Store value of point and current buffer before each command. * src/undo.c (record_point): Now only record the point. * src/undo.c (prepare_record): Functionality removed form record_point. * src/undo.c (record_delete): Check if point needs recording. * src/undo.c (undo-boundary): Record value of point before each boundary. * test/automated/simple-test.el: New tests. Conflicts: src/undo.c
* * src/undo.c (record_property_change): Remove now-unused local.Paul Eggert2015-11-251-1/+1
|
* run_undoable_changes now called from insdel.Phillip Lord2015-11-252-19/+16
| | | | | | | | | | | The original calls from inside undo.c are not always at a safe position to call lisp, as they originate in varied positions within insdel.c. Calling them directly from prepare_to_modify_buffer_1 ensures that they are always run at the same point. * undo.c (run_undoable_changes,syms_of_undo): Remove function and symbol used. * insdel.c (run_undoable_changes): Add function and symbol.
* Fix module_format_fun_env when dynlib_addr failsPaul Eggert2015-11-241-3/+3
| | | | | | * src/emacs-module.c (module_format_fun_env): exprintf doesn’t support %p, so use %x. Reported by Eli Zaretskii in: http://lists.gnu.org/archive/html/emacs-devel/2015-11/msg02122.html
* Implement dynlib_addr for MS-WindowsEli Zaretskii2015-11-241-2/+114
| | | | | | | | | | | | * 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.
* Fix crash at startup related to GC of font entitiesEli Zaretskii2015-11-242-13/+48
| | | | | | | | | | | | * 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)
* Fix kbd_buffer iteration loop in readable_eventsKen Raeburn2015-11-241-7/+3
| | | | | | | | * 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)
* Improve text-quoting-style docPaul Eggert2015-11-231-1/+2
|
* Simplify module_make_functionPaul Eggert2015-11-231-10/+5
| | | | | * src/emacs-module.c (module_make_function): Simplify by calling build_unibyte_string.
* Port better to FreeBSD’s dlfunc vs dlsymPaul Eggert2015-11-233-2/+15
| | | | | | | | | | | 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.
* Simplify use of emacs_finalizer_function typePaul Eggert2015-11-231-5/+5
| | | | | | * 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.
* module_format_fun_env fixesPaul Eggert2015-11-232-20/+14
| | | | | | | | | | * 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.
* New visible-bell for NextStep (OS X El Capitan compatible).Anders Lindgren2015-11-231-44/+81
| | | | | | | | | | | | | | 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.
* Improve how non-ASCII strings are accepted from modulesEli Zaretskii2015-11-231-10/+6
| | | | | | | * 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.
* Port recent module changes to pickier compilersPaul Eggert2015-11-231-2/+4
| | | | | * src/emacs-module.c (module_make_function) (module_make_string): Add casts to fix pointer signedness issues.
* Fix how strings are accepted from modulesPhilipp Stephani2015-11-231-13/+39
| | | | | | | * 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.
* Move setting FRAME_WINDOW_SIZES_CHANGED to resize_frame_windows.Martin Rudalics2015-11-232-33/+1
| | | | | | | * 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.
* Add a note about a questionable use of bool in xdisp.cJohn Wiegley2015-11-231-0/+3
|
* Signal an error when `setq' has an odd number of arguments. Fixes bug#20241.Alan Mackenzie2015-11-231-0/+5
| | | | | * src/eval.c (Fsetq): Signal an error on an odd number of arguments. (syms_of_eval): Add a DEFSYM for Qsetq.
* * src/frame.c (adjust_frame_size): Set FRAME_WINDOW_SIZES_CHANGED (Bug#21975).Martin Rudalics2015-11-231-0/+2
|
* Allow loading modules by 'load-file'Eli Zaretskii2015-11-221-1/+8
| | | | | | | | | | | | * 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'.
* Fix unoptimized buildsEli Zaretskii2015-11-221-8/+8
| | | | | * src/lisp.h (XTYPE): Move before XSYMBOL, to fix unoptimized builds.
* Unrevert most of regexp reentrancy abort patchStefan Monnier2015-11-212-9/+23
| | | | | | | | | | | | | 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.
* Revert regexp reentrancy abort patchPaul Eggert2015-11-213-23/+10
| | | | | | | | | | | | 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.
* Add a few safety checks when ENABLE_CHECKINGPaul Eggert2015-11-215-30/+30
| | | | | | | | | | | | | | | | | | | | | | 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.
* Simplify recording of main thread's ID on MS-WindowsEli Zaretskii2015-11-216-41/+21
| | | | | | | | | | | | | | | | | | | | | * 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.
* ; * src/lread.c (Fload): Fix last change.Eli Zaretskii2015-11-211-1/+4
|
* Call 'window-size-change-functions' for mini-windowsEli Zaretskii2015-11-212-4/+34
| | | | | | | | | | | | | | | * 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'.
* Improve documentation of dynamic modulesEli Zaretskii2015-11-213-13/+16
| | | | | | | | | | | * 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.
* Fix double-decrement bug when freeing global refsPaul Eggert2015-11-201-1/+3
| | | | | | * 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.
* Declare emacs_module_init in the module APIPaul Eggert2015-11-201-0/+3
| | | | | | | * 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.
* Fix reindent-introduced typo in module codePaul Eggert2015-11-201-17/+22
| | | | | | * 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.
* Module function arg counts are ptrdiff_t, not intPaul Eggert2015-11-202-47/+44
| | | | | | | | | | | | | | | | | | | | | | * 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.
* Improve MS-Windows implementation in dynlib.cEli Zaretskii2015-11-202-9/+100
| | | | | | | | | | | | | | | | | | | | * 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.
* Include-file tweaks for modulesPaul Eggert2015-11-203-3/+6
| | | | | | | | | * 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.
* Simplify push_handler and profile its mallocPaul Eggert2015-11-194-108/+71
| | | | | | | | | | | | | | * 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.
* * src/emacs-module.h: Include stddef.h, not stdlib.h.Paul Eggert2015-11-191-1/+1
|
* Omit unnecessary clear in Fmodule_loadPaul Eggert2015-11-191-13/+10
| | | | | | | * 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)