From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: torys.anderson@gmail.com (Tory S. Anderson) Newsgroups: gmane.emacs.help Subject: Re: Possible to conditionally bind variable? Date: Thu, 11 Sep 2014 08:43:20 -0400 Message-ID: <878ulq8h07.fsf@gmail.com> References: <87lhpq8l8y.fsf@gmail.com> <87oaum5oql.fsf@geodiff-mac3.ulb.ac.be> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1410439430 21901 80.91.229.3 (11 Sep 2014 12:43:50 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 11 Sep 2014 12:43:50 +0000 (UTC) Cc: emacs list To: Nicolas Richard Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Sep 11 14:43:46 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XS3iy-0003XS-3A for geh-help-gnu-emacs@m.gmane.org; Thu, 11 Sep 2014 14:43:44 +0200 Original-Received: from localhost ([::1]:37527 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XS3ix-00066u-NM for geh-help-gnu-emacs@m.gmane.org; Thu, 11 Sep 2014 08:43:43 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:38740) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XS3ij-00066j-Hd for help-gnu-emacs@gnu.org; Thu, 11 Sep 2014 08:43:33 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XS3id-0002GO-7r for help-gnu-emacs@gnu.org; Thu, 11 Sep 2014 08:43:29 -0400 Original-Received: from mail-yk0-x236.google.com ([2607:f8b0:4002:c07::236]:46293) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XS3id-0002GB-3e for help-gnu-emacs@gnu.org; Thu, 11 Sep 2014 08:43:23 -0400 Original-Received: by mail-yk0-f182.google.com with SMTP id 131so3314238ykp.41 for ; Thu, 11 Sep 2014 05:43:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=r6AqNrGvcPZWT5JDqKEt0TMuwimbybvS2fPHhZ6G7Ck=; b=vHf3VexE/KZiIeh1ILi3UZPKywMKb543/z8QHBeoLsSrJpRUw2G3I8Frub9XJb7bCA ihk1i2Lu1lRquLYI5tV1QziC3dRi6CthjTJYsh2sRJcsE0olms3fP0xhkQAN0MH6mHZL +DBJtdK4du6APzi1OjyYk+4Kc+5OlrgDzRJ5bOIEJra5r4ZJYkCT8Jb3DD6k0ApFC8/J LtRYAZ8uycCxZZB23iQZZP7oZlQ7ghm9DSbtsCwSD24jcxgHjYxztsS6PNmd+SYCQlSW zKXAF9LXgYk7ufYWE9I9FJSEsKsd96oVbR1cn/oTQyyu9j+YwQ+rB3asLpVNkAUNYgTy E5jg== X-Received: by 10.236.30.69 with SMTP id j45mr762337yha.37.1410439402463; Thu, 11 Sep 2014 05:43:22 -0700 (PDT) Original-Received: from localhost.localdomain ([2601:0:a000:4a1:ee55:f9ff:feb5:5589]) by mx.google.com with ESMTPSA id 70sm278214yhw.38.2014.09.11.05.43.21 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 11 Sep 2014 05:43:21 -0700 (PDT) In-Reply-To: <87oaum5oql.fsf@geodiff-mac3.ulb.ac.be> (Nicolas Richard's message of "Thu, 11 Sep 2014 14:24:34 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2607:f8b0:4002:c07::236 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:99816 Archived-At: Wow! It works! So, I forgot the funcall my first time and it didn't work; it said "Symbol's function definition is void: my-switch-function". How do the funcalls fix it? I thought the first item in parens was automatically called as a function unless quoted? Lisp FTW Nicolas Richard writes: > torys.anderson@gmail.com (Tory S. Anderson) writes: >> (defun go-or-make-agenda (&optional new-frame) >> (interactive "P") >> (let ((buffer "\*Org Agenda\*") >> (some-other-buffer "*scratch*") >> (my-switch-function (if new-frame ;; is there some way to do this? >> '(switch-to-other-buffer) >> '(switch-to-buffer))) >> (if (get-buffer buffer) >> (my-switch-function buffer) >> (my-switch-function some-other-buffer))))) > > untested : > > (defun go-or-make-agenda (&optional new-frame) > (interactive "P") > (let ((buffer "\*Org Agenda\*") > (some-other-buffer "*scratch*") > (my-switch-function (if new-frame ;; is there some way to do this? > 'switch-to-buffer-other-frame > 'switch-to-buffer))) > (if (get-buffer buffer) > (funcall my-switch-function buffer) > (funcall my-switch-function some-other-buffer)))) > > HTH,