unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Raffaele Ricciardi <rfflrccrd@gmail.com>
To: help-gnu-emacs@gnu.org
Subject: Re: How to delay loading of packages (when eval-after-load does notapply)?
Date: Fri, 17 Aug 2012 11:31:44 +0100	[thread overview]
Message-ID: <a96kslF1aeU1@mid.individual.net> (raw)
In-Reply-To: <80pq6pygox.fsf@somewhere.org>

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 ;-)



  reply	other threads:[~2012-08-17 10:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-15 19:22 How to delay loading of packages (when eval-after-load does not apply)? Sebastien Vauban
2012-08-15 19:43 ` How to delay loading of packages (when eval-after-load does notapply)? Drew Adams
     [not found] ` <mailman.7059.1345059803.855.help-gnu-emacs@gnu.org>
2012-08-17 10:07   ` Sebastien Vauban
2012-08-17 10:31     ` Raffaele Ricciardi [this message]
2012-08-17 12:11       ` Sebastien Vauban
2012-08-17 12:20         ` Raffaele Ricciardi
2012-08-17 18:33           ` Sebastien Vauban
2012-08-20 12:40             ` Sebastien Vauban
2012-08-20 13:39               ` Raffaele Ricciardi
2012-08-20 15:24                 ` Sebastien Vauban

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=a96kslF1aeU1@mid.individual.net \
    --to=rfflrccrd@gmail.com \
    --cc=help-gnu-emacs@gnu.org \
    /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).