From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.bugs Subject: bug#8803: 23.3; backtrace should use find-function-source-path to find source Date: Mon, 20 Jun 2011 16:57:24 -0400 Message-ID: References: <87k4d0gs7f.fsf@kanis.fr> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: dough.gmane.org 1308604089 22521 80.91.229.12 (20 Jun 2011 21:08:09 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Mon, 20 Jun 2011 21:08:09 +0000 (UTC) Cc: 8803@debbugs.gnu.org To: Ivan Kanis Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Mon Jun 20 23:08:04 2011 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1QYlhU-0000ZH-1U for geb-bug-gnu-emacs@m.gmane.org; Mon, 20 Jun 2011 23:08:04 +0200 Original-Received: from localhost ([::1]:52712 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYlhT-00028t-0X for geb-bug-gnu-emacs@m.gmane.org; Mon, 20 Jun 2011 17:08:03 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:33728) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYlXp-0007xD-QX for bug-gnu-emacs@gnu.org; Mon, 20 Jun 2011 16:58:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QYlXn-0004rI-28 for bug-gnu-emacs@gnu.org; Mon, 20 Jun 2011 16:58:05 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:60140) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QYlXm-0004rD-Hy for bug-gnu-emacs@gnu.org; Mon, 20 Jun 2011 16:58:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.69) (envelope-from ) id 1QYlXm-0003x1-1l; Mon, 20 Jun 2011 16:58:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Stefan Monnier Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-To: owner@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 20 Jun 2011 20:58:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 8803 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 8803-submit@debbugs.gnu.org id=B8803.130860345415156 (code B ref 8803); Mon, 20 Jun 2011 20:58:02 +0000 Original-Received: (at 8803) by debbugs.gnu.org; 20 Jun 2011 20:57:34 +0000 Original-Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYlXJ-0003wP-Mt for submit@debbugs.gnu.org; Mon, 20 Jun 2011 16:57:33 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181] helo=ironport2-out.pppoe.ca) by debbugs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1QYlXH-0003w8-Sn for 8803@debbugs.gnu.org; Mon, 20 Jun 2011 16:57:32 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av0EAN2z/01FxL0s/2dsb2JhbABTpmR4iHPAAIYqBJ1ZhCI X-IronPort-AV: E=Sophos;i="4.65,396,1304308800"; d="scan'208";a="116722712" Original-Received: from 69-196-189-44.dsl.teksavvy.com (HELO pastel.home) ([69.196.189.44]) by ironport2-out.pppoe.ca with ESMTP/TLS/ADH-AES256-SHA; 20 Jun 2011 16:57:25 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 9B02D59011; Mon, 20 Jun 2011 16:57:24 -0400 (EDT) In-Reply-To: <87k4d0gs7f.fsf@kanis.fr> (Ivan Kanis's message of "Sun, 05 Jun 2011 18:26:28 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.11 Precedence: list Resent-Date: Mon, 20 Jun 2011 16:58:02 -0400 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:47363 Archived-At: > find-library-name: Can't find library /home/ubuntu/compile/foo.el > I expect emacs to load foo.el since find-function-source-path is > defined. The problem here is that we use an absolute file name, rather than a relative one. > @@ -156,6 +156,9 @@ > (locate-file library > (or find-function-source-path load-path) > load-file-rep-suffixes) > + (locate-file (file-name-sans-extension (file-name-nondirectory library)) > + (or find-function-source-path load-path) > + (find-library-suffixes)) > (error "Can't find library %s" library))) But this will still fail for files such as Semantic's which are placed in subdirectories (e.g. loaded with (require 'foo/bar)). We really need to record both the absolute file name and the relative file name so that find-library-name can try both. In the mean time, does the patch below work for you? Stefan === modified file 'lisp/emacs-lisp/find-func.el' --- lisp/emacs-lisp/find-func.el 2011-01-25 04:08:28 +0000 +++ lisp/emacs-lisp/find-func.el 2011-06-20 20:55:50 +0000 @@ -141,6 +141,15 @@ (dolist (suffix (get-load-suffixes) (nreverse suffixes)) (unless (string-match "elc" suffix) (push suffix suffixes))))) +(defun find-library--load-name (library) + (let ((name library)) + (dolist (dir load-path) + (let ((rel (file-relative-name library dir))) + (if (and (not (string-match "\\`\\.\\./" rel)) + (< (length rel) (length name))) + (setq name rel)))) + (unless (equal name library) name))) + (defun find-library-name (library) "Return the absolute file name of the Emacs Lisp source of LIBRARY. LIBRARY should be a string (the name of the library)." @@ -155,6 +164,16 @@ (locate-file library (or find-function-source-path load-path) load-file-rep-suffixes) + (when (file-name-absolute-p library) + (let ((rel (find-library--load-name library))) + (when rel + (or + (locate-file rel + (or find-function-source-path load-path) + (find-library-suffixes)) + (locate-file rel + (or find-function-source-path load-path) + load-file-rep-suffixes))))) (error "Can't find library %s" library))) (defvar find-function-C-source-directory