From: ueno Date: Sun, 25 Aug 2002 05:38:06 +0000 (+0000) Subject: (lsdb-read) [Emacs]: Don't copy the entire contents of original buffer. X-Git-Tag: lsdb-0_8 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7b0b1e1d61ee90ff389a32896841bb84ad0ca7bc;p=elisp%2Flsdb.git (lsdb-read) [Emacs]: Don't copy the entire contents of original buffer. --- diff --git a/lsdb.el b/lsdb.el index 4b04f75..28893fe 100644 --- a/lsdb.el +++ b/lsdb.el @@ -371,24 +371,31 @@ This is the current number of slots in HASH-TABLE, whether occupied or not." (save-excursion (goto-char marker) (if (looking-at "^#s(") - (with-temp-buffer - (buffer-disable-undo) - (insert-buffer-substring (marker-buffer marker) marker) - (goto-char (point-min)) - (delete-char 2) - (let ((object (read (current-buffer))) - hash-table data) - (if (eq 'hash-table (car object)) - (progn - (setq hash-table - (lsdb-make-hash-table - :size (plist-get (cdr object) 'size) - :test 'equal) - data (plist-get (cdr object) 'data)) - (while data - (lsdb-puthash (pop data) (pop data) hash-table)) - hash-table) - object))))))))) + (let ((end-marker + (progn + (forward-char 2) ;skip "#s" + (forward-sexp) ;move to the left paren + (point-marker)))) + (with-temp-buffer + (buffer-disable-undo) + (insert-buffer-substring (marker-buffer marker) + marker end-marker) + (goto-char (point-min)) + (delete-char 2) + (let ((object (read (current-buffer))) + hash-table data) + (if (eq 'hash-table (car object)) + (progn + (setq hash-table + (lsdb-make-hash-table + :size (plist-get (cdr object) 'size) + :test 'equal) + data (plist-get (cdr object) 'data)) + (while data + (lsdb-puthash (pop data) (pop data) hash-table)) + hash-table) + object)))) + (read marker))))))) (defun lsdb-load-hash-tables () "Read the contents of `lsdb-file' into the internal hash tables."