[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: How to persist registers across sessions?
From: |
Jean Louis |
Subject: |
Re: How to persist registers across sessions? |
Date: |
Thu, 30 Jun 2022 15:50:36 +0300 |
User-agent: |
Mutt/+ () (2022-05-21) |
If somebody tells me how to `read' window configuration then I can
provide function to save and load it.
However, I do not know how to save/read #<window-configuration> as
object
It looks like this:
(current-window-configuration) ⇒ #<window-configuration>
That is not enough data.
For example in my window configuration I have 2 windows, but data I
get from register is just this:
(get-register (read-key "Key: ")) ⇒ (#<window-configuration> #<marker at 1921
in *helm-system-packages-eshell*>)
Data shows only one window buffer, not the other one, while I have
saved window configuration of two buffers.
How do I get full data of window configuration?
Manual says:
============
,----
| 2.5.6 Window Configuration Type
| -------------------------------
|
| A “window configuration” stores information about the positions, sizes,
| and contents of the windows in a frame, so you can recreate the same
| arrangement of windows later.
|
| Window configurations do not have a read syntax; their print syntax
| looks like ‘#<window-configuration>’. *Note Window Configurations::,
| for a description of several functions related to window configurations.
`----
And I am worried if it does not have "read syntax" then how do I save
it and load it? Is that some data so internal that user cannot access
it?
More from manual:
=================
,----
| Other primitives to look inside of window configurations would make
| sense, but are not implemented because we did not need them. See the
| file ‘winner.el’ for some more operations on windows configurations.
`----
So you did not need them, alright, but some people obviously would
need them. If it would make sense then people will need it. Subjective
anonymous comments do not really belong to professional Emacs Lisp
manual.
Anyway this function is key to reading and saving window configuration, but I
do not know how to access the window configuration.
(window-state-get (get-register (read-key "Key: ")))
Error I get is:
===============
window-state-get: (#<window-configuration> #<marker at 538029 in file.org>) is
not a live or internal window
Function description:
The objects returned by ‘current-window-configuration’ die together
with the Emacs process. In order to store a window configuration on
disk and read it back in another Emacs session, you can use the
functions described next. These functions are also useful to clone the
state of a frame into an arbitrary live window
(‘set-window-configuration’ effectively clones the windows of a frame
into the root window of that very frame only).
-- Function: window-state-get &optional window writable
This function returns the state of WINDOW as a Lisp object. The
argument WINDOW must be a valid window and defaults to the root
window of the selected frame.
If the optional argument WRITABLE is non-‘nil’, this means to not
use markers for sampling positions like ‘window-point’ or
‘window-start’. This argument should be non-‘nil’ when the state
will be written to disk and read back in another session.
Together, the argument WRITABLE and the variable
‘window-persistent-parameters’ specify which window parameters are
saved by this function. *Note Window Parameters::.
If somebody can help me get the Lisp object for window
configuration from register then it will be easy to save it.
--
Jean
Take action in Free Software Foundation campaigns:
https://www.fsf.org/campaigns
In support of Richard M. Stallman
https://stallmansupport.org/