all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* How to save invisible (lisp) data in a text file
@ 2014-08-21 14:04 sokobania
  2014-08-21 18:28 ` Stefan Monnier
                   ` (3 more replies)
  0 siblings, 4 replies; 10+ messages in thread
From: sokobania @ 2014-08-21 14:04 UTC (permalink / raw)
  To: help-gnu-emacs

I would like to do the following:
- display some normal text in a buffer with some major
  mode named "my-special-mode"
- let the user interact with the buffer contents
- store in ram some lisp data generated by the user interaction
  (like marks and extra text not displayed in the buffer)
- store the normal text AND this extra data in a file

Then, when reopening the file, emacs would:
- display the normal text in a buffer with "my-special-mode"
- reinstall in ram the lisp data associated to the file

Is this possible with emacs?

Oops... As the answer to "Is this possible with emacs?"
is always "yes", I would rather ask:

Is there a simple way (functions, mode, package...) to do that?
Are there any (simple) emacs-lisp examples of such a thing?

At the moment, the solution I was thinking of
would be to use file variables.
The major mode "my-special-mode" would:
- delete the last lines of the buffer when invoked
- add a hook to save-file to write the extra data at the end
of the file in a few lines like:

<my-special-mode-delimiter>
Local Variables:
mode: my-special-mode
my-special-mode-data: '(all I need to save to rebuild the data)
End:

It seems rather simple. Is it correct/standard?
Is there any mode which does something similar?
(write data into the "Local Variables:" section)

)jack(


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2014-09-02  1:56 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <mailman.185.1408636859.24723.help-gnu-emacs@gnu.org>
2014-08-21 16:33 ` Sending a region to another X application Buchs, Kevin J.
2014-08-21 16:38 ` How to save invisible (lisp) data in a text file Buchs, Kevin J.
2014-08-21 14:04 sokobania
2014-08-21 18:28 ` Stefan Monnier
2014-08-22  6:13 ` Thien-Thi Nguyen
2014-08-23 12:34 ` lee
2014-08-29  9:26 ` sokobania.01
2014-08-29 20:03   ` Stefan Monnier
     [not found]   ` <mailman.7874.1409342719.1147.help-gnu-emacs@gnu.org>
2014-09-01  8:31     ` sokobania.01
2014-09-02  1:56       ` Stefan Monnier

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.