From 8a8cdb1992dc18d94a683753f57d47df5b1b54cc Mon Sep 17 00:00:00 2001 From: Daiki Ueno Date: Thu, 30 Jun 2011 18:45:44 +0900 Subject: [PATCH] Add plstore-revert, hide buffer from user. * plstore.el (plstore-revert): New function. (plstore-open): Use it; hide the buffer from user. --- lisp/gnus/ChangeLog | 5 +++++ lisp/gnus/plstore.el | 28 +++++++++++++++++----------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index 4f31130b2c5..09e3317ec92 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,5 +1,10 @@ 2011-06-30 Daiki Ueno + * plstore.el (plstore-revert): New function. + (plstore-open): Use it; hide the buffer from user. + +2011-06-30 Daiki Ueno + * auth-source.el (auth-source-backend): New member "arg". (auth-source-backend-parse): Handle new backend 'plstore. * plstore.el: New file. diff --git a/lisp/gnus/plstore.el b/lisp/gnus/plstore.el index 3aa3b84fcbc..703943934e8 100644 --- a/lisp/gnus/plstore.el +++ b/lisp/gnus/plstore.el @@ -117,19 +117,25 @@ nil ;secret plist (plist) nil ;merged plist (plist) ))) - (with-current-buffer (plstore--get-buffer store) - (goto-char (point-min)) - (when (looking-at ";;; public entries\n") - (forward-line) - (plstore--set-alist store (read (point-marker))) - (forward-sexp) - (forward-char) - (when (looking-at ";;; secret entries\n") - (forward-line) - (plstore--set-encrypted-data store (read (point-marker)))) - (plstore--merge-secret store))) + (plstore-revert store) store)) +(defun plstore-revert (plstore) + "Replace current data in PLSTORE with the file on disk." + (with-current-buffer (plstore--get-buffer plstore) + ;; make the buffer invisible from user + (rename-buffer (format " plstore %s" (buffer-file-name))) + (goto-char (point-min)) + (when (looking-at ";;; public entries\n") + (forward-line) + (plstore--set-alist plstore (read (point-marker))) + (forward-sexp) + (forward-char) + (when (looking-at ";;; secret entries\n") + (forward-line) + (plstore--set-encrypted-data plstore (read (point-marker)))) + (plstore--merge-secret plstore)))) + (defun plstore-close (plstore) "Destroy a plstore instance PLSTORE." (kill-buffer (plstore--get-buffer plstore))) -- 2.11.4.GIT