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

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

Re: Auto-saved files unexpectedly deleted


From: Jude DaShiell
Subject: Re: Auto-saved files unexpectedly deleted
Date: Sun, 25 May 2014 10:17:01 -0400 (EDT)

man script for some interesting reading.  Emacs could run that for you 
inside one of its shells and you catch everything that happens and can 
if you like append to existing files.  Afterwards, it may be necessary 
to clean up the output file.

On Sun, 18 May 2014, dont.spam.earl@gmail.com wrote:

> On Thursday, May 15, 2014 10:32:36 PM UTC-7, Kevin Rodgers wrote:
> > On 5/15/14 11:40 AM, dont.spam.earl@gmail.com wrote:
> > 
> > > On Thursday, May 15, 2014 2:55:21 AM UTC-7, Michael Heerdegen wrote:
> > 
> > >> dont.spam.earl@gmail.com writes:
> > 
> > >>> I'd like to save "transcripts" of my Shell and other comint sessions
> > 
> > >>> with all I/O, not just the command history. I've created a "comint
> > 
> > >>> transcript" major-mode by adapting auto-saving but I'm running into a
> > 
> > >>> problem.
> > 
> > >>
> > 
> > >> I think it would be better not to hack into auto-save-mode.  Why don't
> > 
> > >> you just save the buffer contents to your own file, e.g. using
> > 
> > >> `write-region'?
> > 
> > >
> > 
> > > Yes, I'll admit that occurred to me ;) ...especially when I saw that it's 
> > > part of files.el and not factored out.
> > 
> > >
> > 
> > > I'm reluctant though because I want to do auto-saving of these buffers 
> > > and I don't want to reimplement and maintain a lot of the auto-save 
> > > functionality.
> > 
> > 
> > 
> > I'd start with something minimal, like:
> > 
> > 
> > 
> > (defun set-comint-buffer-file-name ()
> > 
> >    "Set `buffer-file-name' so that input and output are saved.
> > 
> > Also set `buffer-offer-save', but assume that `auto-save-default' is 
> > non-nil."
> > 
> >    (setq buffer-file-name
> > 
> >     (format "~/.emacs_comint_%d.txt"
> > 
> >             ;; TO DO: handle `network' and `serial' process-type, in
> > 
> >             ;; addition to `real'.
> > 
> >             (process-id (get-buffer-process (current-buffer)))))
> > 
> >    (setq buffer-offer-save t))              ; just in case
> > 
> > 
> > 
> > (add-hook 'comint-exec-hook 'set-comint-buffer-file-name)
> > 
> > 
> > 
> > -- 
> > 
> > Kevin Rodgers
> > 
> > Denver, Colorado, USA
> 
> Yes, that's a good idea to use 'comint-exec-hook. I hadn't thought of that. 
> Thanks!
> 
> 

jude <jdashiel@shellworld.net>




reply via email to

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