From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Phillip Lord Newsgroups: gmane.emacs.help Subject: Re: idle exit hook Date: Thu, 23 Jul 2020 13:16:41 +0100 Message-ID: <87zh7q1l5i.fsf@russet.org.uk> References: <20200721180146.huna7amd6rhftfuz.ref@ergus> <20200721180146.huna7amd6rhftfuz@ergus> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="532"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.91 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Ergus Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jul 23 14:18:13 2020 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 1jyaAu-000AbA-Ty for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 23 Jul 2020 14:18:12 +0200 Original-Received: from localhost ([::1]:49094 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jyaAt-0002gz-Un for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 23 Jul 2020 08:18:11 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58702) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyaAN-0002fk-DV for help-gnu-emacs@gnu.org; Thu, 23 Jul 2020 08:17:39 -0400 Original-Received: from cloud103.planethippo.com ([78.129.138.110]:42908) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jyaAL-0001pS-BQ for help-gnu-emacs@gnu.org; Thu, 23 Jul 2020 08:17:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=russet.org.uk; s=default; h=Content-Type:MIME-Version:Message-ID: In-Reply-To:Date:References:Subject:Cc:To:From:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=+GY+ZOkwN5h/G9zcG2/QsOsjEjz1c1Xh+oWHd1ApqlI=; b=ifjl0EECLpVJToVkPuvrtkin8 RGnoPvZjZzEXPQ7J41gsttqiL43nJA36fpSUfxYnYPnmD0mLAPHtmbdY9Ss2ToJKovRvxSaQRDEhE NuQD+1tHmBwPMOKMm0O8mvbllp7Ns4zAsp56s9sHGY8Y9zppXbGwHS+f05V+HGCja0nT7ecPBczA6 ldHnzeeqomvERTWUeAmXwAQ8j6fSP2TrAZR1SoqeYNAVizQ9unUWH6pTL1ht2gDLiDJ6XIRgXL6Va LGZRqpKvANujuvDfRDIIrRvmpmRnA5D+ZCP04c855ywCyWTFTWXcB4gLR8CSvBturRp2696D8/PcA kjT2be0CQ==; Original-Received: from cpc142652-benw12-2-0-cust953.16-2.cable.virginm.net ([82.21.43.186]:41804 helo=russet.org.uk) by cloud103.planethippo.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1jya9V-0005F7-HQ; Thu, 23 Jul 2020 13:16:48 +0100 In-Reply-To: <20200721180146.huna7amd6rhftfuz@ergus> (Ergus's message of "Tue, 21 Jul 2020 20:01:47 +0200") X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - cloud103.planethippo.com X-AntiAbuse: Original Domain - gnu.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - russet.org.uk X-Get-Message-Sender-Via: cloud103.planethippo.com: authenticated_id: phillip.lord@russet.org.uk X-Authenticated-Sender: cloud103.planethippo.com: phillip.lord@russet.org.uk Received-SPF: none client-ip=78.129.138.110; envelope-from=phillip.lord@russet.org.uk; helo=cloud103.planethippo.com X-detected-operating-system: by eggs.gnu.org: First seen = 2020/07/23 08:16:53 X-ACL-Warn: Detected OS = Linux 3.11 and newer 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, SPF_HELO_NONE=0.001, SPF_NONE=0.001, URIBL_BLOCKED=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 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" Xref: news.gmane.io gmane.emacs.help:123574 Archived-At: Ergus writes: > Hi: > > I recently saw a question in reddit but the answer there was not > clear (or maybe it requires a feature request) > > Is there an idle-time-exit-hook or, what's the canonical method to call > a function after breaking an idle? something like on-idle-exit? > > So far I understand that having such a hook could produce some > performance penalty but not more than post-command-hook for example. Any > way, adding some restrictions (running it only once || reset the > hooks list on every idle start/end or just documenting it properly) > could solve the problem.. does it makes sense. Not that I know of, but I think you achieve it easily. If you put a function on the idle-timer hook, then it will start to run as soon as Emacs idles. If this function calls `sit-for' then it will stall untill input arrives which is also when idle exits. If you want a proper hook, you create a hook and have your idle function call that hook. Phil