From mboxrd@z Thu Jan 1 00:00:00 1970 From: Fabrice Popineau Subject: Re: Problem with eldoc and Python Date: Wed, 6 Jul 2016 23:04:11 +0200 Message-ID: References: <8760sih53f.fsf@saiph.selenimh> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a1137d94466dbec0536fdea60 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:45884) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKtzl-0004im-1X for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 17:04:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bKtzj-0004js-Oh for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 17:04:33 -0400 Received: from mail-oi0-x236.google.com ([2607:f8b0:4003:c06::236]:34847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bKtzj-0004jY-IZ for emacs-orgmode@gnu.org; Wed, 06 Jul 2016 17:04:31 -0400 Received: by mail-oi0-x236.google.com with SMTP id r2so288083451oih.2 for ; Wed, 06 Jul 2016 14:04:31 -0700 (PDT) In-Reply-To: <8760sih53f.fsf@saiph.selenimh> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: Fabrice Popineau , "emacs-orgmode@gnu.org" --001a1137d94466dbec0536fdea60 Content-Type: text/plain; charset=UTF-8 2016-07-06 22:41 GMT+02:00 Nicolas Goaziou : > Hello, > > Fabrice Popineau writes: > > > Am I alone to see this recently: > > > > insert an src python block with > moving inside the src block > > and then some timer function breaking with: > > > > Debugger entered--Lisp error: (wrong-type-argument symbolp #[128 > "\300\301 > > \"\206 ... [eldoc-documentation-function apply default-value] 4 " > > (fn &rest ARGS)"] nil] 4 nil]) > > fboundp(#[128 "\300\301...[apply python-eldoc-function #[128 > > "\301\302\300!^B\"\207" [eldoc-documentation-function apply > default-value] > > 4 "\n\n(fn &rest ARGS)"] nil] 4 nil]) > > org-eldoc-documentation-function() > > eldoc-print-current-symbol-info() > > ... > > timer-event-handler([t 0 0 500000 nil #[0 "... [eldoc-mode > > global-eldoc-mode eldoc-documentation-function (nil ignore) > > eldoc-print-current-symbol-info] 2] nil idle 0]) > > > > This is with the latest emacs-25 "soon to be released" and the latest Org > > mode. > > > > Any help appreciated. > > Could you send a backtrace with non byte-compiled code? > > Hi Nicolas, The problem is that the byte code comes from Python mode. I solved the problem with this: $ diff -uw contrib/lisp/org-eldoc.el contrib/lisp/org-eldoc.el --- contrib/lisp/org-eldoc.el 2016-02-29 11:13:22.330099500 +0100 +++ contrib/lisp/org-eldoc.el 2016-07-04 07:11:10.466144400 +0200 @@ -155,7 +155,8 @@ (string= lang "golang")) (when (require 'go-eldoc nil t) (go-eldoc--documentation-function))) (t (let ((doc-fun (org-eldoc-get-mode-local-documentation-function lang))) - (when (fboundp doc-fun) (funcall doc-fun)))))))) + (when (or (and (symbolp doc-fun) (fboundp doc-fun)) + (functionp doc-fun)) (funcall doc-fun)))))))) ;;;###autoload (defun org-eldoc-load () In python.el, one can find this around line 5129: (if (null eldoc-documentation-function) ;; Emacs<25 (set (make-local-variable 'eldoc-documentation-function) #'python-eldoc-function) (add-function :before-until (local 'eldoc-documentation-function) #'python-eldoc-function)) which stores byte code in eldoc-documentation-function, which makes fboundp fail because the object is not a symbol. However it is a function. Regards, Fabrice --001a1137d94466dbec0536fdea60 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


2016-07-06 22:41 GMT+02:00 Nicolas Goaziou <mail@nicolasgoaziou.f= r>:
Hello,

Fabrice Popineau <fabrice.= popineau@gmail.com> writes:

> Am I alone to see this recently:
>
> insert an src python block with <s Tab python
> moving inside the src block
> and then some timer function breaking with:
>
> Debugger entered--Lisp error: (wrong-type-argument symbolp #[128 "= ;\300\301
> \"\206 ... [eldoc-documentation-function apply default-value] 4 &= quot;
> (fn &rest ARGS)"] nil] 4 nil])
>=C2=A0 =C2=A0fboundp(#[128 "\300\301...[apply python-eldoc-functio= n #[128
> "\301\302\300!^B\"\207" [eldoc-documentation-function a= pply default-value]
> 4 "\n\n(fn &rest ARGS)"] nil] 4 nil])
>=C2=A0 =C2=A0org-eldoc-documentation-function()
>=C2=A0 =C2=A0eldoc-print-current-symbol-info()
> ...
> timer-event-handler([t 0 0 500000 nil #[0 "... [eldoc-mode
> global-eldoc-mode eldoc-documentation-function (nil ignore)
> eldoc-print-current-symbol-info] 2] nil idle 0])
>
> This is with the latest emacs-25 "soon to be released" and t= he latest Org
> mode.
>
> Any help appreciated.

Could you send a backtrace with non byte-compiled code?


Hi Nicolas,

T= he problem is that the byte code comes from Python mode.
I solved= the problem with this:

$ diff -uw contrib/li= sp/org-eldoc.el contrib/lisp/org-eldoc.el
--- contrib/lisp/org-el= doc.el =C2=A0 2016-02-29 11:13:22.330099500 +0100
+++ contrib/lis= p/org-eldoc.el =C2=A0 2016-07-04 07:11:10.466144400 +0200
@@ -155= ,7 +155,8 @@
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0= (string=3D lang "golang")) (when (require 'go-eldoc nil t)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0(go-eldoc--documentation-function)))
=C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0 (t (let ((doc-fun (org-eldoc-get-mode-local-documentat= ion-function lang)))
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0(when (fboundp doc-fun) (funcall doc-fun))))))))
+ = =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(when (or (and (symb= olp doc-fun) (fboundp doc-fun))
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 (functionp doc-fun)) (= funcall doc-fun))))))))

=C2=A0;;;###autoload
=
=C2=A0(defun org-eldoc-load ()



In python.el, one can find this around line 5129:

=C2=A0 (if (null eldoc-documentation-function)
=C2=A0 =C2=A0 =C2=A0 ;; Emacs<25
=C2=A0 =C2=A0 =C2=A0= (set (make-local-variable 'eldoc-documentation-function)
=C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0#'python-eldoc-function)
=C2=A0 =C2=A0 (add-function :before-until (local 'eldoc-documentation= -function)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 #'python-eldoc-function))

whi= ch stores byte code in eldoc-documentation-function, which makes
= fboundp fail because the object is not a symbol. However it is a function.<= /div>

Regards,

Fabrice

--001a1137d94466dbec0536fdea60--