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:37:54 -0500 Organization: I need to put my ORGANIZATION here. Message-ID: <87lk8zgxrx.fsf@W0053328.mgh.harvard.edu> References: <878x4zfkwv.fsf@supermath.math.umn> <87y7czgy3r.fsf@W0053328.mgh.harvard.edu> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1195152152 10103 80.91.229.12 (15 Nov 2007 18:42:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 15 Nov 2007 18:42:32 +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:37 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 1IsjfX-0005ZN-FD for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Nov 2007 19:42:27 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IsjfK-0007CX-HO for geh-help-gnu-emacs@m.gmane.org; Thu, 15 Nov 2007 13:42:14 -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: 33 Original-NNTP-Posting-Host: w0053328.mgh.harvard.edu Original-X-Trace: plato.harvard.edu 1195151874 11194 132.183.29.121 (15 Nov 2007 18:37:54 GMT) Original-X-Complaints-To: news@plato.harvard.edu Original-NNTP-Posting-Date: Thu, 15 Nov 2007 18:37:54 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) Cancel-Lock: sha1:Vd8W8ALdEgF3wBvnj9RG1L2ezxE= Original-Xref: shelby.stanford.edu gnu.emacs.help:153841 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:49272 Archived-At: jadamson@partners.org (Joel J. Adamson) writes: > 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. Sorry, that isn't clear: you may need to specify the buffer with (current-buffer) or otherwise make sure you are dealing with the current buffer, and to ensure that your function does not affect other buffers. Joel -- Joel J. Adamson Biostatistician Pediatric Psychopharmacology Research Unit Massachusetts General Hospital Boston, MA 02114 (617) 643-1432 (303) 880-3109