From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Jambunathan K Newsgroups: gmane.emacs.help Subject: Re: around advice: why does (and ad-do-it nil) return t? Date: Mon, 13 Feb 2012 18:33:18 +0530 Message-ID: <81zkcm6g2x.fsf@gmail.com> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1329138236 23616 80.91.229.3 (13 Feb 2012 13:03:56 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 13 Feb 2012 13:03:56 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Leo Alekseyev Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Feb 13 14:03:53 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1RwvZO-0008Pi-Ja for geh-help-gnu-emacs@m.gmane.org; Mon, 13 Feb 2012 14:03:50 +0100 Original-Received: from localhost ([::1]:57436 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwvZN-0001KL-7s for geh-help-gnu-emacs@m.gmane.org; Mon, 13 Feb 2012 08:03:49 -0500 Original-Received: from eggs.gnu.org ([140.186.70.92]:57049) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwvZE-0001K1-5z for help-gnu-emacs@gnu.org; Mon, 13 Feb 2012 08:03:45 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RwvZ7-0007yy-Pr for help-gnu-emacs@gnu.org; Mon, 13 Feb 2012 08:03:40 -0500 Original-Received: from mail-pw0-f41.google.com ([209.85.160.41]:46355) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RwvZ7-0007yg-Jn for help-gnu-emacs@gnu.org; Mon, 13 Feb 2012 08:03:33 -0500 Original-Received: by pbcwz17 with SMTP id wz17so4807927pbc.0 for ; Mon, 13 Feb 2012 05:03:32 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=7WL2IQ/srwZlw1TCojC7RKzTu31H/LI1JKlQhWLQd4c=; b=JeG5M6lKNNalBMDRlzjkYrFvsj/70WHR8VfV4Rt2yw9/pRu6OvJ4pnOL61ABVWEQsN Xmzq3sYa8zN8XLeq3kBiXg4Jn2z0DZjqK9BkjbXwsIprEdp7B0xsKD59o6pfbbJiA5Z3 +FZwzAyNes6jNmjV9SoY2NYYt6ui3chl9sq/0= Original-Received: by 10.68.225.4 with SMTP id rg4mr47150531pbc.111.1329138212616; Mon, 13 Feb 2012 05:03:32 -0800 (PST) Original-Received: from JAMBU-NETBOOK ([101.63.214.178]) by mx.google.com with ESMTPS id q8sm39729934pbi.1.2012.02.13.05.03.28 (version=TLSv1/SSLv3 cipher=OTHER); Mon, 13 Feb 2012 05:03:31 -0800 (PST) In-Reply-To: (Leo Alekseyev's message of "Mon, 13 Feb 2012 07:43:42 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.93 (windows-nt) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.160.41 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:83733 Archived-At: Leo Alekseyev writes: > Consider the following code: > > (defun foobar () t) > (defadvice foobar (around foobar-advice activate) > (and ad-do-it nil)) > > Evaluating the advised foobar seems to return t. Why? Naively, one > expects (and [whatever] nil) to evaluate to nil! One possible reason could be this: (info "(elisp) Around-Advice") ,---- | -- Variable: ad-do-it | This is not really a variable, rather a place-holder that looks | like a variable. You use it in around-advice to specify the place | to run the function's original definition and other "earlier" | around-advice. `---- May be you are looking for ad-return-value. (info "(elisp) Defining Advice") ,---- | -- Variable: ad-return-value | While advice is executing, after the function's original | definition has been executed, this variable holds its return | value, which will ultimately be returned to the caller after | finishing all the advice. After-advice and around-advice can | arrange to return some other value by storing it in this variable. `---- --