[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[debbugs-tracker] bug#8316: closed (23.3; python-find-function is broken

From: GNU bug Tracking System
Subject: [debbugs-tracker] bug#8316: closed (23.3; python-find-function is broken)
Date: Mon, 18 Jun 2012 23:39:02 +0000

Your message dated Mon, 18 Jun 2012 19:35:16 -0400
with message-id <address@hidden>
and subject line Re: bug#8316: 23.3; python-find-function is broken
has caused the debbugs.gnu.org bug report #8316,
regarding 23.3; python-find-function is broken
to be marked as done.

(If you believe you have received this mail in error, please contact

8316: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=8316
GNU Bug Tracking System
Contact address@hidden with problems
--- Begin Message --- Subject: 23.3; python-find-function is broken Date: Mon, 21 Mar 2011 21:32:42 -0400
python-find-function cannot work as the emacs.location_of function is
missing from etc/emacs[23].py
The following seems to work for Python 2.x

def location_of (name, imports):
    """Get location at which NAME is defined (or nil).
    Provides a pair (PATH, LINE), where LINE is the start of the definition
    in path name PATH.
    Exec IMPORTS first."""
    locls = {}
    if imports:
        try: exec (imports, locls)
        except: pass
        obj = eval (name, globals (), locls)
        # Bug: (in Python 2.5) `getsourcefile' only works with modules,
        # hence the `getmodule' here.
        srcfile = inspect.getsourcefile (inspect.getmodule (obj))
        _, line = inspect.getsourcelines (obj)
        print '_emacs_out ("%s" . %d)' % (srcfile.replace('\\', '/'), line)
        print "_emacs_out ()"

Couple comments:
- it isn't mine, was simply adapted from
- .replace('\\', '/') seems necessary on Windows but feels like an ugly hack

In GNU Emacs 23.3.1 (i386-mingw-nt6.1.7600)
 of 2011-03-10 on 3249CTO
Windowing system distributor `Microsoft Corp.', version 6.1.7600
configured using `configure --with-gcc (4.5) --no-opt --cflags

--- End Message ---
--- Begin Message --- Subject: Re: bug#8316: 23.3; python-find-function is broken Date: Mon, 18 Jun 2012 19:35:16 -0400 User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)
Version: 24.2

Thanks for the report. The Emacs trunk has a new python.el, and it seems
your problem is fixed there. This should appear in Emacs 24.2.

python-find-function is replaced by python-nav-jump-to-defun.

--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]