From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: sokobania@gmail.com Newsgroups: gmane.emacs.help Subject: How to save invisible (lisp) data in a text file Date: Thu, 21 Aug 2014 07:04:22 -0700 (PDT) Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: ger.gmane.org 1408636287 3163 80.91.229.3 (21 Aug 2014 15:51:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 21 Aug 2014 15:51:27 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Aug 21 17:51:18 2014 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1XKUdn-0006mZ-8A for geh-help-gnu-emacs@m.gmane.org; Thu, 21 Aug 2014 17:51:07 +0200 Original-Received: from localhost ([::1]:32986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XKUdm-0003pT-Uk for geh-help-gnu-emacs@m.gmane.org; Thu, 21 Aug 2014 11:51:06 -0400 X-Received: by 10.42.212.207 with SMTP id gt15mr2533489icb.31.1408629862995; Thu, 21 Aug 2014 07:04:22 -0700 (PDT) X-Received: by 10.140.31.73 with SMTP id e67mr7102qge.30.1408629862851; Thu, 21 Aug 2014 07:04:22 -0700 (PDT) Original-Path: usenet.stanford.edu!r2no4205218igi.0!news-out.google.com!ef6ni5523igb.0!nntp.google.com!i13no1651205qae.1!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Original-Newsgroups: gnu.emacs.help Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=213.39.33.67; posting-account=yPT6-goAAADxVO3zyR19Dno2fjsCIDAc Original-NNTP-Posting-Host: 213.39.33.67 User-Agent: G2/1.0 Injection-Date: Thu, 21 Aug 2014 14:04:22 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:207054 X-Mailman-Approved-At: Thu, 21 Aug 2014 11:50:55 -0400 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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.org@gnu.org Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:99332 Archived-At: 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: 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(