| Paste number 9228: | Definition of `debian-pkg-add-load-path-item' for dbrock |
| Pasted by: | mwolson |
| When: | 4 years, 2 weeks ago |
| Share: | Tweet this! | http://paste.lisp.org/+74C |
| Channel: | #emacs |
| Paste contents: |
(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 the /usr/local/ directories. After modifying
load-path, returns the new load-path."
(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)
(remainder load-path))
(while (consp remainder)
(setq result (cons (car remainder) result))
(setq remainder (cdr remainder))
(if (= pos last-local-pos)
(setq result (cons item result)))
(setq pos (+ pos 1)))
(setq load-path (nreverse result))
load-path))))
This paste has no annotations.