From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: How to test whether any code runs after same command invocation? Date: Fri, 14 Feb 2014 09:27:30 -0500 Message-ID: References: <87eh36kl1f.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1392388061 5182 80.91.229.3 (14 Feb 2014 14:27:41 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Feb 2014 14:27:41 +0000 (UTC) Cc: emacs-devel@gnu.org To: Michael Heerdegen Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Feb 14 15:27:49 2014 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1WEJk4-0002NA-BL for ged-emacs-devel@m.gmane.org; Fri, 14 Feb 2014 15:27:48 +0100 Original-Received: from localhost ([::1]:52038 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEJk3-0001pm-K3 for ged-emacs-devel@m.gmane.org; Fri, 14 Feb 2014 09:27:47 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54408) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEJju-0001pe-FY for emacs-devel@gnu.org; Fri, 14 Feb 2014 09:27:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WEJjn-0002iv-6g for emacs-devel@gnu.org; Fri, 14 Feb 2014 09:27:38 -0500 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:31692) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEJjn-0002iq-2U for emacs-devel@gnu.org; Fri, 14 Feb 2014 09:27:31 -0500 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av4EABK/CFFLd+SX/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOIYZwZgV6DFQ X-IPAS-Result: Av4EABK/CFFLd+SX/2dsb2JhbABEvw4Xc4IeAQEEAVYjBQsLNBIUGA0kiB4GwS2RCgOIYZwZgV6DFQ X-IronPort-AV: E=Sophos;i="4.84,565,1355115600"; d="scan'208";a="47639426" Original-Received: from 75-119-228-151.dsl.teksavvy.com (HELO pastel.home) ([75.119.228.151]) by ironport2-out.teksavvy.com with ESMTP/TLS/ADH-AES256-SHA; 14 Feb 2014 09:27:30 -0500 Original-Received: by pastel.home (Postfix, from userid 20848) id 64C4F600AA; Fri, 14 Feb 2014 09:27:30 -0500 (EST) In-Reply-To: <87eh36kl1f.fsf@web.de> (Michael Heerdegen's message of "Fri, 14 Feb 2014 12:09:48 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.248.154.181 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:169607 Archived-At: > Example: I use some code that propertizes any dired buffer in a way that > the mouse tooltip over any directory shows the directory contents. > Since that can take a long time for huge directory hierarchies, I want > to use a timeout. But if you have marked files you operate on, the code > is run multiple times when refreshing the files' lines, so the timeout Not sure I understand. Do you use after-change-functions, by any chance? Could you use jit-lock instead? > I currently do this by (defvar counter 0) and adding a fun to > post-command-hook that increases the counter. That sounds like the standard hack, yes. > Is there a cleverer way? In general, not that I know. You can also use wall-time instead of a counter incremented in post-command-hook. Stefan