all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: lee <lee@yun.yagibdah.de>
To: help-gnu-emacs@gnu.org
Subject: Re: How to save invisible (lisp) data in a text file
Date: Sat, 23 Aug 2014 14:34:04 +0200	[thread overview]
Message-ID: <87k35zz8oz.fsf@yun.yagibdah.de> (raw)
In-Reply-To: <feb3d54f-24f4-4979-b84a-a7ca1d2df26f@googlegroups.com> (sokobania@gmail.com's message of "Thu, 21 Aug 2014 07:04:22 -0700 (PDT)")

sokobania@gmail.com writes:

> 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?

You can apply information from another buffer to the current
buffer.  I've extended hi-lock-mode to do this, see
https://github.com/lee-/emacs

At least it shows you how it can be done.  To store all information in
one file, I would think about using a save hook which creates a tar
archive from the two files or about using a unique marker line in the
file after which the extra information is stored while limiting the
display to everything above the marker.


-- 
GNU Emacs 24.4.50.2 (x86_64-unknown-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2014-08-17 on yun.yagibdah.de



  parent reply	other threads:[~2014-08-23 12:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-21 14:04 How to save invisible (lisp) data in a text file sokobania
2014-08-21 18:28 ` Stefan Monnier
2014-08-22  6:13 ` Thien-Thi Nguyen
2014-08-23 12:34 ` lee [this message]
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=87k35zz8oz.fsf@yun.yagibdah.de \
    --to=lee@yun.yagibdah.de \
    --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.