]> git.eshelyaron.com Git - emacs.git/commitdiff
(unload-feature): A bit of sanity check of
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 11 Apr 2006 17:05:16 +0000 (17:05 +0000)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 11 Apr 2006 17:05:16 +0000 (17:05 +0000)
load-history entries.  Cancel timer-vars before unbinding them.

lisp/ChangeLog
lisp/loadhist.el

index 747781efcb6b9d80d42a6f6fd69edc24ea3fb6e2..52e2549235c48f9aa884850e3e3b0c5ef92f0169 100644 (file)
@@ -1,5 +1,8 @@
 2006-04-11  Stefan Monnier  <monnier@iro.umontreal.ca>
 
+       * loadhist.el (unload-feature): A bit of sanity check of
+       load-history entries.  Cancel timer-vars before unbinding them.
+
        * hexl.el (hexl-isearch-search-function): Fix regexp-building code to
        quote special chars, and make the trick work on the hex part of the
        buffer as well.
index dc0e4bdc3a2e0df733e90b9b3b16678946d9d858..635059f93e534b467f31bc99628ea6249c2a41c5 100644 (file)
@@ -32,6 +32,8 @@
 
 ;;; Code:
 
+(eval-when-compile (require 'cl))
+
 (defun feature-symbols (feature)
   "Return the file and list of definitions associated with FEATURE.
 The value is actually the element of `load-history'
@@ -207,23 +209,29 @@ such as redefining an Emacs function."
          (elp-restore-function elt))))
     (dolist (x unload-hook-features-list)
       (if (consp x)
-         (cond
+         (case (car x)
           ;; Remove any feature names that this file provided.
-          ((eq (car x) 'provide)
+          (provide
            (setq features (delq (cdr x) features)))
-          ((eq (car x) 'defun)
+          (defun
            (let ((fun (cdr x)))
              (when (fboundp fun)
                (when (fboundp 'ad-unadvise)
                  (ad-unadvise fun))
-               (fmakunbound fun)
                (let ((aload (get fun 'autoload)))
-                 (when aload
-                   (fset fun (cons 'autoload aload))))))))
+                 (if aload
+                      (fset fun (cons 'autoload aload))
+                    (fmakunbound fun))))))
+           (require nil)
+           (t (message "Unexpected element %s in load-history" x)))
        ;; Kill local values as much as possible.
        (dolist (buf (buffer-list))
          (with-current-buffer buf
+            (if (and (boundp x) (timerp (symbol-value x)))
+                (cancel-timer (symbol-value x)))
            (kill-local-variable x)))
+        (if (and (boundp x) (timerp (symbol-value x)))
+            (cancel-timer (symbol-value x)))
        ;; Get rid of the default binding if we can.
        (unless (local-variable-if-set-p x)
          (makunbound x))))
@@ -232,5 +240,5 @@ such as redefining an Emacs function."
 
 (provide 'loadhist)
 
-;;; arch-tag: 70bb846a-c413-4f01-bf88-78dba4ac0798
+;; arch-tag: 70bb846a-c413-4f01-bf88-78dba4ac0798
 ;;; loadhist.el ends here