From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Heerdegen Newsgroups: gmane.emacs.devel Subject: Why is `after-change-functions' reset? Date: Mon, 17 Feb 2014 19:35:31 +0100 Message-ID: <878ut9r3ik.fsf@web.de> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1392662166 21920 80.91.229.3 (17 Feb 2014 18:36:06 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Mon, 17 Feb 2014 18:36:06 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Mon Feb 17 19:36:13 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 1WFT37-0007RG-5X for ged-emacs-devel@m.gmane.org; Mon, 17 Feb 2014 19:36:13 +0100 Original-Received: from localhost ([::1]:43471 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFT36-0006bw-R9 for ged-emacs-devel@m.gmane.org; Mon, 17 Feb 2014 13:36:12 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:54782) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFT2w-0006aY-8p for emacs-devel@gnu.org; Mon, 17 Feb 2014 13:36:09 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WFT2o-0008PX-Vj for emacs-devel@gnu.org; Mon, 17 Feb 2014 13:36:02 -0500 Original-Received: from plane.gmane.org ([80.91.229.3]:45129) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WFT2o-0008PL-OO for emacs-devel@gnu.org; Mon, 17 Feb 2014 13:35:54 -0500 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WFT2l-00074h-LI for emacs-devel@gnu.org; Mon, 17 Feb 2014 19:35:51 +0100 Original-Received: from ip-90-186-6-41.web.vodafone.de ([90.186.6.41]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 17 Feb 2014 19:35:51 +0100 Original-Received: from michael_heerdegen by ip-90-186-6-41.web.vodafone.de with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Mon, 17 Feb 2014 19:35:51 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 46 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: ip-90-186-6-41.web.vodafone.de User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) Cancel-Lock: sha1:qiAzTzgMh29CVIOKlV8dmEUJUdQ= X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:169710 Archived-At: Hello, I'm working on a library that adds a function to `after-change-functions'. After some time, the thing stops working. I look at the value of `after-change-functions' and my added function is missing. So I thought there would have been some error that caused `after-change-functions' to be reset. But I can preclude that - there is no error, no error message, etc. I had a hard time to find some recipe for emacs -Q. Here it comes: --8<---------------cut here---------------start------------->8--- (progn (defun foo (&rest _) ()) (add-hook 'after-change-functions 'foo) (defun complain () (when (not (memq 'foo (default-value 'after-change-functions))) (message "Why does this happen?") (cancel-timer complain-timer))) (defvar complain-timer (run-with-idle-timer .03 .03 #'complain)) (require 'cl-lib) (completing-read "Hit tab and C-g: " (cl-loop for i from 1 to 100000 collect (format "%d" i)))) --8<---------------cut here---------------end--------------->8--- Evaluate it and hit tab (for completion) and C-g C-g in succession. When you repeat this a few times, you get "Why does this happen?". Is this expected behavior? In my original situation, quitting was not involved, the above recipe was just the first reproducible program I had discovered. Thanks, Michael.