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 12:15:12 -0500 Message-ID: References: <87eh36kl1f.fsf@web.de> <87d2ip91gp.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1392398159 3601 80.91.229.3 (14 Feb 2014 17:15:59 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 14 Feb 2014 17:15:59 +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 18:16:04 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 1WEMMs-00030g-JP for ged-emacs-devel@m.gmane.org; Fri, 14 Feb 2014 18:16:02 +0100 Original-Received: from localhost ([::1]:52999 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEMMs-0000kV-4J for ged-emacs-devel@m.gmane.org; Fri, 14 Feb 2014 12:16:02 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33826) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEMMi-0000iJ-BQ for emacs-devel@gnu.org; Fri, 14 Feb 2014 12:16:00 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WEMMa-0000OI-0u for emacs-devel@gnu.org; Fri, 14 Feb 2014 12:15:52 -0500 Original-Received: from mercure.iro.umontreal.ca ([132.204.24.67]:41417) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WEMMZ-0000O8-Sj for emacs-devel@gnu.org; Fri, 14 Feb 2014 12:15:43 -0500 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id 4C92784CEC; Fri, 14 Feb 2014 12:15:43 -0500 (EST) Original-Received: from lechon.iro.umontreal.ca (lechon.iro.umontreal.ca [132.204.27.242]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id C42CD1E5B8B; Fri, 14 Feb 2014 12:15:12 -0500 (EST) Original-Received: by lechon.iro.umontreal.ca (Postfix, from userid 20848) id A5A18B40FE; Fri, 14 Feb 2014 12:15:12 -0500 (EST) In-Reply-To: <87d2ip91gp.fsf@web.de> (Michael Heerdegen's message of "Fri, 14 Feb 2014 16:08:06 +0100") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82, MC_TSTLAST 0.00) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 132.204.24.67 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:169624 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? > I after-advice dired-insert-set-properties. Then why is the code run multiple times? > I didn't want to cope with that. Also, this was just an example, I have > other, quite different use cases of the raised issue. The general idea might still apply: try and make it lazier. E.g. change your code so that rather than doing the job right away, it just writes down somewhere what jobs needs to be done, and then later (e.g. in post-command-hook, jit-lock, timer, you name it) look at what was written down (if anything) and do it then, once. Of course, it can't always be done. > What's that? "Wall clock" is this thing that you can get from your watch, your phone, or the `current-time' function ;-) Stefan