help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to avoid loading file when just testing if function


From: Buchs, Kevin
Subject: Re: How to avoid loading file when just testing if function
Date: Mon, 2 Apr 2012 09:24:06 -0500

Sebastien,

For the purpose you specify, how about checking what org-mode checks to
determine if there is an active clock? In the end, it simply looks for
an org-clock-marker to exist, i.e. be non-nil. (if org-clock-marker
(...)). You may be interested in the general question for any situation,
how to test whether some autoloaded function has been loaded or not.

Kevin Buchs | Senior Engineer | SPPDG | 507-538-5459 |
buchs.kevin@mayo.edu
Mayo Clinic | 200 First Street SW | Rochester, MN 55905 |
http://www.mayo.edu/sppdg 


Date: Mon, 02 Apr 2012 11:54:15 +0200
From: "Sebastien Vauban" <wxhgmqzgwmuf@spammotel.com>
To: help-gnu-emacs@gnu.org
Subject: How to avoid loading file when just testing if function is
        bound?
Message-ID: <80limempbs.fsf@somewhere.org>
Content-Type: text/plain

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?

Best regards,
  Seb

--
Sebastien Vauban



reply via email to

[Prev in Thread] Current Thread [Next in Thread]