From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim X Newsgroups: gmane.emacs.help Subject: Re: Checking whether a list contains a particular element Date: Mon, 17 Jul 2006 17:57:14 +1000 Organization: Posted via Supernews, http://www.supernews.com Message-ID: <87y7usr7dx.fsf@tiger.rapttech.com.au> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1153125861 20164 80.91.229.2 (17 Jul 2006 08:44:21 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Mon, 17 Jul 2006 08:44:21 +0000 (UTC) Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 17 10:44:20 2006 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1G2OhX-0004BI-B8 for geh-help-gnu-emacs@m.gmane.org; Mon, 17 Jul 2006 10:43:39 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1G2OhV-0000nP-Pt for geh-help-gnu-emacs@m.gmane.org; Mon, 17 Jul 2006 04:43:37 -0400 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!sn-xt-sjc-02!sn-xt-sjc-01!sn-post-sjc-01!supernews.com!corp.supernews.com!not-for-mail Original-Newsgroups: gnu.emacs.help User-Agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux) Cancel-Lock: sha1:nJXhUgyo9GWESE1I1DXITf6iyEI= Original-X-Complaints-To: abuse@supernews.com Original-Lines: 35 Original-Xref: shelby.stanford.edu gnu.emacs.help:140381 Original-To: help-gnu-emacs@gnu.org X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:36005 Archived-At: Peter Dyballa writes: > Hello! > > How can I check whether load-path contains a particular path (so that > I could add it if necessary)? > > -- > Greetings > there is already a function to achieve what you want ,----[ C-h f add-to-list RET ] | add-to-list is a compiled Lisp function in `subr.el'. | (add-to-list LIST-VAR ELEMENT &optional APPEND) | | Add ELEMENT to the value of LIST-VAR if it isn't there yet. | The test for presence of ELEMENT is done with `equal'. | If ELEMENT is added, it is added at the beginning of the list, | unless the optional argument APPEND is non-nil, in which case | ELEMENT is added at the end. | | The return value is the new value of LIST-VAR. | | If you want to use `add-to-list' on a variable that is not defined | until a certain package is loaded, you should put the call to `add-to-list' | into a hook function that will be run only after loading the package. | `eval-after-load' provides one way to do this. In some cases | other hooks, such as major mode hooks, can do the job. `---- -- tcross (at) rapttech dot com dot au