unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: "Buchs, Kevin" <buchs.kevin@mayo.edu>
To: <help-gnu-emacs@gnu.org>, <wxhgmqzgwmuf@spammotel.com>
Subject: Re: How to avoid loading file when just testing if function
Date: Mon, 2 Apr 2012 09:24:06 -0500	[thread overview]
Message-ID: <F326B9A37B353A449FC7A09B36835F82F4E847@MACE.sppdg.ad> (raw)

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	other threads:[~2012-04-02 14:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-02 14:24 Buchs, Kevin [this message]
2012-04-02 15:00 ` How to avoid loading file when just testing if function Drew Adams

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=F326B9A37B353A449FC7A09B36835F82F4E847@MACE.sppdg.ad \
    --to=buchs.kevin@mayo.edu \
    --cc=help-gnu-emacs@gnu.org \
    --cc=wxhgmqzgwmuf@spammotel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).