From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Kevin Rodgers Newsgroups: gmane.emacs.help Subject: Re: Auto-saved files unexpectedly deleted Date: Thu, 15 May 2014 23:32:36 -0600 Message-ID: References: <0549e635-f7d7-414a-86af-ae48a8c46630@googlegroups.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1400218410 18129 80.91.229.3 (16 May 2014 05:33:30 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 16 May 2014 05:33:30 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri May 16 07:33:23 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 1WlAll-00076D-84 for geh-help-gnu-emacs@m.gmane.org; Fri, 16 May 2014 07:33:21 +0200 Original-Received: from localhost ([::1]:33451 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WlAlk-0007tY-RO for geh-help-gnu-emacs@m.gmane.org; Fri, 16 May 2014 01:33:20 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:41724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WlAlO-0007ej-1N for help-gnu-emacs@gnu.org; Fri, 16 May 2014 01:33:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WlAlG-0006fJ-D0 for help-gnu-emacs@gnu.org; Fri, 16 May 2014 01:32:57 -0400 Original-Received: from plane.gmane.org ([80.91.229.3]:59374) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WlAlG-0006fD-7o for help-gnu-emacs@gnu.org; Fri, 16 May 2014 01:32:50 -0400 Original-Received: from list by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1WlAlD-0005ll-2m for help-gnu-emacs@gnu.org; Fri, 16 May 2014 07:32:47 +0200 Original-Received: from 75-166-218-138.hlrn.qwest.net ([75.166.218.138]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 16 May 2014 07:32:47 +0200 Original-Received: from kevin.d.rodgers by 75-166-218-138.hlrn.qwest.net with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Fri, 16 May 2014 07:32:47 +0200 X-Injected-Via-Gmane: http://gmane.org/ Original-Lines: 33 Original-X-Complaints-To: usenet@ger.gmane.org X-Gmane-NNTP-Posting-Host: 75-166-218-138.hlrn.qwest.net User-Agent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.4; en-US; rv:1.9.2.28) Gecko/20120306 Thunderbird/3.1.20 In-Reply-To: <0549e635-f7d7-414a-86af-ae48a8c46630@googlegroups.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 80.91.229.3 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:97688 Archived-At: 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