From: ueno Date: Tue, 7 May 2002 23:30:38 +0000 (+0000) Subject: * lsdb.el (lsdb-rebuild-secondary-hash-tables): Rename from lsdb-load-secondary-hash... X-Git-Tag: lsdb-0_6~1 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a4512d129ff516b7b613fe9daec7969e0b145842;p=elisp%2Flsdb.git * lsdb.el (lsdb-rebuild-secondary-hash-tables): Rename from lsdb-load-secondary-hash-tables. (lsdb-mode-map): Bind "l" to lsdb-mode-load. (lsdb-mode-load): New command. * cvs2cl/fmtlog.rb: Simplified. --- diff --git a/cvs2cl/fmtlog.rb b/cvs2cl/fmtlog.rb index 737c748..923953e 100644 --- a/cvs2cl/fmtlog.rb +++ b/cvs2cl/fmtlog.rb @@ -1,11 +1,4 @@ -case $_ -when /^\t(\* ([^:]+): )\* ([^: ]+)/ - data, files, file = $~, $2, $3 - if files.split(/, /).member?(file) - $_.slice!(data.begin(1) .. data.end(1) - 1) - end -when /^\t\* [^:]+(:) \(/ - $_.slice!($~.begin(1) .. $~.end(1) - 1) -when /^\d{4}-\d{2}-\d{2}( \d{2}:\d{2})/ +if /^\t(\* ([^:]+): )\* ([^: ]+)/ or /^\t\* [^:]+(:) \(/ or + /^\d{4}-\d{2}-\d{2}( \d{2}:\d{2})/ $_.slice!($~.begin(1) .. $~.end(1) - 1) end diff --git a/lsdb.el b/lsdb.el index cee99c3..c298309 100644 --- a/lsdb.el +++ b/lsdb.el @@ -487,10 +487,10 @@ This is the current number of slots in HASH-TABLE, whether occupied or not." (set-buffer-multibyte multibyte)))) ;;;_. Record Management -(defun lsdb-maybe-load-secondary-hash-tables () +(defun lsdb-rebuild-secondary-hash-tables (&optional force) (let ((tables lsdb-secondary-hash-tables)) (while tables - (unless (symbol-value (car tables)) + (when (or force (not (symbol-value (car tables)))) (set (car tables) (lsdb-make-hash-table :test 'equal)) (lsdb-maphash (lambda (key value) @@ -506,7 +506,7 @@ This is the current number of slots in HASH-TABLE, whether occupied or not." (if (file-exists-p lsdb-file) (lsdb-load-hash-tables) (setq lsdb-hash-table (lsdb-make-hash-table :test 'equal))) - (lsdb-maybe-load-secondary-hash-tables))) + (lsdb-rebuild-secondary-hash-tables))) ;;;_ : Fallback Lookup Functions ;;;_ , #1 Address Cache @@ -883,6 +883,7 @@ Modify whole identification by side effect." (define-key keymap "a" 'lsdb-mode-add-entry) (define-key keymap "d" 'lsdb-mode-delete-entry) (define-key keymap "e" 'lsdb-mode-edit-entry) + (define-key keymap "l" 'lsdb-mode-load) (define-key keymap "s" 'lsdb-mode-save) (define-key keymap "q" 'lsdb-mode-quit-window) (define-key keymap "g" 'lsdb-mode-lookup) @@ -1069,6 +1070,15 @@ the current record." (setq lsdb-hash-tables-are-dirty nil) (message "The LSDB was saved successfully.")))) +(defun lsdb-mode-load () + "Load LSDB hash table from `lsdb-file'." + (interactive) + (let (lsdb-secondary-hash-tables) + (lsdb-load-hash-tables)) + (message "Rebuilding secondary hash tables...") + (lsdb-rebuild-secondary-hash-tables t) + (message "Rebuilding secondary hash tables...done")) + (defun lsdb-mode-quit-window (&optional kill window) "Quit the current buffer. It partially emulates the GNU Emacs' of `quit-window'."