help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to save invisible (lisp) data in a text file


From: lee
Subject: Re: How to save invisible (lisp) data in a text file
Date: Sat, 23 Aug 2014 14:34:04 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4.50 (gnu/linux)

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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]