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+.
This commit is contained in:
Bastien Guerry 2008-03-03 23:17:05 +00:00
parent 04c3f97721
commit bc59617af7
1 changed files with 18 additions and 2 deletions

View File

@ -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))))