From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: Lars Hansen Newsgroups: gmane.emacs.devel Subject: Moving handlers out of desktop.el Date: Tue, 06 Apr 2004 13:47:19 +0200 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <407298C7.4040009@math.ku.dk> NNTP-Posting-Host: deer.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: sea.gmane.org 1081252206 26363 80.91.224.253 (6 Apr 2004 11:50:06 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 6 Apr 2004 11:50:06 +0000 (UTC) Original-X-From: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Tue Apr 06 13:49:53 2004 Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by deer.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 1BAp5V-0002Ow-00 for ; Tue, 06 Apr 2004 13:49:53 +0200 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.35 #1 (Debian)) id 1BAp5V-00033c-00 for ; Tue, 06 Apr 2004 13:49:53 +0200 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BAp4a-0003Pg-0E for emacs-devel@quimby.gnus.org; Tue, 06 Apr 2004 07:48:56 -0400 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.30) id 1BAp3b-0003OS-FR for emacs-devel@gnu.org; Tue, 06 Apr 2004 07:47:55 -0400 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.30) id 1BAp34-0003Gg-2S for emacs-devel@gnu.org; Tue, 06 Apr 2004 07:47:53 -0400 Original-Received: from [213.170.224.162] (helo=smtp.kabelnettet.dk) by monty-python.gnu.org with esmtp (Exim 4.30) id 1BAp33-0003Fs-If for emacs-devel@gnu.org; Tue, 06 Apr 2004 07:47:21 -0400 Original-Received: from math.ku.dk (0x52b410e6.dhcp.kabelnettet.dk [82.180.16.230]) by smtp.kabelnettet.dk (Postfix) with ESMTP id B6250609957 for ; Tue, 6 Apr 2004 13:47:18 +0200 (CEST) User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040123 Debian/1.6-1.he-1 X-Accept-Language: en Original-To: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.4 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:21298 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:21298 For a long time it has annoyed me that desktop.el has pieces of code that really ought not be there. I am talking about the functions `desktop-buffer-dired' `desktop-buffer-rmail' `desktop-buffer-mh' `desktop-buffer-info' that holds code specific to dired, rmail, mh and info respectively, and therefore ought to be in those modules. Not only does it IMHO look messy, it also makes it more likely that one of these modules are changed but desktop.el forgotten. The reason that the functions above are in desktop.el is, I guess, the following: When the desktop module restores a buffer, i calls the functions in `desktop-buffer-handlers' until one returns a buffer. By default desktop-buffer-handlers holds the four functions above together with a more general function `desktop-buffer-file'. If the functions above were moved to the respective modules, these would have to be loaded prior to desktop, and that's not good. The functions in `desktop-buffer-misc-functions' also belong in their respective modules (dired and info), but I think they can be moved without problems since they are called at desktop save. How about this change: 1. Move the functions above to their respective modules and give each an autoload cookie. Also move the two in `desktop-buffer-misc-functions'. 2. Add in desktop.el a new variable `desktop-buffer-mode-handlers' with a default value like (('dired-mode . 'desktop-buffer-dired) ('rmail-mode . 'desktop-buffer-rmail) ('mh-folder-mode 'desktop-buffer-mh) ('Info-mode . 'desktop-buffer-info)) 3. Replace in `desktop-buffer-handlers' the four functions above with a function `desktop-buffer-special-mode' looking in the alist above for a handler. What do you think about this? Lars