Subject: 23.3; backtrace should use find-function-source-path to find source

From: Ivan Kanis <[email-masked]>
Date: Sun, 05 Jun 2011 18:26:28 +0200

1 - create directory ~/source and ~/compile
2 - create the file ~/source/foo.el with the following content:

(defun foo ()
  (interactive)
  (error "foo"))

(setq find-function-source-path
      (list (expand-file-name "~/source")))

(setq debug-on-error t)

;;;; eval the following two expressions
;; (setq load-path (cons (expand-file-name "~/compile") load-path))
;; (require 'foo))

(provide 'foo)

3 - M-x byte-compile-file
4 - move ~/source foo.elc to ~/compile
5 - in foo.el evaluate the two lines in comment (C-x C-e)
6 - M-x foo should show a backtrace
7 - on the backtrace click on foo

You should get the following error:

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 following trivial patch fixes the problem:

--- find-func.el	2011-06-05 18:23:48.097558000 +0200
+++ find-func-ivan.el	2011-06-05 18:24:18.141247000 +0200
@@ -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)))
 
 (defvar find-function-C-source-directory

In GNU Emacs 23.3.2 (i686-pc-linux-gnu, GTK+ Version 2.22.0)
 of 2011-03-16 on tao
Windowing system distributor `The X.Org Foundation', version 11.0.10900000
configured using `configure  '--prefix=/home/ubuntu/emacs''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: Compilation

Minor modes in effect:
  erc-track-mode: t
  erc-track-minor-mode: t
  tracking-mode: t
  erc-ring-mode: t
  erc-netsplit-mode: t
  erc-match-mode: t
  erc-pcomplete-mode: t
  erc-button-mode: t
  erc-fill-mode: t
  erc-stamp-mode: t
  erc-autojoin-mode: t
  erc-spelling-mode: t
  erc-irccontrols-mode: t
  erc-noncommands-mode: t
  erc-scrolltobottom-mode: t
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  icomplete-mode: t
  global-auto-complete-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t

Recent input:
) <backspace> C-x C-s <up> <up> <up> <left> <left> 
<left> <left> <backspace> <backspace> w h e n C-n <tab> 
C-n <tab> C-n <tab> C-e C-x C-s C-/ C-/ C-/ C-/ C-/ 
C-a C-k <tab> C-n <tab> C-n <tab> C-n <return> ( p 
r o v i d e SPC ' f o o ) C-x C-s M-x <up> <return> 
<return> C-p C-p C-e <backspace> M-x <up> <return> 
<return> y M-i s M-p M-p <return> C-x b f o <return> 
<left> <left> <left> <left> <left> <left> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> <backspace> r e u q <backspace> 
<backspace> q u i r e SPC C-e <left> <left> <left> 
<left> <left> <left> ' <right> <right> <right> <right> 
<right> <right> <backspace> <backspace> <backspace> 
) ) C-x C-s M-x <up> <return> <return> <up> <up> C-a 
; ; SPC <down> <up> C-k <down> <up> e v a l SPC t h 
e SPC f o l l o w i n g SPC t o <backspace> w o SPC 
s e <backspace> <backspace> e x p r e s s i o n s C-n 
<tab> C-n <tab> C-a <up> <up> ; ; <down> <left> <left> 
; ; SPC <down> <left> <left> <left> ; ; SPC C-x C-s 
M-i s M-p M-p <return> <insert> M-x c o m p i <tab> 
e C-g C-x b f o <return> M-x <up> <return> <return> 
M-i s M-p M-p <return> M-k p p <help-echo> <help-echo> 
<help-echo> M-x C-g M-x b u g - C-g M-x r e p o <tab> 
r t <tab> b u g <return> C-g C-o M-x b u g - r e p 
<backspace> <backspace> <backspace> <backspace> <backspace> 
<backspace> <backspace> r e p o <tab> r t - e m a <tab> 
b u g <return>

Recent messages:
Quit
Compiling /home/ubuntu/source/foo.el...done
Wrote /home/ubuntu/source/foo.elc
History item: 1
History item: 2
Quit [2 times]
Making completion list...
Quit
Making completion list...

