* riece-log.el (riece-log-insert-log): Renamed from
authorueno <ueno>
Tue, 7 Dec 2004 09:50:44 +0000 (09:50 +0000)
committerueno <ueno>
Tue, 7 Dec 2004 09:50:44 +0000 (09:50 +0000)
riece-log-flashback-1; simplified.

lisp/ChangeLog
lisp/riece-log.el

index 560978b..a57c56d 100644 (file)
@@ -1,3 +1,8 @@
+2004-12-07  Daiki Ueno  <ueno@unixuser.org>
+
+       * riece-log.el (riece-log-insert-log): Renamed from
+       riece-log-flashback-1; simplified.
+
 2004-12-07  TAKAHASHI Kaoru  <kaoru@kaisei.org>
 
        * riece-foolproof.el (riece-foolproof-command-send-message-function): 
index e10e8d6..adc766f 100644 (file)
@@ -166,48 +166,43 @@ If integer, flash back only this line numbers. t means all lines."
                                  riece-log-file-name-coding-system)))
   file-name)
 
-(defun riece-log-flashback-1 (identity)
-  (if (eq riece-log-flashback t)
+(defun riece-log-insert-log (identity lines)
+  "Insert logs for IDENTITY at most LINES.
+If LINES is t, insert today's logs entirely."
+  (if (eq lines t)
       (let ((file (riece-log-get-file identity)))
        (if (file-exists-p file)
            (insert-file-contents file)))
     (let ((files (riece-log-get-files identity))
-         (lines (- riece-log-flashback))
+         (lines (- lines))
          date point)
       (while (and (< lines 0) files)
        (if (and (file-exists-p (car files))
-                (string-match (concat "\\("
-                                      (riece-make-interval-regexp "[0-9]" 4)
-                                      "\\)\\("
-                                      (riece-make-interval-regexp "[0-9]" 2)
-                                      "\\)\\("
-                                      (riece-make-interval-regexp "[0-9]" 2)
-                                      "\\).log$")
+                (string-match (concat "\\([0-9][0-9][0-9][0-9]\\)"
+                                      "\\([0-9][0-9]\\)\\([0-9][0-9]\\).log$")
                               (car files)))
            (save-restriction
-             (narrow-to-region (point-min) (point-min))
+             (narrow-to-region (point) (point))
              (setq date (concat " (" (match-string 1 (car files)) "/"
                                 (match-string 2 (car files)) "/"
                                 (match-string 3 (car files)) ")"))
              (insert-file-contents (car files))
              (goto-char (point-max))
-             (setq lines (forward-line lines)
-                   point (point))
+             (setq lines (forward-line lines))
+             (delete-region (point-min) (point))
              (while (not (eobp))
                (end-of-line)
                (insert date)
                (forward-line))
-             (goto-char point)))
-       (setq files (cdr files)))
-      (if (zerop lines)
-         (delete-region (point-min) (point))))))
+             (goto-char (point-min))))
+       (setq files (cdr files))))))
 
 (defun riece-log-flashback (identity)
   (when riece-log-flashback
     (let (buffer-read-only
          (point (goto-char (point-max))))
       (insert (with-temp-buffer
-               (riece-log-flashback-1 identity)
+               (riece-log-insert-log identity riece-log-flashback)
                (buffer-string)))
       (goto-char point)
       (while (re-search-forward