Handling menu :filter function failures with condition-case

Ben Wing ben at 666.com
Thu Feb 10 18:26:24 EST 2005


> I cant find a way to handle menu generation(by :filter 
> function) errors.
> 
> For example i have a command:
> 
>     (defun my-cmd ()
>       (interactive)
>       (popup-menu (list "test0"
>:filter (lambda (a)
>     			           (/ nil 0)))))
> 
> I specially added an error condition in :filter.
> 
> and here is how i tried to handle this error
> 
>     (condition-case nil
>         (call-interactively 'my-cmd)
>       (nil (message "menu failed")))
> 
> But this did not worked as i expected it to work.
> 
> The thing that i have pretty complicated :filter functions 
> for menus and they easily can fail, and i need a way to 
> handle such failures.

This is definitely not going to work because the filter functions trap
errors themselves at their borders to prevent major internal badness.  You
have to put the condition-case *inside* the filter.




More information about the XEmacs-Beta mailing list