From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: dont.spam.earl@gmail.com Newsgroups: gmane.emacs.help Subject: Auto-saved files unexpectedly deleted Date: Wed, 14 May 2014 22:29:33 -0700 (PDT) Message-ID: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1400132192 24336 80.91.229.3 (15 May 2014 05:36:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 15 May 2014 05:36:32 +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 May 15 07:36:31 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 1WkoLE-0002bA-9Q for geh-help-gnu-emacs@m.gmane.org; Thu, 15 May 2014 07:36:28 +0200 Original-Received: from localhost ([::1]:55724 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WkoLD-0000pQ-Rx for geh-help-gnu-emacs@m.gmane.org; Thu, 15 May 2014 01:36:27 -0400 X-Received: by 10.43.141.196 with SMTP id jf4mr3736895icc.9.1400131774237; Wed, 14 May 2014 22:29:34 -0700 (PDT) X-Received: by 10.50.43.135 with SMTP id w7mr247168igl.1.1400131774160; Wed, 14 May 2014 22:29:34 -0700 (PDT) Original-Path: usenet.stanford.edu!c1no7001399igq.0!news-out.google.com!qf4ni926igc.0!nntp.google.com!c1no7001393igq.0!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=2602:306:cdd1:1270:c199:afe5:e7ad:d059; posting-account=QyAvTQoAAADtRdvZ5VbKTpUdY2nZ1GFk Original-NNTP-Posting-Host: 2602:306:cdd1:1270:c199:afe5:e7ad:d059 User-Agent: G2/1.0 Injection-Date: Thu, 15 May 2014 05:29:34 +0000 Original-Xref: usenet.stanford.edu gnu.emacs.help:205394 X-Mailman-Approved-At: Thu, 15 May 2014 01:35:46 -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:97660 Archived-At: Hi all, I'd like to save "transcripts" of my Shell and other comint sessions with a= ll I/O, not just the command history. I've created a "comint transcript" ma= jor-mode by adapting auto-saving but I'm running into a problem. When I kill a comint buffer with a process, its associated transcript file = is deleted. This occurs even though I'm around-wrapping 'delete-auto-save-f= ile-if-necessary in files.el which deletes auto-save files. In fact, even t= hough I'm tracing both that function and also delete-file, there's no traci= ng output for the deletion. This only occurs when I "C-x k" to kill the buf= fer, then say "yes" to kill it in spite of the running process. Interesting= ly, the transcript file is not deleted when I quit emacs and kill all buffe= rs with processes. The relevant code is included below. Any suggestions on what is going on he= re, or what to try next? Thanks! Earl ;; ;; Auto-save Comint mode transcripts ;; (defadvice auto-save-file-name-p (after yes-auto-save-comint-transcripts ac= tivate) "Also auto-save comint transcript files (without hashmarks)." (setq ad-return-value (or ad-return-value (derived-mode-p 'comint-mode)))) (defadvice make-auto-save-file-name (after auto-save-comint-transcript-path= activate) "Make name for auto-saved comint transcript file (without hashmarks)." (setq ad-return-value (if (derived-mode-p 'comint-mode) buffer-auto-save-file-name ad-return-value))) (defadvice delete-auto-save-file-if-necessary (around keep-auto-saved-comin= t-transcripts activate) "Keep auto-saved comint transcript files." (unless (derived-mode-p 'comint-mode) ad-do-it)) ;; ;; Comint mode ;; (require 'comint) (add-hook 'comint-mode-hook '(lambda () (setq buffer-auto-save-file-name (make-comint-transcript-path t)) (auto-save-mode t) ))