all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Patch: Python mode and eldoc "freeze"
@ 2006-11-03 21:11 Slawomir Nowaczyk
  2006-11-04  3:35 ` Chong Yidong
  0 siblings, 1 reply; 4+ messages in thread
From: Slawomir Nowaczyk @ 2006-11-03 21:11 UTC (permalink / raw)


Hello,

I have sent patch below in response to bug report on emacs-pretest-bug,
but I am resending it here... It changes two things, first it adds eldoc
messages for some (built-in) types like open() or property() which were
missing previously (the bug report was about them).

Second, the patch prevents eldoc from freezing emacs when it tries to
get arglist for some more exotic built-ins ("basestring" being one
example).

While the first part could be seen, arguably, as a new feature, the
other is definitely a bugfix.

Can someone please install it?

**********************************************************************

--- EmacsCVS/etc/emacs.py   2006-10-26 23:25:56.225217600 +0200
+++ Emacs/etc/emacs.py       2006-11-01 00:13:29.307024000 +0100
@@ -50,12 +50,11 @@
        if len (parts) > 1:
            exec 'import ' + parts[0] # might fail
        func = eval (name)
-       if inspect.isbuiltin (func):
+       if inspect.isbuiltin (func) or type(func) is type:
            doc = func.__doc__
            if doc.find (' ->') != -1:
                print '_emacs_out', doc.split (' ->')[0]
-           elif doc.find ('\n') != -1:
-               print '_emacs_out', doc.split ('\n')[0]
+            print '_emacs_out', doc.split ('\n')[0]
            return
        if inspect.ismethod (func):
            func = func.im_func

**********************************************************************

Here is changelog entry:

2006-11-01  Slawomir Nowaczyk  <slawek@cs.lth.se>

	* emacs.py: (eargs) Provide eldoc message for builtin types.
	  Make sure eargs always outputs sentinel, to avoid emacs freeze.

**********************************************************************

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( slawomir.nowaczyk.847@student.lu.se )

Power corrupts... absolute power is even more fun.

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

* Re: Patch: Python mode and eldoc "freeze"
  2006-11-03 21:11 Patch: Python mode and eldoc "freeze" Slawomir Nowaczyk
@ 2006-11-04  3:35 ` Chong Yidong
  2006-11-04 10:55   ` Slawomir Nowaczyk
  0 siblings, 1 reply; 4+ messages in thread
From: Chong Yidong @ 2006-11-04  3:35 UTC (permalink / raw)
  Cc: emacs-devel

Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se> writes:

>             doc = func.__doc__
>             if doc.find (' ->') != -1:
>                 print '_emacs_out', doc.split (' ->')[0]
> -           elif doc.find ('\n') != -1:
> -               print '_emacs_out', doc.split ('\n')[0]
> +            print '_emacs_out', doc.split ('\n')[0]
>             return

Won't this print _emacs_out twice?

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

* Re: Patch: Python mode and eldoc "freeze"
  2006-11-04  3:35 ` Chong Yidong
@ 2006-11-04 10:55   ` Slawomir Nowaczyk
  2006-11-05 17:28     ` Chong Yidong
  0 siblings, 1 reply; 4+ messages in thread
From: Slawomir Nowaczyk @ 2006-11-04 10:55 UTC (permalink / raw)


On Fri, 03 Nov 2006 22:35:01 -0500
Chong Yidong <cyd@stupidchicken.com> wrote:

#> Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se> writes:
#> 
#> >             doc = func.__doc__
#> >             if doc.find (' ->') != -1:
#> >                 print '_emacs_out', doc.split (' ->')[0]
#> > -           elif doc.find ('\n') != -1:
#> > -               print '_emacs_out', doc.split ('\n')[0]
#> > +            print '_emacs_out', doc.split ('\n')[0]
#> >             return
#> 
#> Won't this print _emacs_out twice?

Oops, sorry, it obviously will... thanks for noticing it. It's not a big
deal since code in python.el deals with it OK, but the patch below is
clearly better.

**********************************************************************

--- EmacsCVS/etc/emacs.py   2006-10-26 23:25:56.225217600 +0200
+++ Emacs/etc/emacs.py       2006-11-04 11:40:26.337289600 +0100
@@ -50,12 +50,12 @@
        if len (parts) > 1:
            exec 'import ' + parts[0] # might fail
        func = eval (name)
-       if inspect.isbuiltin (func):
+       if inspect.isbuiltin (func) or type(func) is type:
            doc = func.__doc__
            if doc.find (' ->') != -1:
                print '_emacs_out', doc.split (' ->')[0]
-           elif doc.find ('\n') != -1:
-               print '_emacs_out', doc.split ('\n')[0]
+            else:
+                print '_emacs_out', doc.split ('\n')[0]
            return
        if inspect.ismethod (func):
            func = func.im_func

**********************************************************************

Here is changelog entry:

2006-11-04  Slawomir Nowaczyk  <slawek@cs.lth.se>

	* emacs.py: (eargs) Provide eldoc message for builtin types.
	  Make sure eargs always outputs sentinel, to avoid emacs freeze.

**********************************************************************

-- 
 Best wishes,
   Slawomir Nowaczyk
     ( slawomir.nowaczyk.847@student.lu.se )

Lord, make my words as sweet as honey, for one day I may have to eat them.

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

* Re: Patch: Python mode and eldoc "freeze"
  2006-11-04 10:55   ` Slawomir Nowaczyk
@ 2006-11-05 17:28     ` Chong Yidong
  0 siblings, 0 replies; 4+ messages in thread
From: Chong Yidong @ 2006-11-05 17:28 UTC (permalink / raw)
  Cc: emacs-devel

Slawomir Nowaczyk <slawomir.nowaczyk.847@student.lu.se> writes:

> #> Won't this print _emacs_out twice?
>
> Oops, sorry, it obviously will... thanks for noticing it. It's not a big
> deal since code in python.el deals with it OK, but the patch below is
> clearly better.

Thanks; I've checked it in.

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

end of thread, other threads:[~2006-11-05 17:28 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-03 21:11 Patch: Python mode and eldoc "freeze" Slawomir Nowaczyk
2006-11-04  3:35 ` Chong Yidong
2006-11-04 10:55   ` Slawomir Nowaczyk
2006-11-05 17:28     ` Chong Yidong

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.