19 Feb 2009 18:53
Re: Making TRAMP place nice with desktop-save-mode?
Thierry Volpiatto <thierry.volpiatto <at> gmail.com>
2009-02-19 17:53:47 GMT
2009-02-19 17:53:47 GMT
Michael Albinus <michael.albinus <at> gmx.de> writes: > Jeremy Zawodny <Jeremy <at> Zawodny.com> 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
RSS Feed