unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Juri Linkov <juri@jurta.org>
Cc: emacs-devel@gnu.org
Subject: Re: Moving handlers out of desktop.el
Date: Tue, 13 Apr 2004 18:12:36 +0300	[thread overview]
Message-ID: <877jwjsyhn.fsf@mail.jurta.org> (raw)
In-Reply-To: <407BE4BD.4010308@math.ku.dk> (Lars Hansen's message of "Tue, 13 Apr 2004 15:01:49 +0200")

Lars Hansen <larsh@math.ku.dk> writes:
> My question is: Why should `desktop-buffer-foo' be placed _outside_
> desktop.el but the handlers for dired, rmail, mh and info _inside_
> desktop.el?

I believe the question whether to place these functions into a service
module or a client module is mostly a matter of taste.  The desktop
package at least currently consistently uses the former approach,
placing all mode handling functions in desktop.el.

But there are Emacs packages which are inconsistent in this question.
For example, why the speedbar package has the code for Info support
in info.el, but speedbar support for dired in speedbar.el?

>>Making general functions (with an autoload cookie) from them would be
>>good.  Such functions could have general arguments and be useful
>>for other purposes as well.
>>  
> I don't think I understand what kind of functions you mean.

For example, as you already noted, `desktop-buffer-dired' restores
subdirectories by inserting them in the dired buffer.  Instead
of the following code in desktop.el:

      (let* ((dired-dir (car desktop-buffer-misc))
	     (dir (if (consp dired-dir) (car dired-dir) dired-dir)))
	(if (file-directory-p (file-name-directory dir))
	    (progn
	      (dired dired-dir)
	      (mapcar 'dired-maybe-insert-subdir (cdr desktop-buffer-misc))
	      (current-buffer))
	  (message "Directory %s no longer exists." dir)
	  (sit-for 1)
	  'ignored))

it would be better to add a new argument SUBDIRECTORIES
to the `dired' function:

(dired DIRNAME &optional SWITCHES SUBDIRECTORIES)

and call from desktop.el only one dired function:

      (let* ((dired-dir (car desktop-buffer-misc))
	     (dir (if (consp dired-dir) (car dired-dir) dired-dir)))
	(dired dir nil (cdr desktop-buffer-misc)))

And the `(message "Directory %s no longer exists." dir)' is not needed
in desktop.el, because the function `dired' already raises an error.
Only desktop.el should have the code to catch this error and continue
to restore the rest of the desktop file.

So, I think the code for getting saved parameters from the desktop file
(like parsing the `desktop-buffer-misc' data) should belong to desktop.el.
And some code of desktop.el should be generalized and placed into
respective packages.

-- 
Juri Linkov
http://www.jurta.org/emacs/

  reply	other threads:[~2004-04-13 15:12 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-06 11:47 Moving handlers out of desktop.el Lars Hansen
2004-04-08  9:43 ` Juri Linkov
2004-04-10 21:31   ` Lars Hansen
2004-04-10 22:32     ` Juri Linkov
2004-04-11  8:04       ` Lars Hansen
2004-04-11  8:16         ` Lars Hansen
2004-04-13 11:48 ` Juri Linkov
2004-04-13 12:51   ` Stefan Monnier
2004-04-13 13:01   ` Lars Hansen
2004-04-13 15:12     ` Juri Linkov [this message]
2004-04-13 20:46       ` Juri Linkov
2004-04-21 21:28         ` Lars Hansen
2004-04-13 13:05   ` David Kastrup
2004-04-13 15:15     ` Juri Linkov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=877jwjsyhn.fsf@mail.jurta.org \
    --to=juri@jurta.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).