Re: on the loading of preference files

Gary King <[email protected]>
Newsgroups gmane.lisp.cclan.general
Message-ID <[email protected]>
Here is an actual diff:

> Index: asdf.lisp
> ===================================================================
> RCS file: /cvsroot/cclan/asdf/asdf.lisp,v
> retrieving revision 1.99
> diff -u -w -u -r1.99 asdf.lisp
> --- asdf.lisp   16 Jun 2006 20:17:01 -0000      1.99
> +++ asdf.lisp   20 Jun 2006 13:56:48 -0000
> @@ -101,6 +101,8 @@
>            #:retry
>            #:accept                     ; restarts
>
> +           #:preference-file-for-system
> +           #:load-preferences
>            )
>    (:use :cl))
> @@ -827,6 +829,32 @@
> (defmethod perform ((operation test-op) (c component))
>    nil)
> +(defgeneric load-preferences (system)
> +  (:documentation "Called to load system preferences after  
> <perform load-op system>. Typical uses are to set parameters that  
> don't exist until after the system has been loaded."))
> +
> +(defgeneric preference-file-for-system (system)
> +  (:documentation "Returns the pathname of the preference file for  
> this system. Called by 'load-preferences to determine what file to  
> load."))
> +
> +(defmethod load-preferences ((s system))
> +  (let* ((*package* (find-package :common-lisp))
> +         (file (probe-file (preference-file-for-system s))))
> +    (when file (load file))))
> +
> +(defmethod preference-file-for-system ((system t))
> +  ;; cope with anything other than systems
> +  (preference-file-for-system (find-system system t)))
> +
> +(defmethod preference-file-for-system ((s system))
> +  (merge-pathnames
> +   (make-pathname :name (component-name s)
> +                  :type "lisp"
> +                  :directory '(:relative ".asdf"))
> +   (truename (user-homedir-pathname))))
> +
> +(defmethod perform :after ((operation load-op) (c system))
> +  (load-preferences c))
> +
> +
> ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
> ;;; invoking operations

-- 
Gary Warren King
metabang.com
http://www.metabang.com/
(413) 210 7511
gwking on #lisp (occasionally)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.