From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Raffaele Ricciardi Newsgroups: gmane.emacs.help Subject: Re: How to delay loading of packages (when eval-after-load does notapply)? Date: Fri, 17 Aug 2012 11:31:44 +0100 Message-ID: References: <804no4c64n.fsf@somewhere.org> <80pq6pygox.fsf@somewhere.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1345199721 13951 80.91.229.3 (17 Aug 2012 10:35:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 17 Aug 2012 10:35:21 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Aug 17 12:35:21 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 1T2Jtf-0000sW-Hd for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Aug 2012 12:35:19 +0200 Original-Received: from localhost ([::1]:47742 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1T2Jtd-0004i8-Ts for geh-help-gnu-emacs@m.gmane.org; Fri, 17 Aug 2012 06:35:17 -0400 Original-Path: usenet.stanford.edu!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 75 Original-X-Trace: individual.net aVNxzv5qkxLOhc7ERIvPSgY237J4AbX0V46fcLL/etRY3iqxdCY6PGRlse0xrspeAg Cancel-Lock: sha1:azhGFSO5Umw3HUsQi6AbQqhzmxw= User-Agent: Mozilla/5.0 (X11; Linux i686; rv:14.0) Gecko/20120713 Thunderbird/14.0 In-Reply-To: <80pq6pygox.fsf@somewhere.org> Original-Xref: usenet.stanford.edu gnu.emacs.help:194024 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:86392 Archived-At: On 08/17/2012 11:07 AM, Sebastien Vauban wrote: > Hi Drew, > > "Drew Adams" wrote: >>> How could I say: load fuzzy when I will make a search for the >>> first time? >> >> Try `isearch-mode-hook' with `require'. > > Did you mean this? > > --8<---------------cut here---------------start------------->8--- > ;; fuzzy matching utilities (a must-have) > (add-hook 'isearch-mode-hook > #'(lambda () > (require 'fuzzy))) > > (eval-after-load "fuzzy" > (turn-on-fuzzy-isearch)) > --8<---------------cut here---------------end--------------->8--- > > I did the above, restarted Emacs and got: > > Symbol's function definition is void: turn-on-fuzzy-isearch > > I don't understand why my `eval-after-load' is executed directly... > > Am I missing something? You have to quote the form you are passing to `eval-after-load', like this: (eval-after-load "fuzzy" '(turn-on-fuzzy-isearch)) Otherwise, yes, the form is evaluated on the spot. This one bit me a couple of times as well ;-) Also, "fuzzy" means eval the following form after the library "fuzzy" has been loaded, whilst 'fuzzy means eval the following code after the feature 'fuzzy has been provided. I always go for the latter first, because then I'm able to rename a library according to its version. I would only backpedal if the library provided its feature on top of the file as some third-party libraries do - AFAIK this was a workaround for older Emacsen - and I couldn't fix that, but the latter has never happened. > > Best regards, > Seb > > PS- BTW, is there a better choice to be made between > > --8<---------------cut here---------------start------------->8--- > (add-hook 'isearch-mode-hook > #'(lambda () ... > --8<---------------cut here---------------end--------------->8--- > > and > > --8<---------------cut here---------------start------------->8--- > (add-hook 'isearch-mode-hook > (lambda () ... > --8<---------------cut here---------------end--------------->8--- > > ? > AFAIK, they mean the same thing. I always use the latter, for I think `lambda' is verbose enough already ;-)