all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Drew Adams <drew.adams@oracle.com>
To: Sergey Organov <sorganov@gmail.com>, Eric S Fraga <e.fraga@ucl.ac.uk>
Cc: "emacs-devel@gnu.org" <emacs-devel@gnu.org>
Subject: Re: [ELPA] New package: activities
Date: Sat, 27 Jan 2024 19:20:47 +0000	[thread overview]
Message-ID: <SJ0PR10MB5488A568C17FDF679BFDF706F3782@SJ0PR10MB5488.namprd10.prod.outlook.com> (raw)

Just one comment about desktop.el, FWIW.

I've said this more than once over the
decades, but I'll mention it again since
the question of desktop files being limited
by being directory-based has come up again
in this thread (as only one small part of
this thread).

There's no reason desktop files should be
limited in this way.  You should be able to
have multiple desktop files in a directory.
There's no necessary relation between a
desktop file and any particular directory.

It's a design bug, IMO.

I fixed this long ago, in order to let you
bookmark desktops flexibly.  A trivial fix
lets you load an arbitrary desktop file.

This 2019 post covers this, but there are
likely older posts by me that do the same:

https://lists.gnu.org/archive/html/emacs-devel/2019-09/msg00571.html

Here again is the code that fixes this
design oversight, FWIW:

(defun bmkp-desktop-save (desktop-file)
  "Save current desktop in DESKTOP-FILE."
  (let ((desktop-base-file-name
         (file-name-nondirectory desktop-file))
        (desk-dir
         (file-name-directory desktop-file))
        (desktop-restore-eager  t)) ; Don't bother w/ lazy.
    (desktop-save desk-dir 'RELEASE 'AUTOSAVE)))

;; Derived from code in `desktop-read'.
;;
 (defun bmkp-desktop-read (file)
  "Load desktop-file FILE, then run `desktop-after-read-hook'.
Return t if FILE was loaded, nil otherwise."
  (interactive)
  (when (file-directory-p file)
    (error "`%s' is a directory, not a file" file))
  (setq desktop-dirname  (file-name-directory file))
  (if (not (file-readable-p file))
      nil ; Return nil: not loaded.
    (let ((desktop-restore-eager      t) ; Don't bother w/ lazy.
          (desktop-first-buffer       nil)
          (desktop-buffer-ok-count    0)
          (desktop-buffer-fail-count  0)
          ;; Prevent desktop-saving for eval of desktop buffer.
          (desktop-save               nil))
      (desktop-lazy-abort)
      (load file t t t)
      (setq desktop-file-modtime (nth 5 (file-attributes file)))
      (mapc 'bury-buffer
            (nreverse (cdr (memq desktop-first-buffer
                                 (nreverse (buffer-list))))))
      (switch-to-buffer (car (buffer-list)))
      (run-hooks 'desktop-delay-hook)
      (setq desktop-delay-hook  ())
      (run-hooks 'desktop-after-read-hook)
      (message "Desktop: %d buffer%s restored%s%s."
               desktop-buffer-ok-count
               (if (= 1 desktop-buffer-ok-count) "" "s")
               (if (< 0 desktop-buffer-fail-count)
                   (format ", %d failed to restore"
                           desktop-buffer-fail-count)
                 "")
               (if desktop-buffer-args-list
                   (format ", %d to be restored lazily"
                           (length desktop-buffer-args-list))
                 ""))
      t))) ; Return t: successfully loaded.



             reply	other threads:[~2024-01-27 19:20 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-27 19:20 Drew Adams [this message]
  -- strict thread matches above, loose matches on Subject: below --
2024-02-01  5:33 [ELPA] New package: activities Joseph Turner
2024-01-26  0:59 Adam Porter
2024-01-26  7:33 ` Philip Kaludercic
2024-01-26 10:36   ` Adam Porter
2024-01-29 19:50     ` Adam Porter
2024-01-30  7:16       ` Philip Kaludercic
2024-01-30  7:43         ` Adam Porter
2024-01-26  7:45 ` Eli Zaretskii
2024-01-26 10:42   ` Adam Porter
2024-01-26 12:32     ` Eli Zaretskii
2024-01-26 21:59       ` Adam Porter
2024-01-27  7:08         ` Eli Zaretskii
2024-01-27  8:46           ` Adam Porter
2024-01-27 14:53             ` Eric S Fraga
2024-01-27 15:32               ` Eli Zaretskii
2024-01-27 16:14               ` Sergey Organov
2024-01-28 11:25                 ` Eric S Fraga
2024-01-29 10:45                   ` Sergey Organov
2024-01-29 13:03                     ` Philip Kaludercic
2024-01-29 22:23                       ` Sergey Organov
2024-01-29 15:29                     ` Fraga, Eric
2024-01-26  8:25 ` Eshel Yaron
2024-01-26 10:48   ` Adam Porter
2024-01-29 21:48 ` JD Smith
2024-01-30  0:08   ` Chris Van Dusen
2024-01-30  0:24     ` Adam Porter
2024-02-01  3:49       ` Richard Stallman
2024-01-30  2:50     ` JD Smith

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

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

  git send-email \
    --in-reply-to=SJ0PR10MB5488A568C17FDF679BFDF706F3782@SJ0PR10MB5488.namprd10.prod.outlook.com \
    --to=drew.adams@oracle.com \
    --cc=e.fraga@ucl.ac.uk \
    --cc=emacs-devel@gnu.org \
    --cc=sorganov@gmail.com \
    /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 external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.