unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Sameer Rahmani <lxsameer@gnu.org>, Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: RE: Lisp Api and backward compatibility
Date: Fri, 12 Apr 2019 14:13:04 -0700 (PDT)	[thread overview]
Message-ID: <35f09611-dd35-48a2-942b-a5955671037e@default> (raw)
In-Reply-To: <ebf99eee-85a6-f09e-b208-5cfe75885e66@gnu.org>

> 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



  parent reply	other threads:[~2019-04-12 21:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-12 20:09 Lisp Api and backward compatibility Sameer Rahmani
2019-04-12 20:20 ` Eli Zaretskii
2019-04-12 20:28   ` Sameer Rahmani
2019-04-12 20:38     ` Eli Zaretskii
2019-04-12 21:13     ` Drew Adams [this message]
2019-04-14  1:18 ` Richard Stallman

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=35f09611-dd35-48a2-942b-a5955671037e@default \
    --to=drew.adams@oracle.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=lxsameer@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).