From: Yuan Fu <casouri@gmail.com>
To: Ruijie Yu <ruijie@netyu.xyz>
Cc: emacs-devel@gnu.org
Subject: Re: Catch arbitrary signal and throw it later in C
Date: Thu, 13 Apr 2023 01:12:37 -0700 [thread overview]
Message-ID: <7EA1F972-ADC7-4362-9E75-60C481FA8B2D@gmail.com> (raw)
In-Reply-To: <sdvpm88w7un.fsf@fw.net.yu>
> On Apr 13, 2023, at 12:33 AM, Ruijie Yu <ruijie@netyu.xyz> wrote:
>
>
> Yuan Fu <casouri@gmail.com> writes:
>
>> Say I have an arbitrary Lisp function func, and need to evaluate it in C. But
>> after evaluating the function, I need to do some clean up (freeing
>> something). Would be be possible to catch any signal thrown by evaluating the
>> function func, and throw it after cleaning up?
>
> Isn't `unwind-protect' (or its internal C functionalities) what you
> want, or is it not suitable in Emacs-C land? This macro is defined in
> C, FTR.
unwind-protect (and its internal C counterpart) pushes the cleanup form onto specpdl. Supposingly that form is later eval’ed? I want to run some C code which obviously it doesn’t support. I need to understand how this whole unwinding thing work before I can maybe modify or write something that does what I want. Hopefully some one can enlighten me :-)
Yuan
next prev parent reply other threads:[~2023-04-13 8:12 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-13 7:24 Catch arbitrary signal and throw it later in C Yuan Fu
2023-04-13 7:33 ` Ruijie Yu via Emacs development discussions.
2023-04-13 8:12 ` Yuan Fu [this message]
2023-04-13 8:20 ` Eli Zaretskii
2023-04-13 8:22 ` Po Lu
2023-04-13 22:18 ` Yuan Fu
2023-04-13 23:48 ` Po Lu
2023-04-13 8:24 ` Andreas Schwab
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=7EA1F972-ADC7-4362-9E75-60C481FA8B2D@gmail.com \
--to=casouri@gmail.com \
--cc=emacs-devel@gnu.org \
--cc=ruijie@netyu.xyz \
/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.