From: ueno Date: Thu, 25 Apr 2002 16:32:43 +0000 (+0000) Subject: * lsdb.el (lsdb-hash-table-is-dirty): New variable. X-Git-Tag: lsdb-0_1~19 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b42bf108994c8aa3e3d18661180e18c569b53ec9;p=elisp%2Flsdb.git * lsdb.el (lsdb-hash-table-is-dirty): New variable. (lsdb-gnus-offer-save): Use it. --- diff --git a/lsdb.el b/lsdb.el index 18fe3dd..3521ca1 100644 --- a/lsdb.el +++ b/lsdb.el @@ -148,6 +148,9 @@ where the last element is optional." (defvar lsdb-buffer-name "*LSDB*" "Buffer name to display LSDB record.") +(defvar lsdb-hash-table-is-dirty nil + "Flag to indicate whether the hash table needs to be saved.") + ;;;_. Hash Table Emulation (if (fboundp 'make-hash-table) (progn @@ -304,13 +307,16 @@ This is the current number of slots in HASH-TABLE, whether occupied or not." (let ((old (lsdb-gethash (nth 1 sender) lsdb-hash-table)) (new (cons (cons 'net (list (car sender))) interesting)) + merged record) (unless old (setq new (cons (cons 'creation-date (format-time-string "%Y-%m-%d")) new))) - (setq record (cons (nth 1 sender) - (lsdb-merge-record-entries old new))) - (lsdb-puthash (car record) (cdr record) lsdb-hash-table) + (setq merged (lsdb-merge-record-entries old new) + record (cons (nth 1 sender) merged)) + (unless (equal merged old) + (lsdb-puthash (car record) (cdr record) lsdb-hash-table) + (setq lsdb-hash-table-is-dirty t)) record)) (defun lsdb-update-records (entity) @@ -492,7 +498,8 @@ This is the current number of slots in HASH-TABLE, whether occupied or not." (lsdb-display-record (car records))))) (defun lsdb-gnus-offer-save () - (if (y-or-n-p "Save the LSDB now?") + (if (and lsdb-hash-table-is-dirty + (y-or-n-p "Save the LSDB now?")) (lsdb-save-file lsdb-file lsdb-hash-table))) (provide 'lsdb)