Manoj Srivastava <[EMAIL PROTECTED]> writes:
> I have noticed a problem recently in in the way packages modify the
> load path.
I've finally had a chance to work on this. I looked at the
add-after-local function, but thought that we ought to scan the whole
path so we can make sure to insert elements after the final occurrence
of a /usr/local/ prefixed element.
Here's the function that all add-on packages would be required to
call. It will be a part of emacsen-common and available at startup,
unless --no-site-file is specified.
(defun debian-pkg-add-load-path-item (item)
"Takes a path item (a string) and adds it to load path in the correct
position for an add-on package, before the emacs system directories,
but after any /usr/local/ directories."
(let ((pos 0)
(last-local-pos nil)
(lp-rest load-path))
;; Find the last /usr/local/ element.
(while (not (null lp-rest))
(if (string-match "^/usr/local" (car lp-rest))
(setq last-local-pos pos))
(setq pos (+ pos 1))
(setq lp-rest (cdr lp-rest)))
(if (not last-local-pos)
(error "No /usr/local/ prefixed paths in load-path"))
(let ((result '())
(pos 0))
(dolist (elt load-path (nreverse result))
(setq result (cons elt result))
(if (= pos last-local-pos)
(setq result (cons item result)))
(setq pos (+ pos 1))))))
If no one has any serious objections to this, I'll upload a new
version of emacsen-common shortly containing this function and the
requisite changes to policy.
--
Rob Browning
rlb @defaultvalue.org, @linuxdevel.com, and @debian.org
Previously @cs.utexas.edu
GPG=1C58 8B2C FB5E 3F64 EA5C 64AE 78FE E5FE F0CB A0AD