diff options
| author | Daiki Ueno | 2011-06-30 18:45:44 +0900 |
|---|---|---|
| committer | Daiki Ueno | 2011-06-30 18:45:44 +0900 |
| commit | 8a8cdb1992dc18d94a683753f57d47df5b1b54cc (patch) | |
| tree | 699e300301a43c7f681f94fc8eb60df530e62fd4 /lisp | |
| parent | c302199d28c76164a7a3606295718bcf2b475cba (diff) | |
| download | emacs-8a8cdb1992dc18d94a683753f57d47df5b1b54cc.tar.gz emacs-8a8cdb1992dc18d94a683753f57d47df5b1b54cc.zip | |
Add plstore-revert, hide buffer from user.
* plstore.el (plstore-revert): New function.
(plstore-open): Use it; hide the buffer from user.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/gnus/ChangeLog | 5 | ||||
| -rw-r--r-- | 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 @@ | |||
| 1 | 2011-06-30 Daiki Ueno <ueno@unixuser.org> | 1 | 2011-06-30 Daiki Ueno <ueno@unixuser.org> |
| 2 | 2 | ||
| 3 | * plstore.el (plstore-revert): New function. | ||
| 4 | (plstore-open): Use it; hide the buffer from user. | ||
| 5 | |||
| 6 | 2011-06-30 Daiki Ueno <ueno@unixuser.org> | ||
| 7 | |||
| 3 | * auth-source.el (auth-source-backend): New member "arg". | 8 | * auth-source.el (auth-source-backend): New member "arg". |
| 4 | (auth-source-backend-parse): Handle new backend 'plstore. | 9 | (auth-source-backend-parse): Handle new backend 'plstore. |
| 5 | * plstore.el: New file. | 10 | * 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 @@ | |||
| 117 | nil ;secret plist (plist) | 117 | nil ;secret plist (plist) |
| 118 | nil ;merged plist (plist) | 118 | nil ;merged plist (plist) |
| 119 | ))) | 119 | ))) |
| 120 | (with-current-buffer (plstore--get-buffer store) | 120 | (plstore-revert store) |
| 121 | (goto-char (point-min)) | ||
| 122 | (when (looking-at ";;; public entries\n") | ||
| 123 | (forward-line) | ||
| 124 | (plstore--set-alist store (read (point-marker))) | ||
| 125 | (forward-sexp) | ||
| 126 | (forward-char) | ||
| 127 | (when (looking-at ";;; secret entries\n") | ||
| 128 | (forward-line) | ||
| 129 | (plstore--set-encrypted-data store (read (point-marker)))) | ||
| 130 | (plstore--merge-secret store))) | ||
| 131 | store)) | 121 | store)) |
| 132 | 122 | ||
| 123 | (defun plstore-revert (plstore) | ||
| 124 | "Replace current data in PLSTORE with the file on disk." | ||
| 125 | (with-current-buffer (plstore--get-buffer plstore) | ||
| 126 | ;; make the buffer invisible from user | ||
| 127 | (rename-buffer (format " plstore %s" (buffer-file-name))) | ||
| 128 | (goto-char (point-min)) | ||
| 129 | (when (looking-at ";;; public entries\n") | ||
| 130 | (forward-line) | ||
| 131 | (plstore--set-alist plstore (read (point-marker))) | ||
| 132 | (forward-sexp) | ||
| 133 | (forward-char) | ||
| 134 | (when (looking-at ";;; secret entries\n") | ||
| 135 | (forward-line) | ||
| 136 | (plstore--set-encrypted-data plstore (read (point-marker)))) | ||
| 137 | (plstore--merge-secret plstore)))) | ||
| 138 | |||
| 133 | (defun plstore-close (plstore) | 139 | (defun plstore-close (plstore) |
| 134 | "Destroy a plstore instance PLSTORE." | 140 | "Destroy a plstore instance PLSTORE." |
| 135 | (kill-buffer (plstore--get-buffer plstore))) | 141 | (kill-buffer (plstore--get-buffer plstore))) |