Skip to content

Commit

Permalink
Add additional frameset-restore options
Browse files Browse the repository at this point in the history
Add options:
- easysession-frameset-restore-cleanup-frames
- easysession-frameset-restore-reuse-frames
  • Loading branch information
jamescherti committed Oct 18, 2024
1 parent ce85dd1 commit 09389e3
Showing 1 changed file with 39 additions and 3 deletions.
42 changes: 39 additions & 3 deletions easysession.el
Original file line number Diff line number Diff line change
Expand Up @@ -202,11 +202,28 @@ If set to nil, only the buffers will be restored, and frame restoration will be
skipped.
See related options:
- `easysession-frameset-restore-reuse-frames'
- `easysession-frameset-restore-force-display'
- `easysession-frameset-restore-force-onscreen'"
- `easysession-frameset-restore-force-onscreen'
- `easysession-frameset-restore-cleanup-frames'"
:type 'boolean
:group 'easysession)

(defcustom easysession-frameset-restore-reuse-frames t
"Specifies the policy for reusing frames when restoring:
t All existing frames can be reused.
nil No existing frames can be reused.
match Only frames with matching frame IDs can be reused.
PRED A predicate function that receives a live frame as an argument
and returns non-nil to allow reusing it, or nil otherwise.
For more details, see the `frameset-restore' docstring."
:type '(choice (const :tag "Reuse all frames" t)
(const :tag "Reuse no frames" nil)
(const :tag "Reuse frames with matching IDs" match)
(function :tag "Predicate function"))
:group 'easysession)

(defcustom easysession-frameset-restore-force-display t
"Specifies how frames are restored with respect to display:
t Frames are restored on the current display.
Expand Down Expand Up @@ -242,6 +259,25 @@ For more details, see the `frameset-restore' docstring."
(function :tag "Function to determine onscreen status"))
:group 'easysession)

(defcustom easysession-frameset-restore-cleanup-frames t
"Specifies the policy for cleaning up the frame list after restoring.
t Delete all frames that were not created or restored.
nil Retain all frames.
FUNC A function called with two arguments:
- FRAME, a live frame.
- ACTION, which can be one of:
:rejected Frame existed but was not a candidate for reuse.
:ignored Frame existed, was a candidate, but was not reused.
:reused Frame existed, was a candidate, and was reused.
:created Frame did not exist, was created and restored upon.
The return value is ignored.
For more details, see the `frameset-restore' docstring."
:type '(choice (const :tag "Delete all unneeded frames" t)
(const :tag "Retain all frames" nil)
(function :tag "Function to determine cleanup actions"))
:group 'easysession)

(defvar easysession--debug nil)

(defvar easysession--timer nil)
Expand Down Expand Up @@ -601,8 +637,8 @@ When LOAD-GEOMETRY is non-nil, load the frame geometry."
(unless (ignore-errors
(frameset-restore
data
:reuse-frames t
:cleanup-frames t
:reuse-frames easysession-frameset-restore-reuse-frames
:cleanup-frames easysession-frameset-restore-cleanup-frames
:force-display easysession-frameset-restore-force-display
:force-onscreen
(and easysession-frameset-restore-force-onscreen
Expand Down

0 comments on commit 09389e3

Please sign in to comment.