From c1c1c6778e0d0105ddfa6c8ce33bab275a4d56a9 Mon Sep 17 00:00:00 2001 From: blais Date: Sun, 7 Aug 2005 07:44:03 +0000 Subject: [PATCH] Added missing generic filter function. git-svn-id: https://docutils.svn.sourceforge.net/svnroot/docutils/trunk@3787 929543f6-e4f2-0310-98a6-ba3bd3dd1d04 --- docutils/tools/editors/emacs/restructuredtext.el | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/docutils/tools/editors/emacs/restructuredtext.el b/docutils/tools/editors/emacs/restructuredtext.el index 3c670a224..64444f3a8 100644 --- a/docutils/tools/editors/emacs/restructuredtext.el +++ b/docutils/tools/editors/emacs/restructuredtext.el @@ -27,6 +27,20 @@ ;; C-u C-=. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; +;; Generic Filter function. + +(if (not (fboundp 'filter)) + (defun filter (pred list) + "Returns a list of all the elements fulfilling the pred requirement (that +is for which (pred elem) is true)" + (if list + (let ((head (car list)) + (tail (filter pred (cdr list)))) + (if (funcall pred head) + (cons head tail) + tail))))) + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; ;; Generic text functions that are more convenient than the defaults. ;; -- 2.11.4.GIT