<feed xmlns='http://www.w3.org/2005/Atom'>
<title>emacs/test/data, branch feature/soc-bytecode-in-traceback-reduced</title>
<subtitle>Emacs is the extensible, customizable, self-documenting real-time display editor. 
</subtitle>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/'/>
<entry>
<title>Port the 'module/async-pipe' test to MS-Windows</title>
<updated>2020-03-27T13:19:20+00:00</updated>
<author>
<name>Eli Zaretskii</name>
</author>
<published>2020-03-27T12:43:20+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=f98ee21c0e3d4e00569fdd9f2671fd8394ab8a65'/>
<id>f98ee21c0e3d4e00569fdd9f2671fd8394ab8a65</id>
<content type='text'>
These changes let the code compile and produce a valid DLL, but the
test hangs.  It looks like the hang is in Fdelete_process, when it
closes one of the descriptors of the pipe process.
In addition, this use of the pipe process cannot currently work
on MS-Windows, since make-pipe-process doesn't set up the reader
thread to read from the Emacs's side of the pipe, so the select
emulation doesn't know there's stuff to read from that pipe.
* test/data/emacs-module/mod-test.c [WINDOWSNT]: Include
windows.h.
(ALIGN_STACK) [!__x86_64__]: Define for 32-bit builds.
(sleep_for_half_second): New function.
(write_to_pipe): Declare return type differently for WINDOWSNT.
Call sleep_for_half_second.
(Fmod_test_async_pipe) [WINDOWSNT]: Use _beginthread as substitute
for pthread_create.
(invalid_finalizer): Replace non_ASCII character in a comment.

* test/src/emacs-module-tests.el (module/async-pipe): Skip on
MS-Windows, as the test fails and then hangs.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
These changes let the code compile and produce a valid DLL, but the
test hangs.  It looks like the hang is in Fdelete_process, when it
closes one of the descriptors of the pipe process.
In addition, this use of the pipe process cannot currently work
on MS-Windows, since make-pipe-process doesn't set up the reader
thread to read from the Emacs's side of the pipe, so the select
emulation doesn't know there's stuff to read from that pipe.
* test/data/emacs-module/mod-test.c [WINDOWSNT]: Include
windows.h.
(ALIGN_STACK) [!__x86_64__]: Define for 32-bit builds.
(sleep_for_half_second): New function.
(write_to_pipe): Declare return type differently for WINDOWSNT.
Call sleep_for_half_second.
(Fmod_test_async_pipe) [WINDOWSNT]: Use _beginthread as substitute
for pthread_create.
(invalid_finalizer): Replace non_ASCII character in a comment.

* test/src/emacs-module-tests.el (module/async-pipe): Skip on
MS-Windows, as the test fails and then hangs.
</pre>
</div>
</content>
</entry>
<entry>
<title>Add a module function to open a file descriptor connected to a pipe.</title>
<updated>2020-03-26T20:47:25+00:00</updated>
<author>
<name>Philipp Stephani</name>
</author>
<published>2020-03-26T16:22:25+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=d28b00476890f791a89b65007e5f20682b3eaa0d'/>
<id>d28b00476890f791a89b65007e5f20682b3eaa0d</id>
<content type='text'>
A common complaint about the module API is that modules can't
communicate asynchronously with Emacs.  While it isn't possible to
call arbitrary Emacs functions asynchronously, writing to a pipe
should always be fine and is a pretty low-hanging fruit.

This patch implements a function that adapts an existing pipe
process.  That way, users can use familiar tools like process filters
or 'accept-process-output'.

* src/module-env-28.h: Add 'open_channel' module function.

* src/emacs-module.c (module_open_channel): Provide definition for
'open_channel'.
(initialize_environment): Use it.

* src/process.c (open_channel_for_module): New helper function.
(syms_of_process): Define necessary symbol.

* test/src/emacs-module-tests.el (module/async-pipe): New unit test.

* test/data/emacs-module/mod-test.c (signal_system_error): New helper
function.
(signal_errno): Use it.
(write_to_pipe): New function running in the background.
(Fmod_test_async_pipe): New test module function.
(emacs_module_init): Export it.

* doc/lispref/internals.texi (Module Misc): Document new module
function.

