[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Why is `after-change-functions' reset?
From: |
Michael Heerdegen |
Subject: |
Why is `after-change-functions' reset? |
Date: |
Mon, 17 Feb 2014 19:35:31 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux) |
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.
- Why is `after-change-functions' reset?,
Michael Heerdegen <=