Subject: bug#6716: 23.2; Setting `find-function-source-path' has no effect.

From: Stefan Monnier <[email-masked]>
Date: Mon, 26 Jul 2010 01:45:13 +0200

> Because `find-library-name' receives as its LIBRARY argument the full
> path, but doesn't strip the directory part, setting
> `find-function-source-path' has no effect on symbol finding -- Emacs
> still tries the path guessed according to load path (which is not
> correct in case you have the Elisp sources in directory different from
> the compiled files).

The file name has been changed to a full absolute name to avoid showing
the wrong file when there's some shadowing going on.  So your patch
would re-introduce this problem.

Also, it may not work for files that were loaded as "foo/bar".  I think
the load-history needs to be changed to keep track of both the absolute
file name and the name used to load the file
(i.e. "/bla/bla/foo/bar.elc" and "foo/bar").  Then in
find-function-source-path we will first try for /bla/bla/foo/bar.el and
when that fails we can fall back on searching for foo/bar.el.

        Stefan

> This simple change seems to fix it for me:

> diff --git a/lisp/emacs-lisp/find-func.el b/lisp/emacs-lisp/find-func.el
> index 216d91b..f704c63 100644
> --- a/lisp/emacs-lisp/find-func.el
> +++ b/lisp/emacs-lisp/find-func.el
> @@ -150,10 +150,10 @@ (defun find-library-name (library)
>    (if (string-match "\\.el\\(c\\(\\..*\\)?\\)\\'" library)
>        (setq library (replace-match "" t t library)))
>    (or 
> -   (locate-file library
> +   (locate-file (file-name-nondirectory library)
>  		(or find-function-source-path load-path)
>  		(find-library-suffixes))
> -   (locate-file library
> +   (locate-file (file-name-nondirectory library)
>  		(or find-function-source-path load-path)
>  		load-file-rep-suffixes)
>     (error "Can't find library %s" library)))

> Regards,

>   Štěpán