From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Juanma Barranquero" Newsgroups: gmane.emacs.devel Subject: Re: unload-feature questions and thoughts Date: Wed, 10 Oct 2007 13:04:23 +0200 Message-ID: References: <85bqk9db9a.fsf@lola.goethe.zz> <851wl5d9b2.fsf@lola.goethe.zz> <86r6t5qdbo.fsf@lola.quinscape.zz> <861wl5q7al.fsf@lola.quinscape.zz> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1192014279 14949 80.91.229.12 (10 Oct 2007 11:04:39 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Wed, 10 Oct 2007 11:04:39 +0000 (UTC) To: "Emacs Devel" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Oct 10 13:04:36 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IfZMi-0004TK-F9 for ged-emacs-devel@m.gmane.org; Wed, 10 Oct 2007 13:04:36 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IfZMc-0001je-90 for ged-emacs-devel@m.gmane.org; Wed, 10 Oct 2007 07:04:30 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IfZMZ-0001jG-3s for emacs-devel@gnu.org; Wed, 10 Oct 2007 07:04:27 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IfZMW-0001il-Q4 for emacs-devel@gnu.org; Wed, 10 Oct 2007 07:04:25 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IfZMW-0001ii-IS for emacs-devel@gnu.org; Wed, 10 Oct 2007 07:04:24 -0400 Original-Received: from wx-out-0506.google.com ([66.249.82.230]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IfZMW-0001n5-2C for emacs-devel@gnu.org; Wed, 10 Oct 2007 07:04:24 -0400 Original-Received: by wx-out-0506.google.com with SMTP id s7so156939wxc for ; Wed, 10 Oct 2007 04:04:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=kEtj3mbenj0flHGO64xnGw5tFYe8rWD5q9Q+dSE8akU=; b=GskU9oIIQ/JiKx4xYwtf95WqEeJpeZV5fRTo/OmPnT1UUMlaRxb6xaslohHJUhdsr29W+BLW7+lHpDYv0hyurjjX2VapJj54VpptOgaPLvqu07UT46QxaJkJ2wPX7vbrGqlE6v883BG+ObFtS7IODJw2keaue4K5zBVbDqMf66w= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=cSQnZN8HPLRX9T9x26SrbzNDuvkyBIDd+6Xha6vYM8PAsd62/BJ9q8y4ee3E0lBjJkTMdjIUgV8oKm2HWFgJ4WHIS4SchhHWiABKMcTXPvfF4Un+/mSEqEyUxKdMG0Og5Xrb4PmfTd+rOPNaxd/ky7WcBGaTG30PT9Am+7ryX5o= Original-Received: by 10.90.34.9 with SMTP id h9mr906492agh.1192014263084; Wed, 10 Oct 2007 04:04:23 -0700 (PDT) Original-Received: by 10.90.103.8 with HTTP; Wed, 10 Oct 2007 04:04:23 -0700 (PDT) In-Reply-To: Content-Disposition: inline X-Detected-Kernel: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:80501 Archived-At: On 2/5/07, Juanma Barranquero wrote: > I misread the code (I was much more centered in the part about undoing > defun, provide, etc. and didn't take a closer look to the beginning of > the function), but I think this piece of docstring is a bit confusing > > This function tries to undo modifications made by the package to > hooks. Packages may define a hook FEATURE-unload-hook that is called > instead of the normal heuristics for doing this. Such a hook should > undo all the relevant global state changes that may have been made by > loading the package or executing functions in it. > > because if you miss the "to hooks" (two words), as I did in several > readings, it seems like it is saying that either you define > FEATURE-unload-hook, or else it uses "the normal heuristics". Eight months later, I had forgotten this thread and I *again* misread both the code and the docstring. :( So, could someone with good English skills please reword unload-feature's docstring to clarify what it does and what purpose FEATURE-unload-hook does serve? Related to this: I'm still unsatisfied with FEATURE-unload-hook. It is not useful enough when you want do undo other kind of changes. For example, currently follow.el can not be correctly unloaded because it uses tons of advices. It is possible to define a follow-unload-hook to undo the advices, but then it has to take care of removing functions from hooks, too. Some packages with a global effect, like server.el or msb.el, run (MODE -1) in the FEATURE-unload-hook to disable the hooks, and then do the additional cleanup; but this is less practical for non-global modes like follow-mode. All in all, I think it'd be useful to have a FEATURE-unload-function which would return t or nil to signal whether it has done everything, or would like for unload-feature to continue with its normal processing. Juanma