From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Juanma Barranquero Newsgroups: gmane.emacs.devel Subject: Re: Sweeter Emacs Lisp Date: Sun, 14 Jul 2013 19:18:09 +0200 Message-ID: References: <8738rh6ftk.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: ger.gmane.org 1373822335 12424 80.91.229.3 (14 Jul 2013 17:18:55 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 14 Jul 2013 17:18:55 +0000 (UTC) Cc: fgallina@gnu.org, emacs-devel To: Josh Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Jul 14 19:18:56 2013 Return-path: Envelope-to: ged-emacs-devel@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 1UyPwm-0008IA-Ep for ged-emacs-devel@m.gmane.org; Sun, 14 Jul 2013 19:18:56 +0200 Original-Received: from localhost ([::1]:41583 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyPwm-0000wK-1f for ged-emacs-devel@m.gmane.org; Sun, 14 Jul 2013 13:18:56 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45239) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyPwi-0000wD-Ik for emacs-devel@gnu.org; Sun, 14 Jul 2013 13:18:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UyPwh-0003ZU-QQ for emacs-devel@gnu.org; Sun, 14 Jul 2013 13:18:52 -0400 Original-Received: from mail-ea0-x236.google.com ([2a00:1450:4013:c01::236]:39682) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UyPwg-0003Z6-K2; Sun, 14 Jul 2013 13:18:50 -0400 Original-Received: by mail-ea0-f182.google.com with SMTP id d10so7328132eaj.41 for ; Sun, 14 Jul 2013 10:18:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=TFIEwqWlLqH+psYN1t7ywRO8U1c8U3xgyDA3p4JisSU=; b=RQBwMlZNcy6VUh2SkLyqXMkbFVEd+zyX3v7BGEGaMkSh1n8PQunBtHW35TLsznv3MO IWlfgdMPTXw1A+V6YRCX9Gft4icpnk62e52TLWTzrF0ZY7IiIl7qchnKV0VC3TvRBDTg 4pB8o4RDcEq17RJ+G+q1Zt7ZT7rbFbrdC69kzgFKqYkOtdmTCA/Sh3k/S7QR62XIUkWH 3sWkE/kATCYnkEDjPNVf9zWdFE6ZbL+h3EKRZdqusDTiyGjpudd4ZlYkWC784i+qjoX6 nuvIpUHUEia9DR5tsShiB2XKJxFkElRY/Yt8iicU7cEftevqFeASSBufN1VKSFu/C9Er VK3A== X-Received: by 10.14.213.135 with SMTP id a7mr54611225eep.152.1373822329824; Sun, 14 Jul 2013 10:18:49 -0700 (PDT) Original-Received: by 10.14.142.4 with HTTP; Sun, 14 Jul 2013 10:18:09 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:4013:c01::236 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:161879 Archived-At: On Sun, Jul 14, 2013 at 7:14 PM, Josh wrote: > but that canonical versions of such generally useful > functionality should be incorporated into the core where people could > find and use them. Certainly. aif/awhen/when-let/if-let is so useful that it surely has been reimplemented a billion times. I have this in my .emacs (cl-defmacro whereas ((var test) &rest body) "If TEST is non-nil, bind VAR to it and then run BODY. Return the value returned by the last form in BODY. Else, return nil. \n(fn (VAR TEST) &rest BODY)" (declare (indent 1) (debug ((sexp form) body))) `(let ((,var ,test)) (when ,var ,@body))) (I don't know where the "whereas" name originated, but I know I copied it from somewhere.)