From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Jean Louis Newsgroups: gmane.emacs.help Subject: Re: How to persist registers across sessions? Date: Thu, 30 Jun 2022 15:50:36 +0300 Message-ID: References: <87leti6b6e.fsf@codeisgreat.org> <871qv7a3ey.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="33020"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mutt/+ () (2022-05-21) Cc: help-gnu-emacs@gnu.org To: Visuwesh Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 30 15:06:17 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o6ts9-0008OE-2n for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 30 Jun 2022 15:06:17 +0200 Original-Received: from localhost ([::1]:48252 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o6ts8-000064-4r for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 30 Jun 2022 09:06:16 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:34196) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6toN-0006jn-06 for help-gnu-emacs@gnu.org; Thu, 30 Jun 2022 09:02:23 -0400 Original-Received: from stw1.rcdrun.com ([217.170.207.13]:50657) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o6toA-00069b-JS for help-gnu-emacs@gnu.org; Thu, 30 Jun 2022 09:02:22 -0400 Original-Received: from localhost ([::ffff:102.85.107.83]) (AUTH: PLAIN admin, TLS: TLS1.3,256bits,ECDHE_RSA_AES_256_GCM_SHA384) by stw1.rcdrun.com with ESMTPSA id 0000000000087C4D.0000000062BD9EAE.00001085; Thu, 30 Jun 2022 06:01:33 -0700 Mail-Followup-To: Visuwesh , help-gnu-emacs@gnu.org Content-Disposition: inline In-Reply-To: <871qv7a3ey.fsf@gmail.com> Received-SPF: pass client-ip=217.170.207.13; envelope-from=bugs@gnu.support; helo=stw1.rcdrun.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01, T_SPF_TEMPERROR=0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:138223 Archived-At: 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 # as object It looks like this: (current-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: ")) ⇒ (# #) 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 ‘#’. *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: (# #) 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/