Malabarba / names

A Namespace implementation for Emacs-Lisp
250 stars 19 forks source link

ad-handle-definition: `find-function-search-for-symbol' got redefined #10

Closed syl20bnr closed 9 years ago

syl20bnr commented 9 years ago

In spacemacs which tries to lazy load everything I have this:

ad-handle-definition: `find-function-search-for-symbol' got redefined

May be related with aggressive-indent since it is AFAIK the only package in spacemacs that uses names.

I can switch off the warning with ad-redifinition-action but if I can resolve the warning instead of masking it, it would be better. I wonder if the warning is useful though because when I describe find-function-search-for-symbol Emacs lists the advice correctly:

ad-Advice-find-function-search-for-symbol is a compiled Lisp function.

(ad-Advice-find-function-search-for-symbol AD--ADDOIT-FUNCTION SYMBOL
TYPE LIBRARY)

Around-advice `names-around-find-function-search-for-symbol-advice':
Make sure `find-function-search-for-symbol' understands namespaces.

[back]

What's your thoughts about that ?

Malabarba commented 9 years ago

I've noticed this warning before in other situations. From what I understand, something in your setup is redefining the find-function-search-for-symbol function (which names advises). I think Emacs warns you about this redefinition because it could potentially cause the previous advice to not work properly (which, fortunately, doesn't seem to be the case here).

I'll try to find out whether it's anything to worry about, but I don't think it is. Could you try to find out whether this function is being redefined by any other packages?

stig commented 9 years ago

I too am seeing this warning, and it's causing a bit of (perceived?) lag upon first opening emacs.

As far as I can see the only package I have that uses names is aggressive-indent:

λ ~/.emacs.d/elpa/ master ag "require 'names"
aggressive-indent-20150516.238/aggressive-indent.el
92:(eval-when-compile (require 'names))

names-20150125.552/names-dev.el
18:;;     (require 'names-dev)
39:(require 'names)

names-20150125.552/names.el
635:  (require 'names)

Nothing redefines that function either:

ag -s -Q -w find-function-search-for-symbol
auto-complete-20150408.1132/auto-complete.el
1973:                                (find-function-search-for-symbol symbol nil

names-20150125.552/names-autoloads.el
73:(defadvice find-function-search-for-symbol (around names-around-find-function-search-for-symbol-advice (symbol type library) activate) "\ Make sure `find-function-search-for-symbol' understands namespaces." ad-do-it (ignore-errors (unless (cdr ad-return-value) (with-current-buffer (car ad-return-value) (search-f [:blank:]") (let* ((names--regexp (concat "\\`" (regexp-quote (symbol-name (read (current-buffer)))))) (short-symbol (let ((name (symbol-name symbol))) (when (string-match names--regexp name) (intern (replace-match "" nil nil name)))))) (when short-symbol (ad-set-arg 0 short-symbol) ad-do-it))))))

names-20150125.552/names.el
596:(defadvice find-function-search-for-symbol
597:    (around names-around-find-function-search-for-symbol-advice
599:  "Make sure `find-function-search-for-symbol' understands namespaces."

If I comment out that defadvice from names-autoload.el the warning goes away. (My emacs-fu is not strong enough to figure out if that means that names.el is to blame, or whether it's just hiding the symptom.)

I am using version 24.5-1 of emacs installed from here: http://emacsformacosx.com - so it's not just spaceemacs.

Malabarba commented 9 years ago

Thanks @stig, now that you brought it up again, I think I know how to fix it. In any case, I think the lag you mention is indeed just perceived.

Malabarba commented 9 years ago

Let me know if it worked! Cheers,