From bc59617af78405293924d8a62b9b2aee544113d1 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Mon, 3 Mar 2008 23:17:05 +0000 Subject: [PATCH] Added the alias `org-publish-delete-duplicates'. In (< emacs-major-version 2), there is no `delete-dups'. So we use this alias, either calling `delete-dups' or using a routine copyied from subr.el in Emacs 22+. --- org-publish.el | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/org-publish.el b/org-publish.el index 4d454917e..5eb30a45f 100644 --- a/org-publish.el +++ b/org-publish.el @@ -356,6 +356,22 @@ If NO-EXCLUSION is non-nil, don't exclude files." (org-publish-expand-projects projects-alist)) all-files)) +(if (fboundp 'delete-dups) + (defalias 'org-publish-delete-duplicates 'delete-dups) + (defun org-publish-delete-duplicates (list) + "Destructively remove `equal' duplicates from LIST. +Store the result in LIST and return it. LIST must be a proper list. +Of several `equal' occurrences of an element in LIST, the first +one is kept. + +This is a compatibility function for Emacsen without `delete-dups'." + ;; Code from `subr.el' in Emacs 22: + (let ((tail list)) + (while tail + (setcdr tail (delete (car tail) (cdr tail))) + (setq tail (cdr tail)))) + list)) + (defun org-publish-expand-projects (projects-alist) "Expand projects contained in PROJECTS-ALIST." (let (without-component with-component) @@ -364,7 +380,7 @@ If NO-EXCLUSION is non-nil, don't exclude files." (if (plist-get (cdr p) :components) 'with-component 'without-component) p)) projects-alist) - (delete-dups + (org-publish-delete-duplicates (append without-component (car (mapcar (lambda(p) (org-publish-expand-components p)) with-component)))))) @@ -372,7 +388,7 @@ If NO-EXCLUSION is non-nil, don't exclude files." (defun org-publish-expand-components (project) "Expand PROJECT into an alist of its components." (let* ((components (plist-get (cdr project) :components))) - (delete-dups + (org-publish-delete-duplicates (mapcar (lambda(c) (assoc c org-publish-project-alist)) components))))