unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
From: Tim X <timx@nospam.dev.null>
Subject: Re: Checking whether a list contains a particular element
Date: Mon, 17 Jul 2006 17:57:14 +1000	[thread overview]
Message-ID: <87y7usr7dx.fsf@tiger.rapttech.com.au> (raw)
In-Reply-To: mailman.4145.1153076026.9609.help-gnu-emacs@gnu.org

Peter Dyballa <Peter_Dyballa@Web.DE> 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

  parent reply	other threads:[~2006-07-17  7:57 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.4145.1153076026.9609.help-gnu-emacs@gnu.org>
2006-07-16 19:22 ` Checking whether a list contains a particular element Barry Margolin
2006-07-17  9:17   ` Peter Dyballa
     [not found]   ` <mailman.4170.1153127856.9609.help-gnu-emacs@gnu.org>
2006-07-17  9:22     ` David Kastrup
2006-07-16 20:19 ` B. T. Raven
2006-07-17  7:57 ` Tim X [this message]
2006-07-16 18:53 Peter Dyballa

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=87y7usr7dx.fsf@tiger.rapttech.com.au \
    --to=timx@nospam.dev.null \
    /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).