* bug#8316: 23.3; python-find-function is broken
@ 2011-03-22 1:32 Christophe Kalt
2012-06-18 23:35 ` Glenn Morris
0 siblings, 1 reply; 2+ messages in thread
From: Christophe Kalt @ 2011-03-22 1:32 UTC (permalink / raw)
To: 8316
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
try:
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)
except:
print "_emacs_out ()"
Couple comments:
- it isn't mine, was simply adapted from
http://www.loveshack.ukfsn.org/emacs/emacs.py
- .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
-Ic:/imagesupport/include'
^ permalink raw reply [flat|nested] 2+ messages in thread
* bug#8316: 23.3; python-find-function is broken
2011-03-22 1:32 bug#8316: 23.3; python-find-function is broken Christophe Kalt
@ 2012-06-18 23:35 ` Glenn Morris
0 siblings, 0 replies; 2+ messages in thread
From: Glenn Morris @ 2012-06-18 23:35 UTC (permalink / raw)
To: 8316-done
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.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2012-06-18 23:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-22 1:32 bug#8316: 23.3; python-find-function is broken Christophe Kalt
2012-06-18 23:35 ` Glenn Morris
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.