Load-path shadows:
/home/ubuntu/compile/foo hides ~/tmp/foo
/home/ubuntu/.emacs.d/misc/whitespace hides /home/ubuntu/emacs/share/emacs/23.3/lisp/whitespace
/home/ubuntu/.emacs.d/misc/time hides /home/ubuntu/emacs/share/emacs/23.3/lisp/time
/home/ubuntu/.emacs.d/org/org-publish hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-publish
/home/ubuntu/.emacs.d/org/org-latex hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-latex
/home/ubuntu/.emacs.d/org/org-gnus hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-gnus
/home/ubuntu/.emacs.d/org/org-compat hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-compat
/home/ubuntu/.emacs.d/org/org-jsinfo hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-jsinfo
/home/ubuntu/.emacs.d/org/org-irc hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-irc
/home/ubuntu/.emacs.d/org/org-install hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-install
/home/ubuntu/.emacs.d/org/org-inlinetask hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-inlinetask
/home/ubuntu/.emacs.d/org/org-info hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-info
/home/ubuntu/.emacs.d/org/org-indent hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-indent
/home/ubuntu/.emacs.d/org/org-id hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-id
/home/ubuntu/.emacs.d/org/org-icalendar hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-icalendar
/home/ubuntu/.emacs.d/org/org-html hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-html
/home/ubuntu/.emacs.d/org/org-habit hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-habit
/home/ubuntu/.emacs.d/org/org hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org
/home/ubuntu/.emacs.d/org/org-xoxo hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-xoxo
/home/ubuntu/.emacs.d/org/org-wl hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-wl
/home/ubuntu/.emacs.d/org/org-w3m hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-w3m
/home/ubuntu/.emacs.d/org/org-vm hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-vm
/home/ubuntu/.emacs.d/org/org-timer hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-timer
/home/ubuntu/.emacs.d/org/org-table hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-table
/home/ubuntu/.emacs.d/org/org-src hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-src
/home/ubuntu/.emacs.d/org/org-rmail hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-rmail
/home/ubuntu/.emacs.d/org/org-remember hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-remember
/home/ubuntu/.emacs.d/org/org-protocol hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-protocol
/home/ubuntu/.emacs.d/org/org-plot hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-plot
/home/ubuntu/.emacs.d/org/org-mouse hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-mouse
/home/ubuntu/.emacs.d/org/org-mobile hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-mobile
/home/ubuntu/.emacs.d/org/org-mhe hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-mhe
/home/ubuntu/.emacs.d/org/org-mew hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-mew
/home/ubuntu/.emacs.d/org/org-macs hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-macs
/home/ubuntu/.emacs.d/org/org-mac-message hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-mac-message
/home/ubuntu/.emacs.d/org/org-list hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-list
/home/ubuntu/.emacs.d/org/org-freemind hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-freemind
/home/ubuntu/.emacs.d/org/org-footnote hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-footnote
/home/ubuntu/.emacs.d/org/org-feed hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-feed
/home/ubuntu/.emacs.d/org/org-faces hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-faces
/home/ubuntu/.emacs.d/org/org-exp hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-exp
/home/ubuntu/.emacs.d/org/org-exp-blocks hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-exp-blocks
/home/ubuntu/.emacs.d/org/org-docbook hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-docbook
/home/ubuntu/.emacs.d/org/org-datetree hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-datetree
/home/ubuntu/.emacs.d/org/org-crypt hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-crypt
/home/ubuntu/.emacs.d/org/org-colview hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-colview
/home/ubuntu/.emacs.d/org/org-clock hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-clock
/home/ubuntu/.emacs.d/org/org-bibtex hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-bibtex
/home/ubuntu/.emacs.d/org/org-bbdb hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-bbdb
/home/ubuntu/.emacs.d/org/org-attach hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-attach
/home/ubuntu/.emacs.d/org/org-ascii hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-ascii
/home/ubuntu/.emacs.d/org/org-archive hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-archive
/home/ubuntu/.emacs.d/org/org-agenda hides /home/ubuntu/emacs/share/emacs/23.3/lisp/org/org-agenda
/home/ubuntu/.emacs.d/misc/erc-goodies hides /home/ubuntu/emacs/share/emacs/23.3/lisp/erc/erc-goodies
/home/ubuntu/.emacs.d/emms/tq hides /home/ubuntu/emacs/share/emacs/23.3/lisp/emacs-lisp/tq
/home/ubuntu/.emacs.d/misc/appt hides /home/ubuntu/emacs/share/emacs/23.3/lisp/calendar/appt
/home/ubuntu/.emacs.d/misc/sym-comp hides /home/ubuntu/emacs/share/emacs/23.3/lisp/obsolete/sym-comp

