From 03cc6d33588d643061c2c91f336ad57278af5fb4 Mon Sep 17 00:00:00 2001 From: "Tom Breton (Tehom)" Date: Mon, 20 Dec 2010 22:17:58 -0500 Subject: [PATCH] Removed obsolete functions --- persist.el | 135 ------------------------------------------------------------- 1 file changed, 135 deletions(-) diff --git a/persist.el b/persist.el index 99c3dcc..ff48da1 100644 --- a/persist.el +++ b/persist.el @@ -40,84 +40,6 @@ ;;;_ , Internal: -;;;_ . tehom-persist-sync-obj-to-buffer -;;$$OBSOLESCENT. -;;Internal only -(defun tehom-persist-sync-obj-to-buffer (initial-obj &optional type-pred) - "Return the current buffer's data as an object. -If we can't read an object, signal error. -If TYPE-PRED is given and object doesn't satisfy it, signal error. - -Do NOT call this unless you know what you are doing. It must only be -called in a buffer visiting a file meant to store sexps persistently." - - (let - ((obj - (condition-case err - (if - (= (buffer-size) 0) - initial-obj - (progn - (goto-char (point-min)) - (read (current-buffer)))) - (error - (error - "In persist buffer %s, contents could not be read" - (current-buffer)) - '())))) - - (if - (or (null type-pred) (funcall type-pred obj)) - obj - (progn - (error - "In persist buffer %s, object was wrong type" - (current-buffer)) - '())))) - - -;;$$OBSOLESCENT. -(defalias 'tehom-persist-sync-list-to-buffer - 'tehom-persist-sync-obj-to-buffer) - -;;;_ . tehom-persist-sync-file-to-obj - -;;$$OBSOLESCENT. Use `tinydb-persist--write-obj' -;;Internal only -(defun tehom-persist-sync-file-to-obj (obj &optional force-save type-pred) - "Sync to the current buffer and file to OBJ - -Do NOT call this unless you know what you are doing. It will ERASE -the contents of the buffer and write another object into it." - - (unless - (or - (not type-pred) - (funcall type-pred obj)) - (error "Object %s does not satisfy %s" obj type-pred)) - - (let - ((old-str (buffer-string))) - (erase-buffer) - (insert (pp-to-string obj)) - (condition-case err - (progn - (goto-char (point-min)) - (read (current-buffer))) - (error - (erase-buffer) - (insert old-str) - (apply #'signal (car err) (cdr err))))) - - - (when force-save - (let - ((file-precious-flag t)) - ;;Save, forcing backups to exist. - (save-buffer 64)))) - -;;$$OBSOLESCENT. -(defalias 'tehom-persist-sync-file-to-list 'tehom-persist-sync-file-to-obj) ;;;_ . tinydb-persist--write-obj (defun tinydb-persist--write-obj (obj &optional force-save) "" @@ -142,63 +64,6 @@ the contents of the buffer and write another object into it." ((file-precious-flag t)) (save-buffer 64)))) -;;;_ , Macros to use the persisting object - -;;;_ . tehom-persist-buffer-as-const-obj -;;$$OBSOLESCENT. -(defmacro tehom-persist-buffer-as-const-obj - (persist-file var initial-obj type-pred &rest body) - "Treat the password buffer as an immutable object named VAR" - - `(with-current-buffer (find-file-noselect ,persist-file) - (let - ((,var - (tehom-persist-sync-obj-to-buffer ,initial-obj ,type-pred))) - ,@body))) - -;;;_ . tehom-persist-buffer-as-const-list -;;$$OBSOLESCENT. -(defmacro tehom-persist-buffer-as-const-list (persist-file var &rest body) - "Treat the password buffer as an immutable list named VAR" - `(tehom-persist-buffer-as-const-obj - ,persist-file ,var () #'listp ,@body)) - - -;;;_ . tehom-persist-buffer-as-mutable-obj -;;$$OBSOLESCENT. -(defmacro tehom-persist-buffer-as-mutable-obj - (persist-file var initial-obj type-pred &rest body) - "" - ` - (with-current-buffer (find-file-noselect ,persist-file) - (let - ((,var (tehom-persist-sync-obj-to-buffer ,initial-obj ,type-pred))) - (prog1 - (progn ,@body) - (tehom-persist-sync-file-to-obj ,var t ,type-pred))))) - - -;;;_ . tehom-persist-buffer-as-mutable-list - -;;$$OBSOLESCENT. -(defmacro tehom-persist-buffer-as-mutable-list (persist-file var &rest body) - "Treat the file PERSIST-FILE as a mutable object named by the -symbol VAR." - `(tehom-persist-buffer-as-mutable-obj - ,persist-file ,var () #'listp ,@body)) - -;;;_ . tehom-update-persist-buffer - -;;$$OBSOLESCENT. -(defun tehom-update-persist-buffer - (persist-file obj &optional force-save type-pred) - "Assign OBJ to the persisting object in the buffer visiting PERSIST-FILE. -If TYPE-PRED is given, only write OBJ if it satisfies TYPE-PRED, -otherwise signal error." - - (with-current-buffer (find-file-noselect persist-file) - (tehom-persist-sync-file-to-obj obj force-save type-pred))) - ;;;_ , File-buffer instantiation of asynq -- 2.11.4.GIT