all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Elisp question: when 'require' needed?
@ 2011-01-14  9:41 Oleksandr Gavenko
  2011-01-14  9:48 ` Oleksandr Gavenko
  2011-01-14  9:57 ` Oleksandr Gavenko
  0 siblings, 2 replies; 3+ messages in thread
From: Oleksandr Gavenko @ 2011-01-14  9:41 UTC (permalink / raw)
  To: help-gnu-emacs

I wont update in .emacs 'grep-find-ignored-directories':

(add-to-list grep-find-ignored-directories "build")
(add-to-list grep-find-ignored-directories "dist")
(add-to-list grep-find-ignored-directories "lib")

It defined in grep.el as:

(defcustom grep-find-ignored-directories
   vc-directory-exclusion-list ...)

If I dont put

   (require 'grep)

before add-to-list I get

  Symbol's value as variable is void: grep-find-ignored-directories

But adding a lot of 'require' slow down start up time.

To resolve this I can use:

(add-hook grep-setup-hook (lambda nil
     (add-to-list grep-find-ignored-directories "build")
     (add-to-list grep-find-ignored-directories "dist")
  ))

What usual pattern for common case?
Put 'require' or 'add-hook'.

With 'require' code look more linear but load time increased.
With 'add-hook' code become some messy.

Is there standard for setup-hook name?
Is there requirement  put to *.el file such hook?

Who invoke setup-hook?

Is it called automatically?

Is there requirement invoke it only once?


Also 'grep-setup-hook' declared as ###autoload.
So if I wrote '(add-hook grep-setup-hook ...)' Emacs read grep.el,
so it is more simply use '(require 'grep)'?




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-01-14  9:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-01-14  9:41 Elisp question: when 'require' needed? Oleksandr Gavenko
2011-01-14  9:48 ` Oleksandr Gavenko
2011-01-14  9:57 ` Oleksandr Gavenko

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.