summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <n.goaziou@gmail.com>2013-02-17 01:40:53 +0100
committerNicolas Goaziou <n.goaziou@gmail.com>2013-02-17 01:40:53 +0100
commitadc01ecf37905923727e4eba0a2603f0e9014c49 (patch)
tree4ac71b09ea9b7edab37ae0b65341e05931d23595
parent8e2318a722632b66df8a27784250be085c2cf570 (diff)
downloadorg-mode-adc01ecf37905923727e4eba0a2603f0e9014c49.tar.gz
ox-publish: Preserve order in files when building the index
* lisp/ox-publish.el (org-publish-index-generate-theindex): Preserve order in file.
-rw-r--r--lisp/ox-publish.el20
1 files changed, 9 insertions, 11 deletions
diff --git a/lisp/ox-publish.el b/lisp/ox-publish.el
index f2af098..5ba9a2c 100644
--- a/lisp/ox-publish.el
+++ b/lisp/ox-publish.el
@@ -947,17 +947,15 @@ publishing directory."
(let ((all-files (org-publish-get-base-files
project (plist-get (cdr project) :exclude)))
full-index)
- ;; Compile full index.
- (mapc
- (lambda (file)
- (let ((index (org-publish-cache-get-file-property file :index)))
- (dolist (term index)
- (unless (member term full-index) (push term full-index)))))
- all-files)
- ;; Sort it alphabetically.
- (setq full-index
- (sort full-index (lambda (a b) (string< (downcase (car a))
- (downcase (car b))))))
+ ;; Compile full index and sort it alphabetically.
+ (dolist (file all-files
+ (setq full-index
+ (sort (nreverse full-index)
+ (lambda (a b) (string< (downcase (car a))
+ (downcase (car b)))))))
+ (let ((index (org-publish-cache-get-file-property file :index)))
+ (dolist (term index)
+ (unless (member term full-index) (push term full-index)))))
;; Write "theindex.inc" in DIRECTORY.
(with-temp-file (expand-file-name "theindex.inc" directory)
(insert "* Index\n")