Rename `chinese-cns11643-6' to `=cns11643-6'.
[chise/xemacs-chise.git.1] / lisp / package-admin.el
index 2f971ea..925f6de 100644 (file)
@@ -104,6 +104,16 @@ is already implicit, as `looking-at' is used.  Filenames can,
 unfortunately, contain spaces, so be careful in constructing any
 regexps.")
 
+(defvar package-install-hook nil
+  "*List of hook functions to be called when a new package is successfully
+installed. The hook function is passed two arguments: the package name, and
+the install directory.")
+
+(defvar package-delete-hook nil
+  "*List of hook functions to be called when a package is deleted. The
+hook is called *before* the package is deleted. The hook function is passed
+two arguments: the package name, and the install directory.")
+
 ;;;###autoload
 (defun package-admin-add-single-file-package (file destdir &optional pkg-dir)
   "Install a single file Lisp package into XEmacs package hierarchy.
@@ -165,13 +175,13 @@ or return a location appropriate for the package otherwise."
                 (featurep package-feature)
                 (setq autoload-dir (feature-file package-feature))
                 (setq autoload-dir (file-name-directory autoload-dir))
-                (member autoload-dir late-package-load-path))
+                (member autoload-dir (append early-package-load-path late-package-load-path)))
        ;; Find the corresponding entry in late-package
        (setq pkg-dir
              (car-safe (member-if (lambda (h)
                           (string-match (concat "^" (regexp-quote h))
                                         autoload-dir))
-                        late-packages))))
+                        (append (cdr early-packages) late-packages)))))
       (if pkg-dir
          pkg-dir
        ;; Ok we need to guess
@@ -402,6 +412,7 @@ PACKAGE is a symbol, not a string."
   (let ( (tmpbuf " *pkg-manifest*") manifest-file package-lispdir dirs file)
     (setq pkg-topdir (package-admin-get-install-dir package pkg-topdir))
     (setq manifest-file (package-admin-get-manifest-file pkg-topdir package))
+    (run-hook-with-args 'package-delete-hook package pkg-topdir)
     (if (file-exists-p manifest-file)
        (progn
          ;; The manifest file exists!  Use it to delete the old distribution.
@@ -428,7 +439,7 @@ PACKAGE is a symbol, not a string."
                  ;; Make sure that the file is writable.
                  ;; (This is important under MS Windows.)
                  ;; I do not know why it important under MS Windows but
-                 ;;    1. It bombs out out when the file does not exist. This can be condition-cased
+                 ;;    1. It bombs out when the file does not exist. This can be condition-cased
                  ;;    2. If I removed the write permissions, I do not want XEmacs to just ignore them.
                  ;;       If it wants to, XEmacs may ask, but that is about all
                  ;; (set-file-modes file 438) ;; 438 -> #o666