Subject: Re: bug#16090: 24.3.50; [PATCH] error when jumping to a doc-view bookmark

From: Stefan Monnier <[email-masked]>
Date: Fri, 04 Apr 2014 11:14:34 -0400

>> For emacs-24, your patch is too intrusive, so I think a patch along
>> the lines of Andreas's might be acceptable, but it should use
>> bookmark-after-jump-hook instead of using a timer.

> Like so?

Almost:

> (defun doc-view-bookmark-jump (bmk)
>   ;; This implements the `handler' function interface for record type
>   ;; returned by `doc-view-bookmark-make-record', which see.
>   (let ((page (bookmark-prop-get bmk 'page)))
>     (add-hook 'bookmark-after-jump-hook
> 	      (lambda ()
> 		(setq bookmark-after-jump-hook
> 		      (cdr bookmark-after-jump-hook))

Don't use `setq' on hooks.  Use remove-hook.  Yes I know it's more
complicated, you'll have to use `make-symbol' and fset it with the
above lambda.  But `setq' on hooks really is much too brittle.

        Stefan