- xyzzy Part16
851 :850[sage]:2010/12/04(土) 14:21:39 ID:8f1r+CX2 - sed -e "s/ /\ /g" とかやったら要領制限に引っかかったのでそのまま貼ります
読みにくくてすまぬ (defun get-auto-named-session-file-path () (let ((uc (remove-trail-slash (truename (user-config-path))))) (merge-pathnames (format nil ".xyzzy.resume.~A.ssn" (substitute-string (if (string-match (concat "^" (regexp-quote (si:system-root)) "\\(.*\\)$") uc) (match-string 1) (substitute-string uc ":" "")) "/" ".")) (if (and *default-session-directory* (file-directory-p *default-session-directory*)) *default-session-directory* (user-homedir-pathname))))) (defun save-auto-named-session-on-save-history () (unless ed::*auto-save-session-file* (let ((ssn (get-auto-named-session-file-path))) (when (file-readable-p ssn) (rename-file ssn (concat ssn ".bak") :if-exists :overwrite)) (when (delete-if-not 'get-buffer-file-name (buffer-list)) (save-session ssn t))))) (add-hook '*save-history-hook* 'save-auto-named-session-on-save-history) (defun load-auto-named-session () (interactive) (let ((ssn (get-auto-named-session-file-path))) (when (or (file-readable-p ssn) (file-readable-p (setq ssn (concat ssn ".bak")))) (let (ed::*current-session-file-name*) (load-session ssn)))))
|