I'm running into the error "Marker does not point anywhere" when I try to print a message both in after-change-functions and buffer-list-update-hook. Curiously if only one hook or the other is active the error does not occur, you have to have both! Precise code and steps to reproduce are below. Any advice on how to fix while keeping the message?
Tested on emacs 24.4.1 with -Q flag, on Ubuntu.
;; To reproduce:
;; 1. emacs -Q
;; 2. Have your frame display the scratch buffer, eval the code below in it
;; 3. Create a second frame (C-x,5,2)
;; 4. Have the second frame display the *Messages* buffer.
;; 5. Rapidly switch focus between the two frames
;; You should get the error: (error "Marker does not point anywhere")
;; Why? How do I prevent?
(setq-default debug-on-error t) ;; so you notice the error
(defun common-test (&optional a b c)
(message "test"))
(add-hook 'after-change-functions #'common-test)
(add-hook 'buffer-list-update-hook #'common-test)
Also here is an example backtrace:
Debugger entered--Lisp error: (error "Marker does not point anywhere")
message("test")
common-test()
run-hooks(buffer-list-update-hook)
handle-switch-frame((switch-frame #<frame *Backtrace* 0x1218168>))
call-interactively(handle-switch-frame nil nil)
command-execute(handle-switch-frame)