[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Making TRAMP place nice with desktop-save-mode?
From: |
Thierry Volpiatto |
Subject: |
Re: Making TRAMP place nice with desktop-save-mode? |
Date: |
Thu, 19 Feb 2009 18:53:47 +0100 |
User-agent: |
Gnus/5.110011 (No Gnus v0.11) Emacs/23.0.90 (gnu/linux) |
Michael Albinus <address@hidden> writes:
> Jeremy Zawodny <address@hidden> writes:
>
> Hi,
>
>> Has anyone hacked up something so that desktop-save-mode can save TRAMP
>> buffers as well as emacs remembers local files I was editing?
>
> I don't use desktop-save-mode. However, the customer option
> desktop-files-not-to-save looks promising:
>
> ;; Skip tramp and ange-ftp files
> (defcustom desktop-files-not-to-save
> "^/[^/:]*:"
> "Regexp identifying files whose buffers are to be excluded from saving."
> :type 'regexp
> :group 'desktop)
This never worked for me, desktop keep saving tramp buffer even with
that.
So i wrote this code:
,----
| (defun tv-list-tramp-buffer-file-name ()
| (let* ((desktop-info-list (mapcar #'desktop-buffer-info (buffer-list)))
| (tramp-buf-list (loop for i in desktop-info-list
| if (and (listp i)
| (stringp (car (nth 8 i)))
| (string-match
"^/su:.*\\|^/sudo:.*\\|^/ssh:.*" (car (nth 8 i))))
| collect (nth 2 i))))
| tramp-buf-list))
|
| (add-hook 'desktop-save-hook #'(lambda ()
| (let ((del-buf-list
| (tv-list-tramp-buffer-file-name)))
| (dolist (i del-buf-list)
| (kill-buffer i)))))
`----
It work fine here.
--
A + Thierry Volpiatto
Location: Saint-Cyr-Sur-Mer - France