From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: jadamson@partners.org (Joel J. Adamson) Newsgroups: gmane.emacs.help Subject: Re: how to use "if" in lisp Date: Thu, 15 Nov 2007 13:30:48 -0500 Organization: I need to put my ORGANIZATION here. Message-ID: <87y7czgy3r.fsf@W0053328.mgh.harvard.edu> References: <878x4zfkwv.fsf@supermath.math.umn> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1195152116 9956 80.91.229.12 (15 Nov 2007 18:41:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 15 Nov 2007 18:41:56 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Nov 15 19:42:01 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Isjey-0005L5-8t for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Nov 2007 19:41:52 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Isjel-0006sN-DX for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Nov 2007 13:41:39 -0500 Original-Path: shelby.stanford.edu!newsfeed.stanford.edu!postnews.google.com!news1.google.com!news.glorb.com!newspeer1.asbnva01.us.to.verio.net!news.harvard.edu!not-for-mail Original-Newsgroups: gnu.emacs.help Original-Lines: 32 Original-NNTP-Posting-Host: w0053328.mgh.harvard.edu Original-X-Trace: plato.harvard.edu 1195151448 11194 132.183.29.121 (15 Nov 2007 18:30:48 GMT) Original-X-Complaints-To: news@plato.harvard.edu Original-NNTP-Posting-Date: Thu, 15 Nov 2007 18:30:48 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:pIeBvPPPzNPrfnZTC2mMtrIX/hs= Original-Xref: shelby.stanford.edu gnu.emacs.help:153840 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:49271 Archived-At: Teng Wang writes: > Hi there, > > I just began to learn lisp a couple of weeks ago. It is easy to use, > but sometimes it is really hard to know what variables are in > lisp. And today I want to write a code doing the function as below: > > (if (_the major mode is something_) > (some function) > (another funcion)) > > But I don't know how to write down the condition. Since major-mode is local to a buffer, your function should be local to the buffer. (symbol-value 'major-mode) gets the major mode, but there may be a simpler way (i.e. a function specifically for that). Read up on symbols and plists. Joel -- Joel J. Adamson Biostatistician Pediatric Psychopharmacology Research Unit Massachusetts General Hospital Boston, MA 02114 (617) 643-1432 (303) 880-3109