[Top][All Lists]

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

Auto-saved files unexpectedly deleted

From: dont . spam . earl
Subject: Auto-saved files unexpectedly deleted
Date: Wed, 14 May 2014 22:29:33 -0700 (PDT)
User-agent: G2/1.0

Hi all,

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.

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-file-if-necessary in files.el which deletes auto-save files. 
In fact, even though I'm tracing both that function and also delete-file, 
there's no tracing output for the deletion. This only occurs when I "C-x k" to 
kill the buffer, then say "yes" to kill it in spite of the running process. 
Interestingly, the transcript file is not deleted when I quit emacs and kill 
all buffers with processes.

The relevant code is included below. Any suggestions on what is going on here, 
or what to try next?



;; Auto-save Comint mode transcripts

(defadvice auto-save-file-name-p (after yes-auto-save-comint-transcripts 
  "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 
  "Make name for auto-saved comint transcript file (without hashmarks)."
  (setq ad-return-value
        (if (derived-mode-p 'comint-mode)

(defadvice delete-auto-save-file-if-necessary (around 
keep-auto-saved-comint-transcripts activate)
  "Keep auto-saved comint transcript files."
  (unless (derived-mode-p 'comint-mode)

;; Comint mode

(require 'comint)

 '(lambda ()
    (setq buffer-auto-save-file-name (make-comint-transcript-path t))
    (auto-save-mode t)

reply via email to

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