[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master c61fbc5 2/3: Merge branch 'master' of git.sv.gnu.or
From: |
Michael Albinus |
Subject: |
[Emacs-diffs] master c61fbc5 2/3: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs |
Date: |
Mon, 27 Aug 2018 10:45:59 -0400 (EDT) |
branch: master
commit c61fbc529343194923ca11dfe10e9afb8b2546d3
Merge: e1370c3 1afd313
Author: Michael Albinus <address@hidden>
Commit: Michael Albinus <address@hidden>
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
doc/emacs/trouble.texi | 10 ++---
doc/misc/calc.texi | 13 +++---
etc/NEWS.26 | 61 ++++++++++++++--------------
etc/PROBLEMS | 2 +-
lisp/files-x.el | 4 +-
lisp/international/mule-conf.el | 5 +++
lisp/progmodes/cc-cmds.el | 83 ++++++++++++++-------------------------
lisp/textmodes/bibtex.el | 2 +-
nt/addpm.c | 7 +++-
src/alloc.c | 2 +-
src/emacs-module.c | 8 ++--
src/w32console.c | 30 ++++++++++++--
test/Makefile.in | 4 +-
test/data/emacs-module/mod-test.c | 19 +++++++++
test/src/emacs-module-tests.el | 3 ++
15 files changed, 141 insertions(+), 112 deletions(-)
diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi
index 37a7304..bb05378 100644
--- a/doc/emacs/trouble.texi
+++ b/doc/emacs/trouble.texi
@@ -1162,11 +1162,11 @@ name that indicates whether it is the old version or
your new changed
one.
@item
-Write the change log entries for your changes. This is both to save us
+Write the commit log entries for your changes. This is both to save us
the extra work of writing them, and to help explain your changes so we
can understand them.
-The purpose of the change log is to show people where to find what was
+The purpose of the commit log is to show people where to find what was
changed. So you need to be specific about what functions you changed;
in large functions, it's often helpful to indicate where within the
function the change was.
@@ -1177,9 +1177,9 @@ new function, all you need to say about it is that it is
new. If you
feel that the purpose needs explaining, it probably does---but put the
explanation in comments in the code. It will be more useful there.
-Please look at the change log entries of recent commits to see what
-sorts of information to put in, and to learn the style that we use. Note that,
-unlike some other projects, we do require change logs for
+Please look at the commit log entries of recent commits to see what
+sorts of information to put in, and to learn the style that we use.
+Note that, unlike some other projects, we do require commit logs for
documentation, i.e., Texinfo files.
@xref{Change Log},
@ifset WWW_GNU_ORG
diff --git a/doc/misc/calc.texi b/doc/misc/calc.texi
index 98ef6daa..02deee9 100644
--- a/doc/misc/calc.texi
+++ b/doc/misc/calc.texi
@@ -33275,19 +33275,18 @@ prefer them, or if you are calling these functions
from regular Lisp.
The functions described here are scattered throughout the various
Calc component files. Note that @file{calc.el} includes @code{autoload}s
-for only a few component files; when Calc wants to call an advanced
-function it calls @samp{(calc-extensions)} first; this function
-autoloads @file{calc-ext.el}, which in turn autoloads all the functions
-in the remaining component files.
+for only a few component files; to get autoloads of the more advanced
+function, one needs to load @file{calc-ext.el}, which in turn
+autoloads all the functions in the remaining component files.
Because @code{defmath} itself uses the extensions, user-written code
generally always executes with the extensions already loaded, so
normally you can use any Calc function and be confident that it will
be autoloaded for you when necessary. If you are doing something
special, check carefully to make sure each function you are using is
-from @file{calc.el} or its components, and call @samp{(calc-extensions)}
-before using any function based in @file{calc-ext.el} if you can't
-prove this file will already be loaded.
+from @file{calc.el} or its components, and use @address@hidden(require
+'calc-ext)}} before using any function based in @file{calc-ext.el} if
+you can't prove this file will already be loaded.
@menu
* Data Type Formats::
diff --git a/etc/NEWS.26 b/etc/NEWS.26
index a766e96..e94bda5 100644
--- a/etc/NEWS.26
+++ b/etc/NEWS.26
@@ -19,7 +19,7 @@ with a prefix argument or by typing C-u C-h C-n.
* Installation Changes in Emacs 26.2
---
-** Building Emacs with the '--with-xwidgets' option now requires WebKit2
+** Building Emacs with the '--with-xwidgets' option now requires WebKit2.
To build Emacs with xwidgets support, you will need to install the
webkit2gtk-4.0 package; version 2.12 or later is required.
(This change was actually made in Emacs 26.1, but was not called out
@@ -132,17 +132,17 @@ now the default in developer builds. As before, use
** When GCC warnings are enabled, '--enable-check-lisp-object-type' is
now enabled by default when configuring.
-** The Emacs server now has socket-launching support. This allows
-socket based activation, where an external process like systemd can
-invoke the Emacs server process upon a socket connection event and
-hand the socket over to Emacs. Emacs uses this socket to service
-emacsclient commands. This new functionality can be disabled with the
-configure option '--disable-libsystemd'.
+** The Emacs server now has socket-launching support.
+This allows socket based activation, where an external process like
+systemd can invoke the Emacs server process upon a socket connection
+event and hand the socket over to Emacs. Emacs uses this socket to
+service emacsclient commands. This new functionality can be disabled
+with the configure option '--disable-libsystemd'.
-** A systemd user unit file is provided. Use it in the standard way:
-'systemctl --user enable emacs'.
-(If your Emacs is installed in a non-standard location, you may
-need to copy the emacs.service file to eg ~/.config/systemd/user/)
+** A systemd user unit file is provided.
+Use it in the standard way: 'systemctl --user enable emacs'. (If your
+Emacs is installed in a non-standard location, you may need to copy
+the emacs.service file to eg ~/.config/systemd/user/)
** New configure option '--disable-build-details' attempts to build an
Emacs that is more likely to be reproducible; that is, if you build
@@ -153,7 +153,6 @@ following variables nil: 'emacs-build-system',
'emacs-build-time',
'erc-emacs-build-time'.
** Emacs can now be built with support for Little CMS.
-
If the lcms2 library is installed, Emacs will enable features built on
top of that library. The new configure option '--without-lcms2' can
be used to build without lcms2 support even if it is installed. Emacs
@@ -196,9 +195,9 @@ The effect is similar to that of "toolBar" resource on the
tool bar.
* Changes in Emacs 26.1
-** Option 'buffer-offer-save' can be set to new value, 'always'. When
-set to 'always', the command 'save-some-buffers' will always offer
-this buffer for saving.
+** Option 'buffer-offer-save' can be set to new value, 'always'.
+When set to 'always', the command 'save-some-buffers' will always
+offer this buffer for saving.
** Security vulnerability related to Enriched Text mode is removed.
@@ -684,7 +683,7 @@ This can be customized via the 'info-menu' category in
A new option 'ediff-show-ancestor' and a new toggle
'ediff-toggle-show-ancestor'.
-** TeX: Add luatex and xetex as alternatives to pdftex
+** TeX: Add luatex and xetex as alternatives to pdftex.
** Electric-Buffer-menu
@@ -1088,7 +1087,6 @@ to a format suitable for reverse lookup zone files.
** Ispell
*** Enchant is now supported as a spell-checker.
-
Enchant is a meta-spell-checker that uses providers such as Hunspell
to do the actual checking. With it, users can use spell-checkers not
directly supported by Emacs, such as Voikko, Hspell and AppleSpell,
@@ -1098,8 +1096,7 @@ configure different spelling-checkers for different
languages.
** Flymake
-*** Flymake has been completely redesigned
-
+*** Flymake has been completely redesigned.
Flymake now annotates arbitrary buffer regions, not just lines. It
supports arbitrary diagnostic types, not just errors and warnings (see
variable 'flymake-diagnostic-types-alist').
@@ -1115,7 +1112,6 @@ backend", which has been updated to benefit from the new
UI features.
** Term
*** 'term-char-mode' now makes its buffer read-only.
-
The buffer is made read-only to prevent changes from being made by
anything other than the process filter; and movements of point away
from the process mark are counter-acted so that the cursor is in the
@@ -1131,7 +1127,6 @@ the previous behavior.
** Xref
*** When an *xref* buffer is needed, 'TAB' quits and jumps to an xref.
-
A new command 'xref-quit-and-goto-xref', bound to 'TAB' in *xref*
buffers, quits the window before jumping to the destination. In many
situations, the intended window configuration is restored, just as if
@@ -1227,11 +1222,11 @@ change FOO, respectively. The exhaustive list of
removed variables is:
*** Many variables obsoleted in 22.1 referring to face symbols.
-** The variable 'text-quoting-style' is now a customizable option. It
-controls whether to and how to translate ASCII quotes in messages and
-help output. Its possible values and their semantics remain unchanged
-from Emacs 25. In particular, when this variable's value is 'grave',
-all quotes in formats are output as-is.
+** The variable 'text-quoting-style' is now a customizable option.
+It controls whether to and how to translate ASCII quotes in messages
+and help output. Its possible values and their semantics remain
+unchanged from Emacs 25. In particular, when this variable's value is
+'grave', all quotes in formats are output as-is.
** Functions like 'check-declare-file' and 'check-declare-directory'
now generate less chatter and more-compact diagnostics. The auxiliary
@@ -1495,10 +1490,11 @@ to provide region boundaries (for rectangular regions
more than one)
to an interactively callable function as a single argument instead of
two separate arguments 'region-beginning' and 'region-end'.
-** 'parse-partial-sexp' state has a new element. Element 10 is
-non-nil when the last character scanned might be the first character
-of a two character construct, i.e., a comment delimiter or escaped
-character. Its value is the syntax of that last character.
+** 'parse-partial-sexp' state has a new element.
+Element 10 is non-nil when the last character scanned might be the
+first character of a two character construct, i.e., a comment
+delimiter or escaped character. Its value is the syntax of that last
+character.
** 'parse-partial-sexp's state, element 9, has now been confirmed as
permanent and documented, and may be used by Lisp programs. Its value
@@ -1762,8 +1758,9 @@ the ELisp manual.
*** 'select-frame-by-name' now may return a frame on another display
if it does not find a suitable one on the current display.
-** 'tcl-auto-fill-mode' is now declared obsolete. Its functionality
-can be replicated simply by setting 'comment-auto-fill-only-comments'.
+** 'tcl-auto-fill-mode' is now declared obsolete.
+Its functionality can be replicated simply by setting
+'comment-auto-fill-only-comments'.
** New pcase pattern 'rx' to match against an rx-style regular expression.
For details, see the doc string of 'rx--pcase-macroexpander'.
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index fe59b52..a1fae22 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -1135,7 +1135,7 @@ is running. If gnome-settings-daemon is not running,
Emacs receives
input through XIM without any problem. Furthermore, this seems only
to happen in *.UTF-8 locales; zh_CN.GB2312 and zh_CN.GBK locales, for
example, work fine. A bug report has been filed in the Gnome
-bugzilla: http://bugzilla.gnome.org/show_bug.cgi?id=357032
+bugzilla: https://bugzilla.gnome.org/show_bug.cgi?id=357032
*** Gnome: GPaste clipboard manager causes erratic behavior of 'yank'
diff --git a/lisp/files-x.el b/lisp/files-x.el
index 2a52792..92532e8 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -377,7 +377,9 @@ from the -*- line ignoring the input argument VALUE."
((eq variable 'mode) (goto-char beg))
((null replaced-pos) (goto-char end))
(replaced-pos (goto-char replaced-pos)))
- (if (and (not (eq (char-before) ?\;))
+ (if (and (save-excursion
+ (skip-chars-backward " \t")
+ (not (eq (char-before) ?\;)))
(not (equal (point) (marker-position beg)))
;; When existing `-*- -*-' is empty, beg > end.
(not (> (marker-position beg) (marker-position end))))
diff --git a/lisp/international/mule-conf.el b/lisp/international/mule-conf.el
index 3affeec..b08150a 100644
--- a/lisp/international/mule-conf.el
+++ b/lisp/international/mule-conf.el
@@ -1304,6 +1304,11 @@ is treated as a character."
:bom '(utf-8-with-signature . utf-8))
(define-coding-system-alias 'mule-utf-8 'utf-8)
+;; See this page:
+;; https://docs.microsoft.com/en-us/windows/desktop/intl/code-page-identifiers
+;; Starting with Windows 10, people are trying to set their systems to
+;; use UTF-8 , so we had better recognized this alias:
+(define-coding-system-alias 'cp65001 'utf-8)
(define-coding-system 'utf-8-emacs
"Support for all Emacs characters (including non-Unicode characters)."
diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el
index 31cf0b1..478ccf1 100644
--- a/lisp/progmodes/cc-cmds.el
+++ b/lisp/progmodes/cc-cmds.el
@@ -1383,7 +1383,7 @@ No indentation or other \"electric\" behavior is
performed."
(let ((eo-block (point))
bod)
(and (eq (char-before) ?\})
- (eq (car (c-beginning-of-decl-1 lim)) 'previous)
+ (memq (car (c-beginning-of-decl-1 lim)) '(same previous))
(setq bod (point))
;; Look for struct or union or ... If we find one, it might
;; be the return type of a function, or the like. Exclude
@@ -1445,10 +1445,17 @@ No indentation or other \"electric\" behavior is
performed."
(consp paren-state)
(consp (car paren-state))
(eq start (cdar paren-state))
- (not
- (progn
+ (or
+ (save-excursion
(c-forward-syntactic-ws)
- (looking-at c-symbol-start))))
+ (or (not (looking-at c-symbol-start))
+ (looking-at c-keywords-regexp)))
+ (save-excursion
+ (goto-char (caar paren-state))
+ (c-beginning-of-decl-1
+ (and least-enclosing
+ (c-safe-position least-enclosing paren-state)))
+ (not (looking-at c-defun-type-name-decl-key)))))
'at-function-end)
(t
;; Find the start of the current declaration. NOTE: If we're in the
@@ -1841,7 +1848,7 @@ or NIL if there isn't one. \"Defun\" here means a
function, or
other top level construct with a brace block."
(c-save-buffer-state
(beginning-of-defun-function end-of-defun-function
- where pos decl name-start name-end case-fold-search)
+ where pos decl0 decl type-pos tag-pos case-fold-search)
(save-excursion
;; Move back out of any macro/comment/string we happen to be in.
@@ -1861,31 +1868,10 @@ other top level construct with a brace block."
(when (looking-at c-typedef-key)
(goto-char (match-end 0))
(c-forward-syntactic-ws))
+ (setq type-pos (point))
;; Pick out the defun name, according to the type of defun.
(cond
- ;; struct, union, enum, or similar:
- ((save-excursion
- (and
- (looking-at c-defun-type-name-decl-key)
- (consp (c-forward-decl-or-cast-1 (c-point 'bosws) 'top nil))
- (or (not (or (eq (char-after) ?{)
- (and c-recognize-knr-p
- (c-in-knr-argdecl))))
- (progn (c-backward-syntactic-ws)
- (not (eq (char-before) ?\)))))))
- (let ((key-pos (point)))
- (c-forward-over-token-and-ws) ; over "struct ".
- (cond
- ((looking-at c-symbol-key) ; "struct foo { ..."
- (buffer-substring-no-properties key-pos (match-end 0)))
- ((eq (char-after) ?{) ; "struct { ... } foo"
- (when (c-go-list-forward)
- (c-forward-syntactic-ws)
- (when (looking-at c-symbol-key) ; a bit bogus - there might
- ; be several identifiers.
- (match-string-no-properties 0)))))))
-
((looking-at "DEFUN\\s-*(") ;"DEFUN\\_>") think of XEmacs!
;; DEFUN ("file-name-directory", Ffile_name_directory,
Sfile_name_directory, ...) ==> Ffile_name_directory
;; DEFUN(POSIX::STREAM-LOCK, stream lockp &key BLOCK SHARED START
LENGTH) ==> POSIX::STREAM-LOCK
@@ -1901,32 +1887,23 @@ other top level construct with a brace block."
(c-backward-syntactic-ws)
(point))))
- (t
- ;; Normal function or initializer.
- (when
- (and
- (consp
- (setq decl
- (c-forward-decl-or-cast-1 (c-point 'bosws) 'top nil)))
- (setq name-start (car decl))
- (progn (if (and (looking-at c-after-suffixed-type-decl-key)
- (match-beginning 1))
- (c-forward-keyword-clause 1))
- t)
- (or (eq (char-after) ?{)
- (and c-recognize-knr-p
- (c-in-knr-argdecl)))
- (goto-char name-start)
- (c-forward-name)
- (eq (char-after) ?\())
- (c-backward-syntactic-ws)
- (when (eq (char-before) ?\=) ; struct foo bar = {0, 0} ;
- (c-backward-token-2)
- (c-backward-syntactic-ws))
- (setq name-end (point))
- (c-back-over-compound-identifier)
- (and (looking-at c-symbol-start)
- (buffer-substring-no-properties (point) name-end)))))))))
+ (t ; Normal function or initializer.
+ (when (looking-at c-defun-type-name-decl-key) ; struct, etc.
+ (goto-char (match-end 0))
+ (c-forward-syntactic-ws)
+ (setq tag-pos (point))
+ (goto-char type-pos))
+ (setq decl0 (c-forward-decl-or-cast-1 (c-point 'bosws) 'top nil))
+ (when (consp decl0)
+ (goto-char (car decl0))
+ (setq decl (c-forward-declarator)))
+ (and decl
+ (car decl) (cadr decl)
+ (buffer-substring-no-properties
+ (if (eq (car decl) tag-pos)
+ type-pos
+ (car decl))
+ (cadr decl)))))))))
(defun c-defun-name ()
"Return the name of the current defun, or NIL if there isn't one.
diff --git a/lisp/textmodes/bibtex.el b/lisp/textmodes/bibtex.el
index 50a30cf..6f6b062 100644
--- a/lisp/textmodes/bibtex.el
+++ b/lisp/textmodes/bibtex.el
@@ -457,7 +457,7 @@ INIT is either the initial content of the field or a
function,
which is called to determine the initial content of the field.
ALTERNATIVE if non-nil is an integer that numbers sets of
alternatives, starting from zero."
- :group 'BibTeX
+ :group 'bibtex
:version "26.1" ; add Conference
:type 'bibtex-entry-alist)
(put 'bibtex-BibTeX-entry-alist 'risky-local-variable t)
diff --git a/nt/addpm.c b/nt/addpm.c
index ec7d7ff..2132020 100644
--- a/nt/addpm.c
+++ b/nt/addpm.c
@@ -38,9 +38,12 @@ along with GNU Emacs. If not, see
<https://www.gnu.org/licenses/>. */
#include <stdio.h>
#include <malloc.h>
-/* MinGW64 barfs if _WIN32_IE is defined to anything below 0x500. */
+/* MinGW64 barfs if _WIN32_IE is defined to anything below 0x0500. */
#ifndef MINGW_W64
-#define _WIN32_IE 0x400
+# ifdef _WIN32_IE
+# undef _WIN32_IE
+# endif
+#define _WIN32_IE 0x0400
#endif
/* Request C Object macros for COM interfaces. */
#define COBJMACROS 1
diff --git a/src/alloc.c b/src/alloc.c
index cdcd465..c9788ab 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -7017,7 +7017,7 @@ Frames, windows, buffers, and subprocesses count as
vectors
(but the contents of a buffer's text do not count here). */)
(void)
{
- return listn (CONSTYPE_HEAP, 8,
+ return listn (CONSTYPE_HEAP, 7,
bounded_number (cons_cells_consed),
bounded_number (floats_consed),
bounded_number (vector_cells_consed),
diff --git a/src/emacs-module.c b/src/emacs-module.c
index e7ba174..f2844c4 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -344,20 +344,20 @@ module_free_global_ref (emacs_env *env, emacs_value ref)
Lisp_Object globals = global_env_private.values;
Lisp_Object prev = Qnil;
ptrdiff_t count = 0;
- for (Lisp_Object tail = global_env_private.values; CONSP (tail);
+ for (Lisp_Object tail = globals; CONSP (tail);
tail = XCDR (tail))
{
- emacs_value global = xmint_pointer (XCAR (globals));
+ emacs_value global = xmint_pointer (XCAR (tail));
if (global == ref)
{
if (NILP (prev))
global_env_private.values = XCDR (globals);
else
- XSETCDR (prev, XCDR (globals));
+ XSETCDR (prev, XCDR (tail));
return;
}
++count;
- prev = globals;
+ prev = tail;
}
module_abort ("Global value was not found in list of %"pD"d globals",
count);
diff --git a/src/w32console.c b/src/w32console.c
index 6c3cf06..9f9db68 100644
--- a/src/w32console.c
+++ b/src/w32console.c
@@ -140,23 +140,36 @@ w32con_clear_frame (struct frame *f)
}
-static struct glyph glyph_base[256];
+static struct glyph glyph_base[80];
+static struct glyph *glyphs = glyph_base;
+static size_t glyphs_len = ARRAYELTS (glyph_base);
static BOOL ceol_initialized = FALSE;
/* Clear from Cursor to end (what's "standout marker"?). */
static void
w32con_clear_end_of_line (struct frame *f, int end)
{
+ /* Time to reallocate our "empty row"? With today's large screens,
+ it is not unthinkable to see TTY frames well in excess of
+ 80-character width. */
+ if (end - cursor_coords.X > glyphs_len)
+ {
+ if (glyphs == glyph_base)
+ glyphs = NULL;
+ glyphs = xrealloc (glyphs, FRAME_COLS (f) * sizeof (struct glyph));
+ glyphs_len = FRAME_COLS (f);
+ ceol_initialized = FALSE;
+ }
if (!ceol_initialized)
{
int i;
- for (i = 0; i < 256; i++)
+ for (i = 0; i < glyphs_len; i++)
{
- memcpy (&glyph_base[i], &space_glyph, sizeof (struct glyph));
+ memcpy (&glyphs[i], &space_glyph, sizeof (struct glyph));
}
ceol_initialized = TRUE;
}
- w32con_write_glyphs (f, glyph_base, end - cursor_coords.X); /* fencepost ?
*/
+ w32con_write_glyphs (f, glyphs, end - cursor_coords.X);
}
/* Insert n lines at vpos. if n is negative delete -n lines. */
@@ -772,6 +785,15 @@ initialize_w32_display (struct terminal *term, int *width,
int *height)
*width = 1 + info.srWindow.Right - info.srWindow.Left;
}
+ /* Force reinitialization of the "empty row" buffer, in case they
+ dumped from a running session. */
+ if (glyphs != glyph_base)
+ {
+ glyphs = NULL;
+ glyphs_len = 0;
+ ceol_initialized = FALSE;
+ }
+
if (os_subtype == OS_NT)
w32_console_unicode_input = 1;
else
diff --git a/test/Makefile.in b/test/Makefile.in
index 0bc893b..a1f4388 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -246,12 +246,14 @@ else
FPIC_CFLAGS = -fPIC
endif
+# Note: emacs-module.h is generated from emacs-module.h.in, hence we
+# look in ../src, not $(srcdir)/../src.
MODULE_CFLAGS = -I../src $(FPIC_CFLAGS) $(PROFILING_CFLAGS) \
$(WARN_CFLAGS) $(WERROR_CFLAGS) $(CFLAGS)
test_module = $(test_module_dir)/mod-test${SO}
src/emacs-module-tests.log: $(test_module)
-$(test_module): $(test_module:${SO}=.c) $(srcdir)/../src/emacs-module.h
+$(test_module): $(test_module:${SO}=.c) ../src/emacs-module.h
$(AM_V_at)${MKDIR_P} $(dir $@)
$(AM_V_CCLD)$(CC) -shared $(CPPFLAGS) $(MODULE_CFLAGS) $(LDFLAGS) \
-o $@ $<
diff --git a/test/data/emacs-module/mod-test.c
b/test/data/emacs-module/mod-test.c
index db05e90..a9b459b 100644
--- a/test/data/emacs-module/mod-test.c
+++ b/test/data/emacs-module/mod-test.c
@@ -156,6 +156,24 @@ Fmod_test_globref_make (emacs_env *env, ptrdiff_t nargs,
emacs_value args[],
return env->make_global_ref (env, lisp_str);
}
+/* Create a few global references from arguments and free them. */
+static emacs_value
+Fmod_test_globref_free (emacs_env *env, ptrdiff_t nargs, emacs_value args[],
+ void *data)
+{
+ emacs_value refs[10];
+ for (int i = 0; i < 10; i++)
+ {
+ refs[i] = env->make_global_ref (env, args[i % nargs]);
+ }
+ for (int i = 0; i < 10; i++)
+ {
+ env->free_global_ref (env, refs[i]);
+ }
+ return env->intern (env, "ok");
+}
+
+
/* Return a copy of the argument string where every 'a' is replaced
with 'b'. */
@@ -339,6 +357,7 @@ emacs_module_init (struct emacs_runtime *ert)
DEFUN ("mod-test-non-local-exit-funcall", Fmod_test_non_local_exit_funcall,
1, 1, NULL, NULL);
DEFUN ("mod-test-globref-make", Fmod_test_globref_make, 0, 0, NULL, NULL);
+ DEFUN ("mod-test-globref-free", Fmod_test_globref_free, 4, 4, NULL, NULL);
DEFUN ("mod-test-string-a-to-b", Fmod_test_string_a_to_b, 1, 1, NULL, NULL);
DEFUN ("mod-test-userptr-make", Fmod_test_userptr_make, 1, 1, NULL, NULL);
DEFUN ("mod-test-userptr-get", Fmod_test_userptr_get, 1, 1, NULL, NULL);
diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el
index 90cd37a..c67190b 100644
--- a/test/src/emacs-module-tests.el
+++ b/test/src/emacs-module-tests.el
@@ -148,6 +148,9 @@ changes."
(garbage-collect) ;; XXX: not enough to really test but it's something..
(should (string= ref-str mod-str))))
+(ert-deftest mod-test-globref-free-test ()
+ (should (eq (mod-test-globref-free 1 'a "test" 'b) 'ok)))
+
(ert-deftest mod-test-string-a-to-b-test ()
(should (string= (mod-test-string-a-to-b "aaa") "bbb")))