Skip to content

Commit

Permalink
no yes-no
Browse files Browse the repository at this point in the history
  • Loading branch information
ncaq committed Nov 2, 2013
1 parent fe92176 commit c5ab8c3
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions profile.d/20_close.el
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,22 @@
(require 'undohist);;undoをファイル閉じても保存
(setq undohist-directory "~/.undohist/")
(undohist-initialize)

(defun undohist-recover ()
"Recover undo history."
(interactive)
(let ((buffer (current-buffer))
(file (make-undohist-file-name (buffer-file-name)))
undo-list)
(if (not (file-exists-p file))
'(message "Undo history file doesn't exists.")
(when (null buffer-undo-list)
(with-temp-buffer
(insert-file-contents file)
(goto-char (point-min))
(let ((alist (undohist-decode (read (current-buffer)))))
(if (string= (md5 buffer) (assoc-default 'digest alist))
(setq undo-list (assoc-default 'undo-list alist))
(message "File digest doesn't match, so undo history will be discarded."))))
(if (consp undo-list)
(setq buffer-undo-list undo-list))))))
Binary file modified profile.d/20_close.elc
Binary file not shown.

0 comments on commit c5ab8c3

Please sign in to comment.