From: Philipp Stephani <p.stephani2@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: aurelien.aptel+emacs@gmail.com, tzz@lifelogs.com,
dancol@dancol.org, emacs-devel@gnu.org
Subject: Re: Reporting Lisp errors in dynamic modules
Date: Fri, 27 Nov 2015 18:40:39 +0000 [thread overview]
Message-ID: <CAArVCkRcesop=SQwNu0_N42s0PqxFsZwvWmgnKN4byawSvsxtw@mail.gmail.com> (raw)
In-Reply-To: <83vb8nqpmf.fsf@gnu.org>
[-- Attachment #1.1: Type: text/plain, Size: 502 bytes --]
OK, here's a quick (untested, sorry) patch.
Eli Zaretskii <eliz@gnu.org> schrieb am Fr., 27. Nov. 2015 um 19:11 Uhr:
> > From: Philipp Stephani <p.stephani2@gmail.com>
> > Date: Fri, 27 Nov 2015 18:01:54 +0000
> > Cc: emacs-devel@gnu.org, aurelien.aptel+emacs@gmail.com,
> tzz@lifelogs.com,
> > dancol@dancol.org
> >
> > We could rename the function to "internal-module-call" to make it even
> less
> > likely to clash.
>
> Yes, I think renaming it, even to internal--module-call, is a must.
>
[-- Attachment #1.2: Type: text/html, Size: 1103 bytes --]
[-- Attachment #2: 0001-Intern-module-call-but-rename-it.patch --]
[-- Type: application/octet-stream, Size: 4098 bytes --]
From 16915940e818b2f1dfc0d8aa4f299901aa0cf37e Mon Sep 17 00:00:00 2001
From: Philipp Stephani <phst@google.com>
Date: Fri, 27 Nov 2015 19:39:29 +0100
Subject: [PATCH] Intern `module-call', but rename it.
---
src/emacs-module.c | 36 +++++++++++++++++-------------------
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/src/emacs-module.c b/src/emacs-module.c
index c75ddeb..8a0b02c 100644
--- a/src/emacs-module.c
+++ b/src/emacs-module.c
@@ -221,8 +221,8 @@ static void module_wrong_type (emacs_env *, Lisp_Object, Lisp_Object);
/* A function environment is an auxiliary structure used by
`module_make_function' to store information about a module
function. It is stored in a save pointer and retrieved by
- `module-call'. Its members correspond to the arguments given to
- `module_make_function'. */
+ `internal--module-call'. Its members correspond to the arguments
+ given to `module_make_function'. */
struct module_fun_env
{
@@ -231,11 +231,6 @@ struct module_fun_env
void *data;
};
-/* The function definition of `module-call'. `module-call' is
- uninterned because user code couldn't meaningfully use it, so keep
- its definition around somewhere else. */
-static Lisp_Object module_call_func;
-
\f
/* Implementation of runtime and environment functions.
@@ -391,12 +386,12 @@ module_non_local_exit_throw (emacs_env *env, emacs_value tag, emacs_value value)
value_to_lisp (value));
}
-/* A module function is lambda function that calls `module-call',
- passing the function pointer of the module function along with the
- module emacs_env pointer as arguments.
+/* A module function is lambda function that calls
+ `internal--module-call', passing the function pointer of the module
+ function along with the module emacs_env pointer as arguments.
(function (lambda (&rest arglist)
- (module-call envobj arglist))) */
+ (internal--module-call envobj arglist))) */
static emacs_value
module_make_function (emacs_env *env, ptrdiff_t min_arity, ptrdiff_t max_arity,
@@ -430,7 +425,7 @@ module_make_function (emacs_env *env, ptrdiff_t min_arity, ptrdiff_t max_arity,
Lisp_Object ret = list4 (Qlambda,
list2 (Qand_rest, Qargs),
doc,
- list3 (module_call_func,
+ list3 (Qinternal_module_call,
envobj,
Qargs));
@@ -785,12 +780,16 @@ DEFUN ("module-load", Fmodule_load, Smodule_load, 1, 1, 0,
return Qt;
}
-DEFUN ("module-call", Fmodule_call, Smodule_call, 2, 2, 0,
+DEFUN ("internal--module-call", Finternal_module_call, Sinternal_module_call, 2, 2, 0,
doc: /* Internal function to call a module function.
ENVOBJ is a save pointer to a module_fun_env structure.
ARGLIST is a list of arguments passed to SUBRPTR. */)
(Lisp_Object envobj, Lisp_Object arglist)
{
+ CHECK_TYPE (SAVE_VALUEP (envobj), Qsave_value_p, envobj);
+ struct Lisp_Save_Value *save_value = XSAVE_VALUE (envobj);
+ CHECK_TYPE (save_type (save_value, 0) == SAVE_POINTER, Qsave_pointer_p, envobj);
+ CHECK_CONS (arglist);
struct module_fun_env *envptr = XSAVE_POINTER (envobj, 0);
EMACS_INT len = XFASTINT (Flength (arglist));
eassume (0 <= envptr->min_arity);
@@ -1158,14 +1157,13 @@ syms_of_module (void)
code or modules should not access it. */
Funintern (Qmodule_refs_hash, Qnil);
+ DEFSYM (Qsave_value_p, "save-value-p");
+ DEFSYM (Qsave_pointer_p, "save-pointer-p");
+
defsubr (&Smodule_load);
- /* Don't call defsubr on `module-call' because that would intern it,
- but `module-call' is an internal function that users cannot
- meaningfully use. Instead, assign its definition to a private
- variable. */
- XSETPVECTYPE (&Smodule_call, PVEC_SUBR);
- XSETSUBR (module_call_func, &Smodule_call);
+ DEFSYM (Qinternal_module_call, "internal--module-call");
+ defsubr (&Sinternal_module_call);
}
/* Unlike syms_of_module, this initializer is called even from an
--
2.6.3
next prev parent reply other threads:[~2015-11-27 18:40 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-27 11:07 Reporting Lisp errors in dynamic modules Eli Zaretskii
2015-11-27 11:20 ` Aurélien Aptel
2015-11-27 11:46 ` Eli Zaretskii
2015-11-27 12:49 ` Aurélien Aptel
2015-11-27 12:53 ` David Kastrup
2015-11-27 14:50 ` Eli Zaretskii
2015-11-27 16:40 ` Philipp Stephani
2015-11-27 17:39 ` Eli Zaretskii
2015-11-27 18:01 ` Philipp Stephani
2015-11-27 18:11 ` Eli Zaretskii
2015-11-27 18:40 ` Philipp Stephani [this message]
2015-11-28 12:04 ` Eli Zaretskii
2015-12-03 5:00 ` Stefan Monnier
2015-12-03 11:33 ` Aurélien Aptel
2015-12-03 13:42 ` Ted Zlatanov
2015-12-03 15:37 ` Stefan Monnier
2015-12-07 19:13 ` Philipp Stephani
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CAArVCkRcesop=SQwNu0_N42s0PqxFsZwvWmgnKN4byawSvsxtw@mail.gmail.com' \
--to=p.stephani2@gmail.com \
--cc=aurelien.aptel+emacs@gmail.com \
--cc=dancol@dancol.org \
--cc=eliz@gnu.org \
--cc=emacs-devel@gnu.org \
--cc=tzz@lifelogs.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.