From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Michael Albinus Newsgroups: gmane.emacs.help Subject: Re: How to avoid loading file when just testing if function is bound? Date: Mon, 02 Apr 2012 14:10:27 +0200 Message-ID: <87lime2v2k.fsf@gmx.de> References: <80limempbs.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1333368661 16104 80.91.229.3 (2 Apr 2012 12:11:01 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 2 Apr 2012 12:11:01 +0000 (UTC) Cc: public-help-gnu-emacs-mXXj517/zsQ@plane.gmane.org To: "Sebastien Vauban" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Apr 02 14:10:59 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1SEg64-0004xx-Eg for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Apr 2012 14:10:56 +0200 Original-Received: from localhost ([::1]:53647 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEg63-0007q7-LF for geh-help-gnu-emacs@m.gmane.org; Mon, 02 Apr 2012 08:10:55 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:60847) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEg5y-0007pS-5W for help-gnu-emacs@gnu.org; Mon, 02 Apr 2012 08:10:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SEg5p-0005BS-BR for help-gnu-emacs@gnu.org; Mon, 02 Apr 2012 08:10:49 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:40616) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SEg5p-0005BF-4R for help-gnu-emacs@gnu.org; Mon, 02 Apr 2012 08:10:41 -0400 Original-Received: from public by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1SEg5l-0004jV-9S for help-gnu-emacs@gnu.org; Mon, 02 Apr 2012 14:10:37 +0200 Original-Received: from mailout-de.gmx.net ([213.165.64.23]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1SEg5e-0004eW-36 for public-help-gnu-emacs-mXXj517/zsQ@plane.gmane.org; Mon, 02 Apr 2012 14:10:30 +0200 Original-Received: (qmail invoked by alias); 02 Apr 2012 12:10:29 -0000 Original-Received: from p57BB9647.dip0.t-ipconnect.de (EHLO detlef.gmx.de) [87.187.150.71] by mail.gmx.net (mp019) with SMTP; 02 Apr 2012 14:10:29 +0200 X-Authenticated: #3708877 X-Provags-ID: V01U2FsdGVkX1/n61wtWPznd7VJZQpEXZcjRfLFsOhY5/RD2S9+vo KpRG7ZVUo0S6rh In-Reply-To: <80limempbs.fsf@somewhere.org> (Sebastien Vauban's message of "Mon, 02 Apr 2012 11:54:15 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.94 (gnu/linux) X-Y-GMX-Trusted: 0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:84247 Archived-At: "Sebastien Vauban" 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.