emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Lisp Api and backward compatibility


From: Drew Adams
Subject: RE: Lisp Api and backward compatibility
Date: Fri, 12 Apr 2019 14:13:04 -0700 (PDT)

> I picked up a task to change `desktop.el` to be able to save/read
> desktops with a name (basically writes the desktop in to a file under a
> given name and later read from it). As you already know the
> `desktop-save` fn for example gets directory name as the first argument
> following by several optional args. So I was thinking to either:
> 
> 1) Add a new optional arg called filename and ask the desktop name from
> user in interactive.
> 
> 2) don't add anything to the function signature and `read-string` it in
> the function body.
> 
> what do you think ?

Thanks for working on this.  Sorely needed, IMO.

I think you should add a separate function (a command
in fact), which accepts the name of a desktop file as
argument.  I think you should not modify `desktop-read'
to make it try to do what you want here.

In Bookmark+ I've already written function (command) 
`bmkp-desktop-read`, which  does what you want.  You can
just use it (renaming it `desktop-read-file' or whatever).
Or you can look to it for inspiration.  Or not.  The code
is derived pretty straightforwardly from `desktop-read'.

It makes use of option `bmkp-desktop-default-directory',
the default directory used when reading the desktop file
name.  You can rename that option.

It uses `bmkp--pop-to-buffer-same-window' which is just
an alias for `pop-to-buffer-same-window'.

No other changes should be needed if you want to use
`bmkp-desktop-read'.

Desktop function (command) `bmkp-desktop-change-dir'
is also defined in the same file.  It could perhaps be
useful for `desktop.el' too.  Here is the doc string:

   Change to desktop saved in DESKTOP-FILE.
   Kill the desktop as specified by variables
   ‘desktop-save-mode’ and  ‘desktop-save’.
   Clear the desktop and load DESKTOP-FILE.

The file is here:

https://www.emacswiki.org/emacs/download/bookmark%2b-1.el



reply via email to

[Prev in Thread] Current Thread [Next in Thread]