;;; locker.el --- for maintainers of elisp packages in Athena lockers

(defun locker-putfirst (elt list)
  (cons elt (delq (assoc elt list) list)))

(defmacro locker-setq (sym val)
  "(locker-setq SYM VAL): set symbol SYM to value VAL if not already set.
Use this when site-init.el or user .emacs setq's should override
locker setq's."
  (if (not (boundp sym)) (list 'setq sym val)))

(defun locker-infodir (dirname)
  "(locker-infodir DIRNAME): Make info files in DIRNAME be found first.
Will work whether info has been invoked yet or not.
However, the INFOPATH environment variable will override this function,
so if you set that variable yourself, be sure to include any locker
info directories you want to get first."
  (interactive "DInfo directory: ")
  (if (boundp 'Info-directory-list)
      (setq Info-directory-list
	    (locker-putfirst dirname Info-directory-list))
    (setq Info-default-directory-list
	  (locker-putfirst dirname Info-default-directory-list))))

(defun locker-elisp (dirname)
  "(locker-elisp DIRNAME): Make lisp files in DIRNAME be found first.
Will not create multiple instances of the same directory in load-path."
  (interactive "DLisp directory: ")
  (setq load-path
	(locker-putfirst dirname load-path)))

(defun locker-require-emacs (ver pkg)
  "(locker-require-emacs VER PKG): Tell user to use emacs VER for PKG."
  (error "You are using emacs %s, but %s requires %s or higher."
	 emacs-version pkg ver))

(provide 'locker)

;;; locker.el ends here
