unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* Pass an argument to a sentinel?
@ 2017-07-28 20:16 Yassin Philip
  2017-07-29  6:21 ` Eli Zaretskii
  0 siblings, 1 reply; 3+ messages in thread
From: Yassin Philip @ 2017-07-28 20:16 UTC (permalink / raw)
  To: help-gnu-emacs

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



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Pass an argument to a sentinel?
  2017-07-28 20:16 Pass an argument to a sentinel? Yassin Philip
@ 2017-07-29  6:21 ` Eli Zaretskii
  2017-07-29 12:54   ` Philipp Stephani
  0 siblings, 1 reply; 3+ messages in thread
From: Eli Zaretskii @ 2017-07-29  6:21 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Yassin Philip <philcm@gnu.org>
> 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.



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Pass an argument to a sentinel?
  2017-07-29  6:21 ` Eli Zaretskii
@ 2017-07-29 12:54   ` Philipp Stephani
  0 siblings, 0 replies; 3+ messages in thread
From: Philipp Stephani @ 2017-07-29 12:54 UTC (permalink / raw)
  To: Eli Zaretskii, help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> schrieb am Sa., 29. Juli 2017 um 08:22 Uhr:

> > From: Yassin Philip <philcm@gnu.org>
> > 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.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-07-29 12:54 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-28 20:16 Pass an argument to a sentinel? Yassin Philip
2017-07-29  6:21 ` Eli Zaretskii
2017-07-29 12:54   ` Philipp Stephani

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).