Re: [O] Problem with eldoc and Python

2016-07-07 Thread Nicolas Goaziou
Hello,

Fabrice Popineau  writes:

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

Applied, with changes to commit messages. Thank you.

Regards,

-- 
Nicolas Goaziou



Re: [O] Problem with eldoc and Python

2016-07-07 Thread Fabrice Popineau
Here a 2 very small patches for contrib/lisp/org-eldoc.el

Regards,

Fabrice



2016-07-06 23:27 GMT+02:00 Nicolas Goaziou :

> Fabrice Popineau  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,
>


0001-The-doc-fun-object-may-be-a-function-object-and-not-.patch
Description: Binary data


0001-When-inserting-a-new-src-block-the-language-may-not-.patch
Description: Binary data


Re: [O] Problem with eldoc and Python

2016-07-06 Thread Nicolas Goaziou
Fabrice Popineau  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,



Re: [O] Problem with eldoc and Python

2016-07-06 Thread Fabrice Popineau
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 50 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


Re: [O] Problem with eldoc and Python

2016-07-06 Thread 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 50 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



[O] Problem with eldoc and Python

2016-07-03 Thread Fabrice Popineau
Hi,

Am I alone to see this recently:

insert an src python block with