From: sokobania@gmail.com
To: help-gnu-emacs@gnu.org
Subject: How to save invisible (lisp) data in a text file
Date: Thu, 21 Aug 2014 07:04:22 -0700 (PDT) [thread overview]
Message-ID: <feb3d54f-24f4-4979-b84a-a7ca1d2df26f@googlegroups.com> (raw)
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(
next reply other threads:[~2014-08-21 14:04 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-21 14:04 sokobania [this message]
2014-08-21 18:28 ` How to save invisible (lisp) data in a text file 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
[not found] <mailman.185.1408636859.24723.help-gnu-emacs@gnu.org>
2014-08-21 16:38 ` Buchs, Kevin J.
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=feb3d54f-24f4-4979-b84a-a7ca1d2df26f@googlegroups.com \
--to=sokobania@gmail.com \
--cc=help-gnu-emacs@gnu.org \
/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.
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.