From: Jean Louis <bugs@gnu.support>
To: Visuwesh <visuweshm@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: How to persist registers across sessions?
Date: Thu, 30 Jun 2022 15:50:36 +0300 [thread overview]
Message-ID: <Yr2cHPXg79QaXW8Q@protected.localdomain> (raw)
In-Reply-To: <871qv7a3ey.fsf@gmail.com>
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/
next prev parent reply other threads:[~2022-06-30 12:50 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-27 3:24 How to persist registers across sessions? Pankaj Jangid
2022-06-27 12:01 ` Michael Heerdegen
2022-06-28 18:03 ` Jean Louis
2022-06-29 15:35 ` Visuwesh
2022-06-30 12:50 ` Jean Louis [this message]
2022-06-30 13:55 ` Michael Heerdegen
2022-06-30 14:00 ` Eli Zaretskii
2022-06-30 14:23 ` Michael Heerdegen
2022-06-30 15:50 ` Eli Zaretskii
2022-06-30 14:33 ` Jean Louis
2022-06-30 16:01 ` Eli Zaretskii
2022-06-30 21:55 ` Jean Louis
2022-07-01 6:02 ` Eli Zaretskii
2022-07-01 7:03 ` Jean Louis
2022-07-01 7:19 ` Eli Zaretskii
2022-07-01 12:27 ` Jean Louis
2022-07-02 5:54 ` Eli Zaretskii
2022-07-02 8:46 ` Jean Louis
2022-07-02 9:04 ` Eli Zaretskii
2022-07-02 17:19 ` Jean Louis
2022-07-02 17:40 ` Eli Zaretskii
2022-07-02 18:03 ` Jean Louis
2022-07-02 18:42 ` Eli Zaretskii
2022-07-02 18:52 ` Jean Louis
2022-07-03 5:02 ` Eli Zaretskii
2022-07-01 14:29 ` Stefan Monnier via Users list for the GNU Emacs text editor
2022-07-01 16:07 ` [External] : " Drew Adams
2022-07-02 11:00 ` Pankaj Jangid
2022-07-02 11:48 ` Eli Zaretskii
2022-07-04 3:26 ` Pankaj Jangid
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=Yr2cHPXg79QaXW8Q@protected.localdomain \
--to=bugs@gnu.support \
--cc=help-gnu-emacs@gnu.org \
--cc=visuweshm@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.
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).