(string-compare-from-top): Use `sref' instead of `aref'; use
[elisp/mu-cite.git] / mu-cite.el
index 87ec6ed..83dbb09 100644 (file)
@@ -321,8 +321,8 @@ function according to the agreed upon standard."
       (insert top)
       (setq last-point (point))
       (while (< (point)(mark t))
-       (unless (looking-at mu-cite-cited-prefix-regexp)
-         (insert prefix))
+       (or (looking-at mu-cite-cited-prefix-regexp)
+           (insert prefix))
        (forward-line 1))
       (goto-char last-point))
     (run-hooks 'mu-cite-post-cite-hook)))
@@ -371,9 +371,8 @@ TABLE defaults to the current buffer's category table."
     (goto-char (point-min))
     (let ((i 0)
          (prefix
-          (buffer-substring
-           (progn (beginning-of-line)(point))
-           (progn (end-of-line)(point))))
+          (buffer-substring (line-beginning-position)
+                            (line-end-position)))
          str ret)
       (while (and (= (forward-line) 0)
                  (setq str (buffer-substring
@@ -384,7 +383,7 @@ TABLE defaults to the current buffer's category table."
              (if (stringp ret)
                  ret
                (cadr ret)))
-       (incf i))
+       (setq i (1+ i)))
       (cond ((> i 1) prefix)
            ((> i 0)
             (goto-char (point-min))
@@ -454,8 +453,9 @@ TABLE defaults to the current buffer's category table."
             (prefix (buffer-substring b e))
             ps pe (s 0)
             (nest (let ((i 0))
-                    (when (string-match "<[^<>]+>" prefix)
-                      (setq prefix (substring prefix 0 (match-beginning 0))))
+                    (if (string-match "<[^<>]+>" prefix)
+                        (setq prefix
+                              (substring prefix 0 (match-beginning 0))))
                     (while (string-match
                             (concat "\\([" citation-mark-chars "]+\\)[ \t]*")
                             prefix s)
@@ -483,10 +483,10 @@ TABLE defaults to the current buffer's category table."
         c1 c2)
     (while (and (< p len)
                (progn
-                 (setq c1 (aref str1 p)
-                       c2 (aref str2 p))
+                 (setq c1 (sref str1 p)
+                       c2 (sref str2 p))
                  (eq c1 c2)))
-      (setq p (+ p (char-length c1))))
+      (setq p (char-next-index c1 p)))
     (and (> p 0)
         (let ((matched (substring str1 0 p))
               (r1 (and (< p len1)(substring str1 p)))