unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* unload-feature questions and thoughts
@ 2007-02-04 18:03 Juanma Barranquero
  2007-02-04 18:32 ` David Kastrup
  2007-02-05 19:10 ` Richard Stallman
  0 siblings, 2 replies; 44+ messages in thread
From: Juanma Barranquero @ 2007-02-04 18:03 UTC (permalink / raw)
  To: Emacs Devel

 1.- Currently, `unload-feature' (from loadhist.el) does not expect
entries on `load-history' of the form (autoload . SYMBOL) or (defface
. SYMBOL). Unloading a package which defines either one produces
messages like

  Unexpected element (defface . myface) in load-history

which should be reserved, I think, to really unexpected items in the
load-history, not perfectly usual ones like those above.

AFAICS, there's no way to delete an existing face, so ignoring the
item is the best option (or, alternatively, giving a more significant
warning, like "Face MYFACE can not be unloaded"). Autoload entries,
OTOH, can be unloaded like a function; so I propose to commit the
attached patch.

 2.- `unload-feature' returns `load-history', but this is not
documented, and a PITA when you're using `unload-feature' in a context
that evaluates its result, like IELM. Should we document what it does
now, or (preferred) just force it to return nil?

 3.- A weirdness of load vs. autoload. Let's suppose we have a package
test.el, with:

  ;;;;; test.el ;;;;;
  (defun test-fun () (interactive) t)
  (provide 'test)
  ;;;;;;;;;;;;;;;;;;;

and we create an autoload for it:

  (autoload 'test-fun "test" nil t)

Now, if we do load test.el by using the autoload mechanism, i.e.,

  M-x test-fun RET

then the autoload is recorded:

  (get 'test-fun 'autoload) => ("test" nil t nil)

However, if we load test.el with `load' or `require', the autoload is
not recorded:

  (require 'test)
  (get 'test-fun 'autoload) => nil

Which is not very important, but affects the ability of
`unload-feature' to do its work: it cannot restore an autoload if it
is not recorded in the property list.

                    /L/e/k/t/u


Index: lisp/ChangeLog
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/ChangeLog,v
retrieving revision 1.10649
diff -u -2 -r1.10649 ChangeLog
--- lisp/ChangeLog	4 Feb 2007 17:29:50 -0000	1.10649
+++ lisp/ChangeLog	4 Feb 2007 17:50:33 -0000
@@ -1,2 +1,8 @@
+2007-02-04  Juanma Barranquero  <lekktu@gmail.com>
+
+	* loadhist.el (unload-feature): Process also `load-history'
+	entries of the form `(autoload . SYMBOL)' (by treating them like
+	`defun'), and `(defface . SYMBOL)' (by ignoring them).
+
 2007-02-04  David Kastrup  <dak@gnu.org>

Index: lisp/loadhist.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/loadhist.el,v
retrieving revision 1.43
diff -u -2 -r1.43 loadhist.el
--- lisp/loadhist.el	21 Jan 2007 03:53:11 -0000	1.43
+++ lisp/loadhist.el	4 Feb 2007 16:59:22 -0000
@@ -216,5 +216,5 @@
 	   (provide
 	    (setq features (delq (cdr x) features)))
-	   (defun
+	   ((defun autoload)
 	    (let ((fun (cdr x)))
 	      (when (fboundp fun)
@@ -225,5 +225,5 @@
                       (fset fun (cons 'autoload aload))
                     (fmakunbound fun))))))
-           ((t require) nil)
+           ((t require defface) nil)
 	   (t (message "Unexpected element %s in load-history" x)))
 	;; Kill local values as much as possible.

^ permalink raw reply	[flat|nested] 44+ messages in thread

end of thread, other threads:[~2007-10-28 13:51 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-02-04 18:03 unload-feature questions and thoughts Juanma Barranquero
2007-02-04 18:32 ` David Kastrup
2007-02-04 19:07   ` Juanma Barranquero
2007-02-04 19:14     ` David Kastrup
2007-02-05  0:10       ` Juanma Barranquero
2007-02-05  7:21         ` David Kastrup
2007-02-05  9:21           ` Juanma Barranquero
2007-02-05  9:32             ` David Kastrup
2007-02-05 11:08               ` Juanma Barranquero
2007-02-05 11:16                 ` David Kastrup
2007-02-05 11:40                   ` Juanma Barranquero
2007-02-06  0:16                 ` Richard Stallman
2007-10-10 11:04                 ` Juanma Barranquero
2007-10-10 14:52                   ` Davis Herring
2007-10-10 16:08                     ` Juanma Barranquero
2007-10-10 17:03                       ` Davis Herring
2007-10-10 17:07                         ` Juanma Barranquero
2007-10-10 17:56                           ` Davis Herring
2007-10-11  5:20                             ` Richard Stallman
2007-10-11  6:39                             ` David Kastrup
2007-10-11 15:16                               ` Juanma Barranquero
2007-10-12 15:59                                 ` Richard Stallman
2007-10-12 17:01                                   ` Juanma Barranquero
2007-10-13  6:41                                     ` Richard Stallman
2007-10-13 10:03                                       ` Juanma Barranquero
2007-10-14 16:28                                         ` Richard Stallman
2007-10-14 22:34                                           ` Juanma Barranquero
2007-10-15 16:03                                             ` Richard Stallman
2007-10-15 16:22                                               ` Juanma Barranquero
2007-10-16  4:10                                                 ` Richard Stallman
2007-10-16  8:15                                                   ` Juanma Barranquero
2007-10-17  5:02                                                     ` Richard Stallman
2007-10-17 23:39                                                       ` Juanma Barranquero
2007-10-23 19:27                                           ` Davis Herring
2007-10-24  8:32                                             ` Richard Stallman
2007-10-11 16:41                               ` Davis Herring
2007-10-12  2:46                               ` Richard Stallman
2007-10-25 21:24                                 ` David Kastrup
2007-10-28 13:51                                   ` Richard Stallman
2007-10-10 21:03                   ` Richard Stallman
2007-10-10 21:42                     ` Juanma Barranquero
2007-02-05 19:10 ` Richard Stallman
2007-02-05 23:27   ` Juanma Barranquero
2007-02-06 17:09     ` Richard Stallman

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).