all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Problem with eldoc and Python
@ 2016-07-03 22:09 Fabrice Popineau
  2016-07-06 20:41 ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Popineau @ 2016-07-03 22:09 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 874 bytes --]

Hi,

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

Regards,

Fabrice

[-- Attachment #2: Type: text/html, Size: 1252 bytes --]

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

* Re: Problem with eldoc and Python
  2016-07-03 22:09 Problem with eldoc and Python Fabrice Popineau
@ 2016-07-06 20:41 ` Nicolas Goaziou
  2016-07-06 21:04   ` Fabrice Popineau
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2016-07-06 20:41 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: emacs-orgmode@gnu.org

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 "
> (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?

Regards,

-- 
Nicolas Goaziou

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

* Re: Problem with eldoc and Python
  2016-07-06 20:41 ` Nicolas Goaziou
@ 2016-07-06 21:04   ` Fabrice Popineau
  2016-07-06 21:27     ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Popineau @ 2016-07-06 21:04 UTC (permalink / raw)
  To: Fabrice Popineau, emacs-orgmode@gnu.org

[-- Attachment #1: Type: text/plain, Size: 2405 bytes --]

2016-07-06 22:41 GMT+02:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:

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

[-- Attachment #2: Type: text/html, Size: 3696 bytes --]

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

* Re: Problem with eldoc and Python
  2016-07-06 21:04   ` Fabrice Popineau
@ 2016-07-06 21:27     ` Nicolas Goaziou
  2016-07-07  9:33       ` Fabrice Popineau
  0 siblings, 1 reply; 6+ messages in thread
From: Nicolas Goaziou @ 2016-07-06 21:27 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: emacs-orgmode@gnu.org

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

> 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))))))))

Wouldn't

  (when (functionp doc-fun) (funcall doc-fun))

be enough?

Also, would you provide a patch for this?

Thank you.

Regards,

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

* Re: Problem with eldoc and Python
  2016-07-06 21:27     ` Nicolas Goaziou
@ 2016-07-07  9:33       ` Fabrice Popineau
  2016-07-07 10:21         ` Nicolas Goaziou
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Popineau @ 2016-07-07  9:33 UTC (permalink / raw)
  To: Fabrice Popineau, emacs-orgmode@gnu.org


[-- Attachment #1.1: Type: text/plain, Size: 1135 bytes --]

Here a 2 very small patches for contrib/lisp/org-eldoc.el

Regards,

Fabrice



2016-07-06 23:27 GMT+02:00 Nicolas Goaziou <mail@nicolasgoaziou.fr>:

> Fabrice Popineau <fabrice.popineau@gmail.com> writes:
>
> > 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))))))))
>
> Wouldn't
>
>   (when (functionp doc-fun) (funcall doc-fun))
>
> be enough?
>
> Also, would you provide a patch for this?
>
> Thank you.
>
> Regards,
>

[-- Attachment #1.2: Type: text/html, Size: 1789 bytes --]

[-- Attachment #2: 0001-The-doc-fun-object-may-be-a-function-object-and-not-.patch --]
[-- Type: application/octet-stream, Size: 986 bytes --]

From 23a20e70d81495bdea93f902d1d674c1f365aab3 Mon Sep 17 00:00:00 2001
From: Fabrice Popineau <fabrice.popineau@gmail.com>
Date: Thu, 7 Jul 2016 11:26:50 +0200
Subject: [PATCH] The doc-fun object may be a function object and not a symbol.

---
 contrib/lisp/org-eldoc.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/lisp/org-eldoc.el b/contrib/lisp/org-eldoc.el
index ea12037..046918d 100644
--- a/contrib/lisp/org-eldoc.el
+++ b/contrib/lisp/org-eldoc.el
@@ -155,7 +155,7 @@
              (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 (functionp doc-fun) (funcall doc-fun))))))))
 
 ;;;###autoload
 (defun org-eldoc-load ()
-- 
2.9.0

base-commit: f55f7a1ccba127dfe9983eb9a4d1eea584f3ffd7

[-- Attachment #3: 0001-When-inserting-a-new-src-block-the-language-may-not-.patch --]
[-- Type: application/octet-stream, Size: 989 bytes --]

From f55f7a1ccba127dfe9983eb9a4d1eea584f3ffd7 Mon Sep 17 00:00:00 2001
From: Fabrice Popineau <fabrice.popineau@gmail.com>
Date: Thu, 7 Jul 2016 11:25:12 +0200
Subject: [PATCH] When inserting a new src block, the language may not yet be
 chosen when this is called.

---
 contrib/lisp/org-eldoc.el | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/lisp/org-eldoc.el b/contrib/lisp/org-eldoc.el
index 3b112a6..ea12037 100644
--- a/contrib/lisp/org-eldoc.el
+++ b/contrib/lisp/org-eldoc.el
@@ -74,7 +74,7 @@
       (save-match-data
         (when (looking-at "^[ \t]*#\\+\\(begin\\|end\\)_src")
           (setq info (org-babel-get-src-block-info 'light)
-                lang (propertize (nth 0 info) 'face 'font-lock-string-face)
+                lang (propertize (or (nth 0 info) "no lang") 'face 'font-lock-string-face)
                 hdr-args (nth 2 info))
           (concat
            lang
-- 
2.9.0

base-commit: 286b53e9d5dc7c3f6989715ef48814bdfaff6d04

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

* Re: Problem with eldoc and Python
  2016-07-07  9:33       ` Fabrice Popineau
@ 2016-07-07 10:21         ` Nicolas Goaziou
  0 siblings, 0 replies; 6+ messages in thread
From: Nicolas Goaziou @ 2016-07-07 10:21 UTC (permalink / raw)
  To: Fabrice Popineau; +Cc: emacs-orgmode@gnu.org

Hello,

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

> Here a 2 very small patches for contrib/lisp/org-eldoc.el

Applied, with changes to commit messages. Thank you.

Regards,

-- 
Nicolas Goaziou

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

end of thread, other threads:[~2016-07-07 10:22 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-07-03 22:09 Problem with eldoc and Python Fabrice Popineau
2016-07-06 20:41 ` Nicolas Goaziou
2016-07-06 21:04   ` Fabrice Popineau
2016-07-06 21:27     ` Nicolas Goaziou
2016-07-07  9:33       ` Fabrice Popineau
2016-07-07 10:21         ` Nicolas Goaziou

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.