瀏覽代碼

Apply patch to fix registry

Patch by Andreas Burtzlaff
Carsten Dominik 15 年之前
父節點
當前提交
bdb6992813
共有 2 個文件被更改,包括 12 次插入10 次删除
  1. 5 0
      contrib/ChangeLog
  2. 7 10
      contrib/lisp/org-registry.el

+ 5 - 0
contrib/ChangeLog

@@ -1,3 +1,8 @@
+2009-10-22  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* lisp/org-registry.el (org-registry-assoc-all)
+	(org-registry-find-all): Clean rewrite
+
 2009-10-19  James TD Smith  <ahktenzero@mohorovi.cc>
 
 	* lisp/org-registry.el (org-registry-assoc-all): Stop this from

+ 7 - 10
contrib/lisp/org-registry.el

@@ -145,19 +145,16 @@ buffer."
 
 (defun org-registry-assoc-all (link &optional registry)
   "Return all associated entries of LINK in the registry."
-  (let ((reg (copy-list (or org-registry-alist registry))) entry output)
-    (while (setq entry (assoc link reg))
-      (add-to-list 'output entry)
-      (setq reg (delete entry reg)))
-    (nreverse output)))
+  (org-registry-find-all 
+   (lambda (entry) (string= link (car entry)))
+   registry))
 
 (defun org-registry-find-all (test &optional registry)
   "Return all entries satisfying `test' in the registry."
-  (let ((reg (copy-list (or org-registry-alist registry))) entry output)
-    (while (setq entry (find-if test reg))
-      (add-to-list 'output entry)
-      (setq reg (delete entry reg)))
-    (nreverse output)))
+  (delq nil 
+        (mapcar 
+         (lambda (x) (and (funcall test x) x)) 
+         (or registry org-registry-alist))))
 
 ;;;###autoload
 (defun org-registry-visit ()