all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* `special-form-p' again
@ 2006-11-01 20:49 Stuart D. Herring
  2006-11-02 21:46 ` Richard Stallman
  0 siblings, 1 reply; 3+ messages in thread
From: Stuart D. Herring @ 2006-11-01 20:49 UTC (permalink / raw)


I have one other old patch I submitted that got little attention (though I
know not whether due to papers problems) and which I'd like reconsidered:
a function to determine whether a function is a special form so that such
things as advice.el wouldn't need to maintain a list.  It's not a new
feature at all and is arguably a bugfix since it prevents lossage if the
list is out of date.  The original message is at
http://lists.gnu.org/archive/html/emacs-devel/2005-07/msg00897.html; as
with my other recent re-post, the old patch is slightly odd, and may be
sufficiently odd and/or old as to break.  If so, I can probably make
another one (with the better source setup I have now).

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: `special-form-p' again
  2006-11-01 20:49 `special-form-p' again Stuart D. Herring
@ 2006-11-02 21:46 ` Richard Stallman
  2006-11-03  0:03   ` Stefan Monnier
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Stallman @ 2006-11-02 21:46 UTC (permalink / raw)
  Cc: emacs-devel

There is no need to do this now, and maybe never.  Addition of new
special forms is very very rare.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: `special-form-p' again
  2006-11-02 21:46 ` Richard Stallman
@ 2006-11-03  0:03   ` Stefan Monnier
  0 siblings, 0 replies; 3+ messages in thread
From: Stefan Monnier @ 2006-11-03  0:03 UTC (permalink / raw)
  Cc: emacs-devel

> 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."

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-11-03  0:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-01 20:49 `special-form-p' again Stuart D. Herring
2006-11-02 21:46 ` Richard Stallman
2006-11-03  0:03   ` Stefan Monnier

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.