On 28 Jun 2011, Nick Dokos wrote: > Michael Markert <[email protected]> wrote: >> <snip> >> Problem: autoload.el generates file names with lisp/ prefix. > > For you and Suvayu, but not for me. It's the discrepancy > that bothers me.
I dug into emacs because I thought "Sure, there must be some change in
the meantime", well now I'm bothered, too.
The bzr autoloads.el is identical to mine.
But this code makes me curious:
#+begin_src emacs-lisp
(defun autoload-file-load-name (file)
"Compute the name that will be used to load FILE."
;; OUTFILE should be the name of the global loaddefs.el file, which
;; is expected to be at the root directory of the files we're
;; scanning for autoloads and will be in the `load-path'.
(let* ((outfile (default-value 'generated-autoload-file))
(name (file-relative-name file (file-name-directory outfile)))
(names '())
(dir (file-name-directory outfile)))
;; If `name' has directory components, only keep the
;; last few that are really needed.
(while name
(setq name (directory-file-name name))
(push (file-name-nondirectory name) names)
(setq name (file-name-directory name)))
(while (not name)
(cond
((null (cdr names)) (setq name (car names)))
((file-exists-p (expand-file-name "subdirs.el" dir))
;; FIXME: here we only check the existence of subdirs.el,
;; without checking its content. This makes it generate wrong load
;; names for cases like lisp/term which is not added to load-path.
(setq dir (expand-file-name (pop names) dir)))
(t (setq name (mapconcat 'identity names "/")))))
(if (string-match "\\.elc?\\(\\.\\|\\'\\)" name)
(substring name 0 (match-beginning 0))
name)))
#+end_src emacs-lisp
if I read it correctly we decompose our path-name (say lisp/org.el), by
rebasing it on outfile (org-install.el, which gives lisp/org.el) and
split in dirs, which gives '("lisp" "org.el"), then we are in the else
branch, build "lisp/org.el" and then in the last if we chop of the
".el".
I can't see how you get there correct path names :(
Michael
pgp9ss3LwuIbr.pgp
Description: PGP signature
