From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: `special-form-p' again Date: Thu, 02 Nov 2006 19:03:21 -0500 Message-ID: References: <43830.128.165.123.18.1162414148.squirrel@webmail.lanl.gov> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1162512222 3087 80.91.229.2 (3 Nov 2006 00:03:42 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Fri, 3 Nov 2006 00:03:42 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Nov 03 01:03:41 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1GfmX3-0000dA-UX for ged-emacs-devel@m.gmane.org; Fri, 03 Nov 2006 01:03:38 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GfmX3-0004S8-KQ for ged-emacs-devel@m.gmane.org; Thu, 02 Nov 2006 19:03:37 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1GfmWs-0004Rf-Vp for emacs-devel@gnu.org; Thu, 02 Nov 2006 19:03:27 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1GfmWs-0004RP-Dh for emacs-devel@gnu.org; Thu, 02 Nov 2006 19:03:26 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1GfmWs-0004RK-A8 for emacs-devel@gnu.org; Thu, 02 Nov 2006 19:03:26 -0500 Original-Received: from [132.204.24.67] (helo=mercure.iro.umontreal.ca) by monty-python.gnu.org with esmtp (Exim 4.52) id 1GfmWr-0005UQ-3G; Thu, 02 Nov 2006 19:03:25 -0500 Original-Received: from hidalgo.iro.umontreal.ca (hidalgo.iro.umontreal.ca [132.204.27.50]) by mercure.iro.umontreal.ca (Postfix) with ESMTP id E00712CEB76; Thu, 2 Nov 2006 19:03:24 -0500 (EST) Original-Received: from faina.iro.umontreal.ca (faina.iro.umontreal.ca [132.204.26.177]) by hidalgo.iro.umontreal.ca (Postfix) with ESMTP id B0A463FE0; Thu, 2 Nov 2006 19:03:21 -0500 (EST) Original-Received: by faina.iro.umontreal.ca (Postfix, from userid 20848) id 967AE6CAB6; Thu, 2 Nov 2006 19:03:21 -0500 (EST) Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Thu\, 02 Nov 2006 16\:46\:55 -0500") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.90 (gnu/linux) X-DIRO-MailScanner-Information: Please contact the ISP for more information X-DIRO-MailScanner: Found to be clean X-DIRO-MailScanner-SpamCheck: n'est pas un polluriel, SpamAssassin (score=-2.82, requis 5, autolearn=not spam, ALL_TRUSTED -2.82) X-DIRO-MailScanner-From: monnier@iro.umontreal.ca X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:61646 Archived-At: > There is no need to do this now, and maybe never. Addition of new > special forms is very very rare. But then we should at least install the patch below, right? Stefan --- advice.el 10 Oct 2006 17:06:28 -0400 1.47 +++ advice.el 02 Nov 2006 19:01:44 -0500 @@ -2467,23 +2467,11 @@ "Take a macro function DEFINITION and make a lambda out of it." `(cdr ,definition)) -;; There is no way to determine whether some subr is a special form or not, -;; hence we need this list (which is probably out of date): -(defvar ad-special-forms - (let ((tem '(and catch cond condition-case defconst defmacro - defun defvar function if interactive let let* - or prog1 prog2 progn quote save-current-buffer - save-excursion save-restriction save-window-excursion - setq setq-default unwind-protect while - with-output-to-temp-buffer))) - ;; track-mouse could be void in some configurations. - (if (fboundp 'track-mouse) - (push 'track-mouse tem)) - (mapcar 'symbol-function tem))) - -(defmacro ad-special-form-p (definition) - ;;"non-nil if DEFINITION is a special form." - (list 'memq definition 'ad-special-forms)) +(defun ad-special-form-p (definition) + "Non-nil iff DEFINITION is a special form." + (if (and (symbolp definition) (fboundp definition)) + (setq definition (indirect-function definition))) + (and (subrp definition) (eq (cdr (subr-arity definition)) 'unevalled))) (defmacro ad-interactive-p (definition) ;;"non-nil if DEFINITION can be called interactively."