diff options
author | nrichard (geodiff-mac3) <nrichard@ulb.ac.be> | 2012-12-06 16:38:44 +0100 |
---|---|---|
committer | Eric Schulte <eric.schulte@gmx.com> | 2012-12-07 12:41:53 -0700 |
commit | 2f9ddaf69981f334812ca4ae32600afdcdaa6aa7 (patch) | |
tree | 78b1d562e423d17ae07b20b0989b57526aea0357 | |
parent | 29117be8b2d5f41164b0e2239350913146288bf0 (diff) | |
download | org-mode-2f9ddaf69981f334812ca4ae32600afdcdaa6aa7.tar.gz |
ob: Fix org-babel-edit-distance for insertion/deletion
* lisp/ob.el (org-babel-edit-distance): When insertion or deletion are
needed, make sure the distance is incremented. In addition, the now
obsolete mmin function was removed.
-rw-r--r-- | lisp/ob.el | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -629,16 +629,19 @@ arguments and pop open the results in a preview buffer." (l2 (length s2)) (dist (vconcat (mapcar (lambda (_) (make-vector (1+ l2) nil)) (number-sequence 1 (1+ l1))))) - (in (lambda (i j) (aref (aref dist i) j))) - (mmin (lambda (&rest lst) (apply #'min (remove nil lst))))) + (in (lambda (i j) (aref (aref dist i) j)))) (setf (aref (aref dist 0) 0) 0) + (dolist (j (number-sequence 1 l2)) + (setf (aref (aref dist 0) j) j)) (dolist (i (number-sequence 1 l1)) + (setf (aref (aref dist i) 0) i) (dolist (j (number-sequence 1 l2)) (setf (aref (aref dist i) j) - (+ (if (equal (aref s1 (1- i)) (aref s2 (1- j))) 0 1) - (funcall mmin (funcall in (1- i) j) - (funcall in i (1- j)) - (funcall in (1- i) (1- j))))))) + (min + (1+ (funcall in (1- i) j)) + (1+ (funcall in i (1- j))) + (+ (if (equal (aref s1 (1- i)) (aref s2 (1- j))) 0 1) + (funcall in (1- i) (1- j))))))) (funcall in l1 l2))) (defun org-babel-combine-header-arg-lists (original &rest others) |