From unknown Sun Jun 22 04:07:41 2025 X-Loop: help-debbugs@gnu.org Subject: bug#8316: 23.3; python-find-function is broken Resent-From: Christophe Kalt Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 22 Mar 2011 02:02:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 8316 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 8316@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.13007592774122 (code B ref -1); Tue, 22 Mar 2011 02:02:02 +0000 Received: (at submit) by debbugs.gnu.org; 22 Mar 2011 02:01:17 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1quL-00014Q-0P for submit@debbugs.gnu.org; Mon, 21 Mar 2011 22:01:17 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1qTK-0000SM-Pq for submit@debbugs.gnu.org; Mon, 21 Mar 2011 21:33:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q1qTE-0000yT-Ov for submit@debbugs.gnu.org; Mon, 21 Mar 2011 21:33:17 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:55116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q1qTE-0000yP-M7 for submit@debbugs.gnu.org; Mon, 21 Mar 2011 21:33:16 -0400 Received: from [140.186.70.92] (port=45669 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q1qTD-00020Y-2y for bug-gnu-emacs@gnu.org; Mon, 21 Mar 2011 21:33:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q1qTB-0000yB-SI for bug-gnu-emacs@gnu.org; Mon, 21 Mar 2011 21:33:14 -0400 Received: from mail-qy0-f169.google.com ([209.85.216.169]:55473) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q1qTB-0000y1-Ph for bug-gnu-emacs@gnu.org; Mon, 21 Mar 2011 21:33:13 -0400 Received: by qyk2 with SMTP id 2so3116500qyk.0 for ; Mon, 21 Mar 2011 18:33:12 -0700 (PDT) Received: by 10.224.76.74 with SMTP id b10mr4001332qak.339.1300757592303; Mon, 21 Mar 2011 18:33:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.155.72 with HTTP; Mon, 21 Mar 2011 18:32:42 -0700 (PDT) From: Christophe Kalt Date: Mon, 21 Mar 2011 21:32:42 -0400 Message-ID: Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -6.6 (------) X-Mailman-Approved-At: Mon, 21 Mar 2011 22:01:15 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) 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): =A0=A0=A0 """Get location at which NAME is defined (or nil). =A0=A0=A0 Provides a pair (PATH, LINE), where LINE is the start of the defi= nition =A0=A0=A0 in path name PATH. =A0=A0=A0 Exec IMPORTS first.""" =A0=A0=A0 locls =3D {} =A0=A0=A0 if imports: =A0=A0=A0=A0=A0=A0=A0 try: exec (imports, locls) =A0=A0=A0=A0=A0=A0=A0 except: pass =A0=A0=A0 try: =A0=A0=A0=A0=A0=A0=A0 obj =3D eval (name, globals (), locls) =A0=A0=A0=A0=A0=A0=A0 # Bug: (in Python 2.5) `getsourcefile' only works wit= h modules, =A0=A0=A0=A0=A0=A0=A0 # hence the `getmodule' here. =A0=A0=A0=A0=A0=A0=A0 srcfile =3D inspect.getsourcefile (inspect.getmodule = (obj)) =A0=A0=A0=A0=A0=A0=A0 _, line =3D inspect.getsourcelines (obj) =A0=A0=A0=A0=A0=A0=A0 print '_emacs_out ("%s" . %d)' % (srcfile.replace('\\= ', '/'), line) =A0=A0=A0 except: =A0=A0=A0=A0=A0=A0=A0 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 hac= k In GNU Emacs 23.3.1 (i386-mingw-nt6.1.7600) =A0of 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' From unknown Sun Jun 22 04:07:41 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.428 (Entity 5.428) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Christophe Kalt Subject: bug#8316: closed (Re: bug#8316: 23.3; python-find-function is broken) Message-ID: References: X-Gnu-PR-Message: they-closed 8316 X-Gnu-PR-Package: emacs Reply-To: 8316@debbugs.gnu.org Date: Mon, 18 Jun 2012 23:39:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1340062742-4691-1" This is a multi-part message in MIME format... ------------=_1340062742-4691-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #8316: 23.3; python-find-function is broken which was filed against the emacs package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 8316@debbugs.gnu.org. --=20 8316: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D8316 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1340062742-4691-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 8316-done) by debbugs.gnu.org; 18 Jun 2012 23:38:37 +0000 Received: from localhost ([127.0.0.1]:47319 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SglWn-0001Cy-Cy for submit@debbugs.gnu.org; Mon, 18 Jun 2012 19:38:37 -0400 Received: from fencepost.gnu.org ([208.118.235.10]:54029) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SglWl-0001Cr-9H for 8316-done@debbugs.gnu.org; Mon, 18 Jun 2012 19:38:36 -0400 Received: from rgm by fencepost.gnu.org with local (Exim 4.71) (envelope-from ) id 1SglTY-0003UM-8Z; Mon, 18 Jun 2012 19:35:16 -0400 From: Glenn Morris To: 8316-done@debbugs.gnu.org Subject: Re: bug#8316: 23.3; python-find-function is broken References: X-Spook: Freeh Saudi Arabia NORAD ANC CBNRC UMTS Zachawi Watergate X-Ran: p1V+-Udz\X>~Dgk@uGiBGZ~Wan^`NvFvhipH&FXa/;?oE(~(?;}Je*nY;koGD!O,x~*z;/ X-Hue: red X-Attribution: GM Date: Mon, 18 Jun 2012 19:35:16 -0400 In-Reply-To: (Christophe Kalt's message of "Mon, 21 Mar 2011 21:32:42 -0400") Message-ID: User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Spam-Score: -6.9 (------) X-Debbugs-Envelope-To: 8316-done X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.9 (------) 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. ------------=_1340062742-4691-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 22 Mar 2011 02:01:17 +0000 Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1quL-00014Q-0P for submit@debbugs.gnu.org; Mon, 21 Mar 2011 22:01:17 -0400 Received: from eggs.gnu.org ([140.186.70.92]) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Q1qTK-0000SM-Pq for submit@debbugs.gnu.org; Mon, 21 Mar 2011 21:33:23 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q1qTE-0000yT-Ov for submit@debbugs.gnu.org; Mon, 21 Mar 2011 21:33:17 -0400 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=unavailable version=3.3.1 Received: from lists.gnu.org ([199.232.76.165]:55116) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q1qTE-0000yP-M7 for submit@debbugs.gnu.org; Mon, 21 Mar 2011 21:33:16 -0400 Received: from [140.186.70.92] (port=45669 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Q1qTD-00020Y-2y for bug-gnu-emacs@gnu.org; Mon, 21 Mar 2011 21:33:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Q1qTB-0000yB-SI for bug-gnu-emacs@gnu.org; Mon, 21 Mar 2011 21:33:14 -0400 Received: from mail-qy0-f169.google.com ([209.85.216.169]:55473) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Q1qTB-0000y1-Ph for bug-gnu-emacs@gnu.org; Mon, 21 Mar 2011 21:33:13 -0400 Received: by qyk2 with SMTP id 2so3116500qyk.0 for ; Mon, 21 Mar 2011 18:33:12 -0700 (PDT) Received: by 10.224.76.74 with SMTP id b10mr4001332qak.339.1300757592303; Mon, 21 Mar 2011 18:33:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.52.155.72 with HTTP; Mon, 21 Mar 2011 18:32:42 -0700 (PDT) From: Christophe Kalt Date: Mon, 21 Mar 2011 21:32:42 -0400 Message-ID: Subject: 23.3; python-find-function is broken To: bug-gnu-emacs@gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 199.232.76.165 X-Spam-Score: -6.6 (------) X-Debbugs-Envelope-To: submit X-Mailman-Approved-At: Mon, 21 Mar 2011 22:01:15 -0400 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: debbugs-submit-bounces@debbugs.gnu.org Errors-To: debbugs-submit-bounces@debbugs.gnu.org X-Spam-Score: -6.6 (------) 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): =A0=A0=A0 """Get location at which NAME is defined (or nil). =A0=A0=A0 Provides a pair (PATH, LINE), where LINE is the start of the defi= nition =A0=A0=A0 in path name PATH. =A0=A0=A0 Exec IMPORTS first.""" =A0=A0=A0 locls =3D {} =A0=A0=A0 if imports: =A0=A0=A0=A0=A0=A0=A0 try: exec (imports, locls) =A0=A0=A0=A0=A0=A0=A0 except: pass =A0=A0=A0 try: =A0=A0=A0=A0=A0=A0=A0 obj =3D eval (name, globals (), locls) =A0=A0=A0=A0=A0=A0=A0 # Bug: (in Python 2.5) `getsourcefile' only works wit= h modules, =A0=A0=A0=A0=A0=A0=A0 # hence the `getmodule' here. =A0=A0=A0=A0=A0=A0=A0 srcfile =3D inspect.getsourcefile (inspect.getmodule = (obj)) =A0=A0=A0=A0=A0=A0=A0 _, line =3D inspect.getsourcelines (obj) =A0=A0=A0=A0=A0=A0=A0 print '_emacs_out ("%s" . %d)' % (srcfile.replace('\\= ', '/'), line) =A0=A0=A0 except: =A0=A0=A0=A0=A0=A0=A0 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 hac= k In GNU Emacs 23.3.1 (i386-mingw-nt6.1.7600) =A0of 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' ------------=_1340062742-4691-1--