From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Nikolay Kudryavtsev Newsgroups: gmane.emacs.help Subject: Wait for function to execute? Date: Fri, 9 Jun 2017 00:34:40 +0300 Message-ID: NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1496957733 5128 195.159.176.226 (8 Jun 2017 21:35:33 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 8 Jun 2017 21:35:33 +0000 (UTC) User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.1.1 To: "help-gnu-emacs@gnu.org" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Jun 08 23:35:26 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dJ55R-0000ih-BG for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Jun 2017 23:35:25 +0200 Original-Received: from localhost ([::1]:51554 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJ55T-0002Al-KS for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Jun 2017 17:35:27 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:58974) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dJ54s-0002Ae-PX for help-gnu-emacs@gnu.org; Thu, 08 Jun 2017 17:34:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dJ54n-0005qp-T4 for help-gnu-emacs@gnu.org; Thu, 08 Jun 2017 17:34:50 -0400 Original-Received: from mail-lf0-x22e.google.com ([2a00:1450:4010:c07::22e]:33766) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dJ54n-0005pb-L4 for help-gnu-emacs@gnu.org; Thu, 08 Jun 2017 17:34:45 -0400 Original-Received: by mail-lf0-x22e.google.com with SMTP id a136so22998179lfa.0 for ; Thu, 08 Jun 2017 14:34:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:message-id:date:user-agent:mime-version :content-language; bh=l+MBB3ZxBhZFlmWZyPdRc4QVt6ZZ9WAPgf1CxgWOGIE=; b=K5L3DAmPOa58lthnFWNJHS+UbAQZOlBAjHzA2Po/vd5PxCacY4XXV6lekXqrltCCc4 mALwN+vnraxw/4DnUZJ6EJTH53kWSOV2bZBchg1bnNWya2Q2mZOD/DH3OdM1h2bBMcc+ BI4PUsk3upIx4cDdGoTjhoT9QwRVOxZwPkMM6pIOL+zR5zoCzGqO1uzGcBYLcehEPZX6 U0JRcgZwyVZhO7XTUtlUIiOaZ/PdFok5010WioS754TNLt/QtB0VMmxNnhfJylCx2oZF AxlQAeVd87f3MpIRhrZxVbjACO3P1Ihxqc+mya0KWMF+QLhGsoEgpwN3ggXp2x5jlNpW dt0w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:message-id:date:user-agent :mime-version:content-language; bh=l+MBB3ZxBhZFlmWZyPdRc4QVt6ZZ9WAPgf1CxgWOGIE=; b=jRV4HQM98DFVouuvLlP5GzBZshsTdI+5/PAqs6mXamL/WNg7jJzFGq9tvzzGy286O4 fzlKqpDsGLkP3DiRDltSoKwW7VCHu545tikiWQi39nfvc/bJxHKWuY3mt1oCI0lK9U4K kdnxRqL52d5h/Sa4DB9MBRRkezVrU5nS/Phkx1ejZtp+j0WXG3q0fYFDxrAeNzgBkLDR 5iGJlHx+gW/RVgoTAo2s39Xs+hNLqSvcMBOEGULDdNyrGoWW1j/OaSbSce2DygTbH7BS PX4POxKk1d9ELUN4+vx/4Te1Jc13eSpcaEUvKKbUjZmL9qfdQLgzS/gEAyX3B0/8bYDm NKRw== X-Gm-Message-State: AODbwcAeQhqBpZI7AVlPPwDoZY8asu0FQCHDswD6ecAzbm32fwtQpLvn vSvp6oRhPmrjmDqN X-Received: by 10.46.83.72 with SMTP id t8mr1860451ljd.82.1496957682443; Thu, 08 Jun 2017 14:34:42 -0700 (PDT) Original-Received: from [192.168.199.6] (broadband-95-84-209-126.moscow.rt.ru. [95.84.209.126]) by smtp.gmail.com with ESMTPSA id y26sm1306555lja.22.2017.06.08.14.34.40 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 08 Jun 2017 14:34:40 -0700 (PDT) X-Google-Original-From: Nikolay Kudryavtsev Content-Language: en-US X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4010:c07::22e X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:113408 Archived-At: Hello. I have a case where I'm writing a unit test(A) that needs to wait for a function(B) that's called by a process sentinel for a process started by this unit test. So, when A runs, B runs too, eventually... Since it's a unit test, changing B is off limits. So far I'm thinking of advising B using advice-once described by Drew here . As my advice function I would use a closure that wraps over some condition. Then I would have a while loop that sleeps until that condition is fulfilled. All this wrapped into one beautiful(ha!) macro. Are there any more, ugh, reasonable options? -- Best Regards, Nikolay Kudryavtsev