Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Possibly dumb question... Constructing PATH



I'm redoing some of my .rc files, and was wondering if there's a
common idiom for "add that path to PATH, if it's missing"?

In my .emacs/init.el, I have this concept...
(defun add-extra-path (raw-proposal)
    (let ((proposal (expand-file-name raw-proposal)))
      (if (not (member proposal load-path))
	  (setq load-path (cons proposal load-path)))))

I have a number of paths I add to the Emacs load-path using the above,
by looping across them and adding the ones that aren't already there.

What I'm thinking of is something like..

for pathproposal in ${HOME}/bin /usr/bin /bin /usr/local/bin [cast of
additional "teeming masses"]; do
   if [path-proposal is not in $PATH]
   PATH=$path-proposal:$PATH
   fi
done

Is there any funky slick way to do that check?  Or might I just as
well do an "echo | egrep"?
-- 
http://linuxfinances.info/info/linuxdistributions.html
Joan Crawford  - "I, Joan Crawford, I believe in the dollar.
Everything I earn, I spend." -
http://www.brainyquote.com/quotes/authors/j/joan_crawford.html



Messages sorted by: Reverse Date, Date, Thread, Author