[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with post-command-idle-hook (which-func.el)
From: |
Stefan Monnier |
Subject: |
Re: Problem with post-command-idle-hook (which-func.el) |
Date: |
Tue, 20 May 2003 04:01:46 -0400 |
> This bug report will be sent to the Free Software Foundation,
> not to your local site managers!
> Please write in English if possible, because the Emacs maintainers
> usually do not have translators to read other languages for them.
>
> Your bug report will be posted to the address@hidden mailing list.
>
> Please describe exactly what actions triggered the bug
> and the precise symptoms of the bug:
>
> Ever since yesterday morning's build, I got an error upon emacs startup:
>
> Error in post-command-idle-hook: (invalid-function (macro . #[(window &rest
> body) ÃÃÃBB BBÂ [window body save-selected-window select-window
> ((quote norecord))] 4 1636684]))
That's because the new which-func.el code uses a new macro
(defined in subr.el), so you probably recompiled which-func.el
before reloading the new subr.el.
> I ran a grep on the lisp files, and the only one I use that also used
> post-command-idle-hook was which-func.el.
>
> The following patchlet switches which-func to the use of run-with-idle-timer
> (using half-second updates, which is probably responsive enough); with this
> patch the error no longer appears.
And when you recompiled after installing your patch, you had already loaded
up the new subr.el so the error disappeared.
This said, I think your patch is good, even if it doesn't have anything
to do with the "bug" you saw ;-)
One detail about the patch, tho: post-command-idle-hook uses a
customizable idle timeout of post-command-idle-delay which defaults
to 0.1s, whereas your patch fixes it to 0.5s which I find rather long.
Stefan
> --- lisp/which-func.el.~1.32.~ 2003-05-19 09:24:22.000000000 +0200
> +++ lisp/which-func.el 2003-05-20 09:40:50.000000000 +0200
> @@ -175,6 +175,8 @@ It creates the Imenu index for the buffe
> ;;;###autoload
> (defalias 'which-func-mode 'which-function-mode)
>
> +(defvar which-func-update-timer nil)
> +
> ;; This is the name people would normally expect.
> ;;;###autoload
> (define-minor-mode which-function-mode
> @@ -188,14 +190,16 @@ and off otherwise."
> (if which-function-mode
> ;;Turn it on
> (progn
> - (add-hook 'post-command-idle-hook 'which-func-update)
> + (setq which-func-update-timer
> + (run-with-idle-timer 0.5 t 'which-func-update))
> (dolist (buf (buffer-list))
> (with-current-buffer buf
> (setq which-func-mode
> (or (eq which-func-modes t)
> (member major-mode which-func-modes))))))
> ;; Turn it off
> - (remove-hook 'post-command-idle-hook 'which-func-update)
> + (cancel-timer which-func-update-timer)
> + (setq which-func-update-timer nil)
> (dolist (buf (buffer-list))
> (with-current-buffer buf (setq which-func-mode nil)))))
>
>
>
> In GNU Emacs 21.3.50.1 (i686-pc-linux-gnu)
> of 2003-05-20 on leeloo
> configured using `configure '--with-png' '--with-tiff' '--with-jpeg'
> '--with-gif' '--prefix=/opt/gcc3' '--with-x-toolkit=gtk''
>
> --
> Tim Van Holder <mailto:address@hidden>
> Anubex <http://www.anubex.com>
>
>
> _______________________________________________
> Emacs-pretest-bug mailing list
> address@hidden
> http://mail.gnu.org/mailman/listinfo/emacs-pretest-bug
>