Re: A flaw in current emacsen package setup?
- To: debian-emacsen@lists.debian.org
- Cc: Sam Hartman <hartmans@mekinok.com>, emacsen-common@packages.debian.org, xae@packages.debian.org, tramp@packages.debian.org, speedbar@packages.debian.org, pcl-cvs@packages.debian.org, maxima@packages.debian.org, gnuserv@packages.debian.org, erc@packages.debian.org, emacs-goodies-el@packages.debian.org, eieio@packages.debian.org, dpkg-dev-el@packages.debian.org, debbugs-el@packages.debian.org, cxref@packages.debian.org, calc@packages.debian.org, auctex@packages.debian.org, elib@packages.debian.org
- Subject: Re: A flaw in current emacsen package setup?
- From: Rob Browning <rlb@defaultvalue.org>
- Date: Mon, 28 Jan 2002 08:27:43 -0600
- Message-id: <[🔎] 87sn8q1rfk.fsf@raven.i.defaultvalue.org>
- In-reply-to: <87adx0970t.fsf@glaurung.green-gryphon.com> (Manoj Srivastava's message of "Mon, 03 Dec 2001 00:01:22 -0600")
- References: <87adx0970t.fsf@glaurung.green-gryphon.com>
Manoj Srivastava <srivasta@debian.org> 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
Reply to: