[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to avoid loading file when just testing if function is bound?
From: |
Michael Albinus |
Subject: |
Re: How to avoid loading file when just testing if function is bound? |
Date: |
Mon, 02 Apr 2012 14:10:27 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) |
"Sebastien Vauban"
<wxhgmqzgwmuf-geNee64TY+gS+FvcfC7Uqw@public.gmane.org> writes:
> Hi,
Hi,
> For the purpose of asking whether I eventually need to clock out (from Org)
> before exiting Emacs, I've written this chunk of code:
>
> --8<---------------cut here---------------start------------->8---
> (if (and (fboundp 'org-clocking-p)
> (org-clocking-p)
> (y-or-n-p "You are currently clocking time, clock out? "))
> (org-clock-out)
> t))
> --8<---------------cut here---------------end--------------->8---
>
> The problem is that if Org is not yet loaded, the above code does load it
> (because `org-clocking-p' is autoloaded) -- and that takes a while... and I
> just wanted to exit Emacs...
>
> How to avoid this?
You could check whether `org-clocking-p' has still the 'autoload
property. It is a list then. Something like this (untested):
(if (and (fboundp 'org-clocking-p)
(not (listp (symbol-function 'org-clocking-p)))
(org-clocking-p))
...
> Best regards,
> Seb
Best regards, Michael.
Re: How to avoid loading file when just testing if function is bound?,
Michael Albinus <=
Message not available