Pass an argument to a sentinel?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Pass an argument to a sentinel?

Yassin Philip
I'm sure it has been asked to death, but all my searches has been
unsuccessful:

 From the Elisp manual at the Sentinels chapter
<https://www.gnu.org/software/emacs/manual/html_node/elisp/Sentinels.html>:

    "The sentinel receives /two arguments/: the process for which the
    event occurred, and a string describing the type of event."

But I need it to receive at least one more argument, because at the end
of the process, the context (like the buffer at the time of the sentinel
call) may have changed.

How can I pass arguments to a sentinel? More generally, *how to pass
arguments in a quoted function call*?


-yPhil


--
Yassin Philip      New album NOW
http://yassinphilip.bitbucket.io

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pass an argument to a sentinel?

Eli Zaretskii
> From: Yassin Philip <[hidden email]>
> Date: Fri, 28 Jul 2017 21:16:14 +0100
>
>     "The sentinel receives /two arguments/: the process for which the
>     event occurred, and a string describing the type of event."
>
> But I need it to receive at least one more argument, because at the end
> of the process, the context (like the buffer at the time of the sentinel
> call) may have changed.
>
> How can I pass arguments to a sentinel?

One way is to have a global variable with those additional values.
Another is to put a property on the process object whose value
provides those arguments.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Pass an argument to a sentinel?

Philipp Stephani
Eli Zaretskii <[hidden email]> schrieb am Sa., 29. Juli 2017 um 08:22 Uhr:

> > From: Yassin Philip <[hidden email]>
> > Date: Fri, 28 Jul 2017 21:16:14 +0100
> >
> >     "The sentinel receives /two arguments/: the process for which the
> >     event occurred, and a string describing the type of event."
> >
> > But I need it to receive at least one more argument, because at the end
> > of the process, the context (like the buffer at the time of the sentinel
> > call) may have changed.
> >
> > How can I pass arguments to a sentinel?
>
> One way is to have a global variable with those additional values.
> Another is to put a property on the process object whose value
> provides those arguments.
>
>
The third (and most generic) way is to use a lexical closure.
Loading...