* doc/lispref/processes.texi (Asynchronous Processes): New anchor
for pipe processes.

* etc/NEWS: Document 'open_channel' function.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
A common complaint about the module API is that modules can't
communicate asynchronously with Emacs.  While it isn't possible to
call arbitrary Emacs functions asynchronously, writing to a pipe
should always be fine and is a pretty low-hanging fruit.

This patch implements a function that adapts an existing pipe
process.  That way, users can use familiar tools like process filters
or 'accept-process-output'.

* src/module-env-28.h: Add 'open_channel' module function.

* src/emacs-module.c (module_open_channel): Provide definition for
'open_channel'.
(initialize_environment): Use it.

* src/process.c (open_channel_for_module): New helper function.
(syms_of_process): Define necessary symbol.

* test/src/emacs-module-tests.el (module/async-pipe): New unit test.

* test/data/emacs-module/mod-test.c (signal_system_error): New helper
function.
(signal_errno): Use it.
(write_to_pipe): New function running in the background.
(Fmod_test_async_pipe): New test module function.
(emacs_module_init): Export it.

* doc/lispref/internals.texi (Module Misc): Document new module
function.

* doc/lispref/processes.texi (Asynchronous Processes): New anchor
for pipe processes.

* etc/NEWS: Document 'open_channel' function.
</pre>
</div>
</content>
</entry>
<entry>
<title>Don't have exif bugging out on short strings</title>
<updated>2020-03-19T15:15:24+00:00</updated>
<author>
<name>Lars Ingebrigtsen</name>
</author>
<published>2020-03-19T15:15:04+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=0128375a50352720c626fd915312a5c38762d09a'/>
<id>0128375a50352720c626fd915312a5c38762d09a</id>
<content type='text'>
* lisp/image/exif.el (exif--direct-ascii-value): New function
(bug#40127).
(exif--parse-directory): Use it to get the correct values for
in-directory (i.e., shorter than 4 octets) strings.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* lisp/image/exif.el (exif--direct-ascii-value): New function
(bug#40127).
(exif--parse-directory): Use it to get the correct values for
in-directory (i.e., shorter than 4 octets) strings.
</pre>
</div>
</content>
</entry>
<entry>
<title>Also print function data when printing module functions.</title>
<updated>2020-01-05T15:07:28+00:00</updated>
<author>
<name>Philipp Stephani</name>
</author>
<published>2020-01-05T15:05:14+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=fc92c2d8942cf466aa6dbc422f2e798801b18408'/>
<id>fc92c2d8942cf466aa6dbc422f2e798801b18408</id>
<content type='text'>
This is especially useful in cases where modules only use a single
entry point and use the data to dispatch to the actual function.  Such
a design is common for languages such as Go and C++.

* src/emacs-module.c (module_function_data): New function.

* src/print.c (print_vectorlike): Use it to print module function data
if not NULL.
(print_object): Adapt size of buffer.

* test/data/emacs-module/mod-test.c (emacs_module_init): Pass some
non-NULL data to ‘mod-test-sum’.
(Fmod_test_sum): Check that correct data is passed through.

* test/src/emacs-module-tests.el (mod-test-sum-test)
(module-function-object): Adapt unit tests.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
This is especially useful in cases where modules only use a single
entry point and use the data to dispatch to the actual function.  Such
a design is common for languages such as Go and C++.

* src/emacs-module.c (module_function_data): New function.

* src/print.c (print_vectorlike): Use it to print module function data
if not NULL.
(print_object): Adapt size of buffer.

* test/data/emacs-module/mod-test.c (emacs_module_init): Pass some
non-NULL data to ‘mod-test-sum’.
(Fmod_test_sum): Check that correct data is passed through.

* test/src/emacs-module-tests.el (mod-test-sum-test)
(module-function-object): Adapt unit tests.
</pre>
</div>
</content>
</entry>
<entry>
<title>Implement finalizers for module functions (Bug#30373)</title>
<updated>2020-01-03T18:24:10+00:00</updated>
<author>
<name>Philipp Stephani</name>
</author>
<published>2018-02-11T20:38:22+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=48ffef5ef4b34799941a033591ea827d40025939'/>
<id>48ffef5ef4b34799941a033591ea827d40025939</id>
<content type='text'>
* src/module-env-28.h: Add new module environment functions to
module environment for Emacs 28.

* src/emacs-module.h.in: Document that 'emacs_finalizer' also works
for function finalizers.

* src/emacs-module.c (CHECK_MODULE_FUNCTION): New function.
(struct Lisp_Module_Function): Add finalizer data member.
(module_make_function): Initialize finalizer.
(module_get_function_finalizer)
(module_set_function_finalizer): New module environment functions.
(module_finalize_function): New function.
(initialize_environment): Initialize new environment functions.

* src/alloc.c (cleanup_vector): Call potential module function
finalizer during garbage collection.

* test/data/emacs-module/mod-test.c (signal_error): New helper
function.
(memory_full): Use it.
(finalizer): New example function finalizer.
(Fmod_test_make_function_with_finalizer)
(Fmod_test_function_finalizer_calls): New test module functions.
(emacs_module_init): Define them.

* test/src/emacs-module-tests.el (module/function-finalizer): New unit
test.

* doc/lispref/internals.texi (Module Functions): Document new
functionality.
(Module Misc): Move description of 'emacs_finalizer' type to 'Module
Functions' node, and add a reference to it.

* etc/NEWS: Mention new functionality.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* src/module-env-28.h: Add new module environment functions to
module environment for Emacs 28.

* src/emacs-module.h.in: Document that 'emacs_finalizer' also works
for function finalizers.

* src/emacs-module.c (CHECK_MODULE_FUNCTION): New function.
(struct Lisp_Module_Function): Add finalizer data member.
(module_make_function): Initialize finalizer.
(module_get_function_finalizer)
(module_set_function_finalizer): New module environment functions.
(module_finalize_function): New function.
(initialize_environment): Initialize new environment functions.

* src/alloc.c (cleanup_vector): Call potential module function
finalizer during garbage collection.

* test/data/emacs-module/mod-test.c (signal_error): New helper
function.
(memory_full): Use it.
(finalizer): New example function finalizer.
(Fmod_test_make_function_with_finalizer)
(Fmod_test_function_finalizer_calls): New test module functions.
(emacs_module_init): Define them.

* test/src/emacs-module-tests.el (module/function-finalizer): New unit
test.

* doc/lispref/internals.texi (Module Functions): Document new
functionality.
(Module Misc): Move description of 'emacs_finalizer' type to 'Module
Functions' node, and add a reference to it.

* etc/NEWS: Mention new functionality.
</pre>
</div>
</content>
</entry>
<entry>
<title>Update copyright year to 2020</title>
<updated>2020-01-01T00:59:52+00:00</updated>
<author>
<name>Paul Eggert</name>
</author>
<published>2020-01-01T00:19:43+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=365e01cc9f64ce6ca947ccfd8612d60763280a37'/>
<id>365e01cc9f64ce6ca947ccfd8612d60763280a37</id>
<content type='text'>
Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Run "TZ=UTC0 admin/update-copyright $(git ls-files)".
</pre>
</div>
</content>
</entry>
<entry>
<title>Rename faces used in faces-tests.el</title>
<updated>2019-12-10T00:16:44+00:00</updated>
<author>
<name>Dmitry Gutov</name>
</author>
<published>2019-12-10T00:15:55+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=ac1b6e97b6a6a87e5f36b0f002b4a2d77381e628'/>
<id>ac1b6e97b6a6a87e5f36b0f002b4a2d77381e628</id>
<content type='text'>
* test/data/themes/faces-test-light-theme.el:
* test/data/themes/faces-test-dark-theme.el: Update accordingly.

* test/lisp/faces-tests.el (faces--test-extend-with-themes):
Don't use the diff-mode faces.  Rename the definitions.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* test/data/themes/faces-test-light-theme.el:
* test/data/themes/faces-test-dark-theme.el: Update accordingly.

* test/lisp/faces-tests.el (faces--test-extend-with-themes):
Don't use the diff-mode faces.  Rename the definitions.
</pre>
</div>
</content>
</entry>
<entry>
<title>Make ':extend' inherited from default spec unless overridden</title>
<updated>2019-12-10T00:16:44+00:00</updated>
<author>
<name>Dmitry Gutov</name>
</author>
<published>2019-12-10T00:11:15+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=58fb4c3e68a4a42ad491d0fa2c084e5c39942e2b'/>
<id>58fb4c3e68a4a42ad491d0fa2c084e5c39942e2b</id>
<content type='text'>
* lisp/faces.el (face-spec-recalc): Handle the :extend attribute
specially and always inherit it from the default spec unless
overwritten in a theme (bug#37774).

* test/lisp/faces-tests.el (faces--test-data-dir): New variable.
(faces--test-extend-with-themes): Use test themes instead of ones
from etc/themes.  Update expected values.

* test/data/themes/faces-test-dark-theme.el: New file.

* test/data/themes/faces-test-light-theme.el: New file.

* doc/lispref/display.texi (Face Attributes):
Update the description of ':extend'.

* etc/NEWS: Update the entry for ':extend'.

* etc/themes/adwaita-theme.el:
* etc/themes/deeper-blue-theme.el:
* etc/themes/dichromacy-theme.el:
* etc/themes/leuven-theme.el:
* etc/themes/light-blue-theme.el:
* etc/themes/manoj-dark-theme.el:
* etc/themes/misterioso-theme.el:
* etc/themes/tango-dark-theme.el:
* etc/themes/tango-theme.el:
* etc/themes/tsdh-dark-theme.el:
* etc/themes/tsdh-light-theme.el:
* etc/themes/wheatgrass-theme.el:
* etc/themes/wombat-theme.el: Remove the now-redundant ':extend'
attribute in all the themes.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* lisp/faces.el (face-spec-recalc): Handle the :extend attribute
specially and always inherit it from the default spec unless
overwritten in a theme (bug#37774).

* test/lisp/faces-tests.el (faces--test-data-dir): New variable.
(faces--test-extend-with-themes): Use test themes instead of ones
from etc/themes.  Update expected values.

* test/data/themes/faces-test-dark-theme.el: New file.

* test/data/themes/faces-test-light-theme.el: New file.

* doc/lispref/display.texi (Face Attributes):
Update the description of ':extend'.

* etc/NEWS: Update the entry for ':extend'.

* etc/themes/adwaita-theme.el:
* etc/themes/deeper-blue-theme.el:
* etc/themes/dichromacy-theme.el:
* etc/themes/leuven-theme.el:
* etc/themes/light-blue-theme.el:
* etc/themes/manoj-dark-theme.el:
* etc/themes/misterioso-theme.el:
* etc/themes/tango-dark-theme.el:
* etc/themes/tango-theme.el:
* etc/themes/tsdh-dark-theme.el:
* etc/themes/tsdh-light-theme.el:
* etc/themes/wheatgrass-theme.el:
* etc/themes/wombat-theme.el: Remove the now-redundant ':extend'
attribute in all the themes.
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix recent modifications in emacs-module-tests</title>
<updated>2019-12-05T14:38:17+00:00</updated>
<author>
<name>Eli Zaretskii</name>
</author>
<published>2019-12-05T14:38:17+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=85f8aa1089e6fdbdf27b6f2c775e377faa79b19b'/>
<id>85f8aa1089e6fdbdf27b6f2c775e377faa79b19b</id>
<content type='text'>
* test/data/emacs-module/mod-test.c (extract_big_integer): Fix
calculation of size of 'magnitude' when 'emacs_limb_t' is wider
than 'unsigned long'.

* test/src/emacs-module-tests.el
(module--test-assertions--load-non-live-object)
(module--test-assertions--call-emacs-from-gc): On MS-Windows,
check also mod-test-emacs with ".exe" appended, before
skipping the tests.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
* test/data/emacs-module/mod-test.c (extract_big_integer): Fix
calculation of size of 'magnitude' when 'emacs_limb_t' is wider
than 'unsigned long'.

* test/src/emacs-module-tests.el
(module--test-assertions--load-non-live-object)
(module--test-assertions--call-emacs-from-gc): On MS-Windows,
check also mod-test-emacs with ".exe" appended, before
skipping the tests.
</pre>
</div>
</content>
</entry>
<entry>
<title>Change module interface to no longer use GMP objects directly.</title>
<updated>2019-12-04T20:17:10+00:00</updated>
<author>
<name>Philipp Stephani</name>
</author>
<published>2019-11-02T09:54:57+00:00</published>
<link rel='alternate' type='text/html' href='https://jason.zzq.org/git/emacs/commit/?id=096be9c4541329af259273fe604dc4f8669fbd8a'/>
<id>096be9c4541329af259273fe604dc4f8669fbd8a</id>
<content type='text'>
As described in the new comment added to emacs-module.c, using GMP
directly in the module interface has significant downsides: it couples
the module interface directly to the implementation and requires
module authors to link their module against the same GMP library as
Emacs itself, which is often difficult and an unnecessary burden.  By
picking a representation for the magnitude that often matches the one
used by GMP, we can avoid overhead when converting from and to GMP in
most cases.

Loading the test module in test/data/emacs-module and evaluating

(dotimes (_ 10000)
  (mod-test-double (* 2 most-negative-fixnum)))

under Callgrind shows that on my (GNU/Linux) machine Emacs only spends
10% of the CPU time of mod-test-double in mpz_import and mpz_export
combined, even though that function does little else.  (By contrast,
30% is spent in allocate_pseudovector.)

* src/emacs-module.h.in: Don't check EMACS_MODULE_GMP.  Don't include
gmp.h.  Remove emacs_mpz structure.  Instead, define type alias
emacs_limb_t and macro EMACS_LIMB_MAX.

* src/module-env-27.h: Change interface of extract_big_integer and
make_big_integer to take a sign-magnitude representation instead of
mpz_t.

* src/emacs-module.c: Don't check EMACS_MODULE_GMP or
EMACS_MODULE_HAVE_MPZ_T.  Add a comment about the chosen
implementation.
(module_extract_big_integer, module_make_big_integer): Reimplement
without using mpz_t in the interface.

* doc/lispref/internals.texi (Module Values): Adapt function
documentation and example.  Stop mentioning GMP and EMACS_MODULE_GMP.

* test/data/emacs-module/mod-test.c: Don't define EMACS_MODULE_GMP or
EMACS_MODULE_HAVE_MPZ_T.
(memory_full, extract_big_integer, make_big_integer): New helper
functions, identical to example in the Info documentation.
(Fmod_test_nanoseconds, Fmod_test_double): Adapt to new interface.
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
As described in the new comment added to emacs-module.c, using GMP
directly in the module interface has significant downsides: it couples
the module interface directly to the implementation and requires
module authors to link their module against the same GMP library as
Emacs itself, which is often difficult and an unnecessary burden.  By
picking a representation for the magnitude that often matches the one
used by GMP, we can avoid overhead when converting from and to GMP in
most cases.

Loading the test module in test/data/emacs-module and evaluating

(dotimes (_ 10000)
  (mod-test-double (* 2 most-negative-fixnum)))

under Callgrind shows that on my (GNU/Linux) machine Emacs only spends
10% of the CPU time of mod-test-double in mpz_import and mpz_export
combined, even though that function does little else.  (By contrast,
30% is spent in allocate_pseudovector.)

* src/emacs-module.h.in: Don't check EMACS_MODULE_GMP.  Don't include
gmp.h.  Remove emacs_mpz structure.  Instead, define type alias
emacs_limb_t and macro EMACS_LIMB_MAX.

* src/module-env-27.h: Change interface of extract_big_integer and
make_big_integer to take a sign-magnitude representation instead of
mpz_t.

* src/emacs-module.c: Don't check EMACS_MODULE_GMP or
EMACS_MODULE_HAVE_MPZ_T.  Add a comment about the chosen
implementation.
(module_extract_big_integer, module_make_big_integer): Reimplement
without using mpz_t in the interface.

* doc/lispref/internals.texi (Module Values): Adapt function
documentation and example.  Stop mentioning GMP and EMACS_MODULE_GMP.

* test/data/emacs-module/mod-test.c: Don't define EMACS_MODULE_GMP or
EMACS_MODULE_HAVE_MPZ_T.
(memory_full, extract_big_integer, make_big_integer): New helper
functions, identical to example in the Info documentation.
(Fmod_test_nanoseconds, Fmod_test_double): Adapt to new interface.
</pre>
</div>
</content>
</entry>
</feed>