Features:
(shadow guess-lang emacsbug make-mode log-view ibuf-ext ibuffer ffap
etags descr-text info cc-mode cc-fonts cc-menus cc-cmds cc-styles
cc-align cc-engine cc-vars cc-defs cl-specs edebug appt diary-lib
diary-loaddefs smiley gnus-async gnus-bcklg gnus-dup gnus-ml disp-table
gnus-topic parse-time tls pop3 nnml nndraft nnmh bbdb-gnus bbdb-snarf
mail-extr auth-source gnus-agent gnus-srvr gnus-score score-mode
nnvirtual nntp gnus-cache gnus-cite cookie1 gnus-fun gnus-msg gnus-art
mm-uu mml2015 epg-config mm-view smime dig gnus-sum nnoo gnus-group
gnus-undo nnmail mail-source gnus-start gnus-spec gnus-int gnus-range
gnus-win message ecomplete rfc822 mml mml-sec password-cache mm-decode
mm-bodies mm-encode mailcap mail-parse rfc2231 rfc2047 rfc2045 qp
ietf-drums gmm-utils mailheader canlock hashcash gnus gnus-ems nnheader
gnus-util netrc mail-utils bbdb-gui bbdb-picture bbdb-com mailabbrev
bbdb bookmark org-capture org-mks newcomment w3m-form w3m-symbol
w3m-bookmark w3m-tabmenu w3m-session w3m-search w3m doc-view jka-compr
image-mode timezone w3m-hist w3m-fb w3m-ems w3m-ccl ccl w3m-favicon
w3m-image w3m-proc w3m-util org-wl org-w3m org-vm org-rmail org-mhe
org-mew org-irc org-jsinfo org-infojs org-html org-exp ob-exp
org-exp-blocks org-agenda org-info org-gnus org-docview org-bibtex
org-bbdb org byte-opt bytecomp byte-compile ob-emacs-lisp ob-keys
ob-comint ob-tangle ob-ref ob-lob ob-table ob org-footnote org-src
org-list org-faces org-compat org-entities org-macs japan-util kkc
ja-dic-utl erc-track garak notify dbus-util assoc dbus xml tree-widget
elim warnings browse-url cl cl-19 lui tracking incomplete erc-ring
erc-netsplit erc-match erc-pcomplete pcomplete erc-button erc-fill
erc-stamp erc-join erc-spelling flyspell ispell erc-goodies erc
erc-backend erc-compat pp gnus-dired log-edit pcvs-util add-log
diff-mode vc-git vc-bzr sha1 hex-util vc-sccs vc-svn vc-cvs vc-rcs
vc-dir ewoc vc vc-dispatcher dirtrack ansi-color shell mule-util tabify
vc-hg autoinsert noutline outline debug thingatpt find-func icomplete
emms-player-mplayer emms-player-simple url-util url-parse url-vars
mm-util mail-prsvr format-spec emms-mark emms-info-mp3info
emms-tag-editor emms-setup emms-browser sort emms-playlist-sort
emms-score emms-cache emms-info later-do emms-playlist-mode
emms-source-playlist emms-source-file emms emms-compat swbuff
multi-isearch ido uniquify advice advice-preload paren eldoc help-fns
init xcscope ivan-w3m ivan-term ivan-slime ivan-re-builder quail
help-mode view ivan-org ivan-newsticker ivan-muse ivan-message
ivan-japanese ivan-gnus grep compile comint ivan-french easy-mmode
ivan-english ivan-emms ivan-elim dired-x dired-aux dired ivan-comint
cal-iso cal-menu calendar cal-loaddefs bs ivan-bbdb ivan-anki tex-site
ring caps-mode ivan-common-code auto-complete-config auto-complete popup
regexp-opt rx cus-edit easymenu cus-start cus-load wid-edit ivan-var
ivan-keymap edmacro kmacro ivan-fun ivan-face ivan-load time-date
tooltip ediff-hook vc-hooks lisp-float-type mwheel x-win x-dnd
font-setting tool-bar dnd fontset image fringe lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mldrag mouse jit-lock
font-lock syntax facemenu font-core frame cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese hebrew
greek romanian slovak czech european ethiopic indian cyrillic chinese
case-table epa-hook jka-cmpr-hook help simple abbrev loaddefs button
minibuffer faces cus-face files text-properties overlay md5 base64
format env code-pages mule custom widget hashtable-print-readable
backquote make-network-process dbusbind font-render-setting gtk
x-toolkit x multi-tty emacs)

-- 
Ivan Kanis
http://kanis.fr

Life is not about finding our limitations, it's about finding our
infinity.
    -- Herbie Hancock