emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Can the byte-compiler check whether functions passed by name are def


From: Stefan Monnier
Subject: Re: Can the byte-compiler check whether functions passed by name are defined?
Date: Wed, 07 Aug 2013 21:25:45 -0400
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (gnu/linux)

> (defun foo (&rest args) t)
> (defun foo2 () (mapcar #'foo '(1 2 3)))
[...]
> foo.el:6:1:Warning: the function `foo' is not known to be defined.

> (defun foo () #'assoc-ignore-case)
[...]
> foo.el:1:8:Warning: `function' is an obsolete variable.

The patch below should fix them, indeed, thanks.


        Stefan


=== modified file 'lisp/emacs-lisp/bytecomp.el'
--- lisp/emacs-lisp/bytecomp.el 2013-08-07 17:33:30 +0000
+++ lisp/emacs-lisp/bytecomp.el 2013-08-08 01:23:52 +0000
@@ -3574,12 +3574,12 @@
     (when (and (symbolp f)
                (byte-compile-warning-enabled-p 'callargs))
       (when (get f 'byte-obsolete-info)
-        (byte-compile-warn-obsolete (car form)))
+        (byte-compile-warn-obsolete f))
 
       ;; Check to see if the function will be available at runtime
       ;; and/or remember its arity if it's unknown.
       (or (and (or (fboundp f)          ; Might be a subr or autoload.
-                   (byte-compile-fdefinition (car form) nil))
+                   (byte-compile-fdefinition f nil))
                (not (memq f byte-compile-noruntime-functions)))
           (eq f byte-compile-current-form) ; ## This doesn't work
                                            ; with recursion.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]