From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: "D. Goel" Newsgroups: gmane.emacs.devel Subject: Re: defvar vs setqif.. Date: 20 May 2002 15:08:00 -0400 Sender: emacs-devel-admin@gnu.org Message-ID: References: <1021841986.24318.2803.camel@space-ghost> NNTP-Posting-Host: localhost.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1021921744 14875 127.0.0.1 (20 May 2002 19:09:04 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 20 May 2002 19:09:04 +0000 (UTC) Cc: emacs-devel@gnu.org Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.33 #1 (Debian)) id 179sWm-0003ro-00 for ; Mon, 20 May 2002 21:09:04 +0200 Original-Received: from fencepost.gnu.org ([199.232.76.164]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 179skq-0006Ve-00 for ; Mon, 20 May 2002 21:23:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=fencepost.gnu.org) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 179sX3-0002Q4-00; Mon, 20 May 2002 15:09:21 -0400 Original-Received: from ipr-mail.umd.edu ([128.8.86.132]) by fencepost.gnu.org with esmtp (Exim 3.34 #1 (Debian)) id 179sVn-00029p-00 for ; Mon, 20 May 2002 15:08:03 -0400 Original-Received: from poynting.umd.edu (root@poynting.umd.edu [128.8.86.100]) by ipr-mail.umd.edu (8.9.3/8.9.3) with ESMTP id PAA02236; Mon, 20 May 2002 15:08:01 -0400 (EDT) Original-Received: from poynting.umd.edu (sendmail@localhost [127.0.0.1]) by poynting.umd.edu (8.9.3/8.9.3) with SMTP id PAA12173; Mon, 20 May 2002 15:08:01 -0400 (EDT) Original-Received: (from deego@localhost) by poynting.umd.edu (8.9.3/8.9.3) id PAA06241; Mon, 20 May 2002 15:08:01 -0400 (EDT) X-Authentication-Warning: poynting.umd.edu: deego set sender to deego@glue.umd.edu using -f Original-To: Colin Walters In-Reply-To: <1021841986.24318.2803.camel@space-ghost> Original-Lines: 36 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Errors-To: emacs-devel-admin@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.0.9 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: Emacs development discussions. List-Unsubscribe: , List-Archive: Xref: main.gmane.org gmane.emacs.devel:4197 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:4197 > On Sun, 2002-05-19 at 16:44, D. Goel wrote: > > > An example: my .emacs needs to, say, (add-hook 'foo-mode-hook... ), > > but the hook may not be defined, so i (defvar foo-mode-hook) before > > this statement. > > Why do you defvar it? The best solution is to (require 'foo-mode) > before adding the hook. true i guess, but not always carried out... that's why the issue arises in the first place.. One reason it is not always carried out is: say a user wants to frob a thousand variables in their .emacs or their own private library... they don't want to (require) all the involved libraries, thus slowing down the loading of emacs.. so the user simply make sures the variables are defined via defvar, and then runs (add-to-list) or whatever on these variables.. authors who may do similar stuff in their libraries may have the same reason---not wanting to slow down the loading by (requiring 'stuff). So they may defvar variables of that libaray... > But `add-hook' won't lose if the hook isn't bound yet. yeah very true.. bad example, sorry :).. how about (add-to-list) ? :) D --