From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eduardo Ochs Newsgroups: gmane.emacs.help Subject: How do I wait, or sit-for, until a hook is run? Date: Thu, 29 Dec 2022 18:41:05 -0300 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37293"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 29 22:41:47 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pB0ep-0009Tm-6q for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 29 Dec 2022 22:41:47 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pB0eS-00033K-SQ; Thu, 29 Dec 2022 16:41:24 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pB0eQ-00031Z-Ok for help-gnu-emacs@gnu.org; Thu, 29 Dec 2022 16:41:23 -0500 Original-Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pB0eP-0002n4-09 for help-gnu-emacs@gnu.org; Thu, 29 Dec 2022 16:41:22 -0500 Original-Received: by mail-il1-x135.google.com with SMTP id d14so10383407ilq.11 for ; Thu, 29 Dec 2022 13:41:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=WQiY1t3tsIpezo1oajwQy/ee+nNb59pUNFwPbqwLQT0=; b=WgiqJI4HxbN4+wpIoB4UmjEdjCaVVbm/vqNWkAPFtahDF4T6M7drjzJI5+xw4jNrfa t+/3sOP4tHCmQ5xEhPkNW/7VBzXhpZhz8QlopP+3+bKesOjMDQBzQ6+uVRgZ2E05D6jG +ff+VkzMVh8Fu/vDyCf0iREDEe7AeDIl7hVqVbu4Muom0ZXvJ+KYPRzTaYRqHwKDDpiT 9UtN6yHVdC2E0gc4oF183YDp4tq3CxbXyzs15vqYDww/g1y8ZYV4eAoarZ93eNVkmubJ K8Bsye8gVs3gsPsf1qDmSS2DAULeKT15SPNrV2LH6N9REwNOycUQT1shonS3iAM2McHh w6pA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=WQiY1t3tsIpezo1oajwQy/ee+nNb59pUNFwPbqwLQT0=; b=qzDPo2WRi3QF3IiOr6P3DsIdwVONr32Ess6s/x5pbzlHVeengSv0XBWEThCBJzOaS9 CpsnjDKqOg7+zJPv1XcVozGeEGJ3y3sMfjcNWJC70bPZy1kd3DLibH3nlT8bWhhxUBZP pEDa3SFZ9rp4E7rJfiP7+FORICDue99cTQxFFAOFEB6OoBvZKWUVzbfnIMw5rfx9Yytk Dh7GsyJFx5Tuy/RbHZVhygSv5GYglNutDlI39aQz8Rb2FpzOqo5oOOAYUM3WDUURjsqo m4jEQNYNo7wadSyepJ0gLoHhfUgdQUYKPewMyj1Q6ViRDfI08sFL5gdNi5+gahGUujnq N/dA== X-Gm-Message-State: AFqh2kq3MWw2tiwEG7PQV2iI0zZgHPLnSgpPaZC6SfSpJLx54sChy9OV crT9w4Nh4FODBSvX3QXMxZVc7UZ19sIIVZ4lu1n195L8gTs= X-Google-Smtp-Source: AMrXdXsBpPzcUCvGYUjdXwys+gFddUZ0BQwAjEOeZ8BykFcyLt6D+IiCZG8wo1WV9Ic3RjP3URnm6sCjL0lTQZbDemo= X-Received: by 2002:a92:ca82:0:b0:30a:9cbd:be00 with SMTP id t2-20020a92ca82000000b0030a9cbdbe00mr2956857ilo.262.1672350077426; Thu, 29 Dec 2022 13:41:17 -0800 (PST) Received-SPF: pass client-ip=2607:f8b0:4864:20::135; envelope-from=eduardoochs@gmail.com; helo=mail-il1-x135.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 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-mx.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.help:142022 Archived-At: Hi list, I am trying to write a function (my-sly-wait) that can be put here, (save-window-excursion (sly) (my-sly-wait)) and that only returns when the hook `sly-mrepl-hook' is run... How do I write that? Or, if I can ask for something nicer... how do I write a function like that that waits for at most 30 seconds displaying all output like a `sit-for' (?), and returns without errors if the hook `sly-mrepl-hook' is run, but yields an error if that hook is not run in 30 seconds? I spent some time trying to figure out how to do that using `add-hook', `remove-hook', `catch', `throw', `unwind-protect' and `sit-for', and then I realized that if I asked this question here then probably someone would answer with "look at code for foo in the package bar"... Thanks in advance! Eduardo Ochs http://angg.twu.net/#eev P.S.: my reasons for wanting/needing that are here: https://github.com/joaotavora/sly/issues/550