From 006d704145bbc39313fed89dc958ea7230e3b9d7 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sat, 17 Dec 2011 15:55:18 +0100 Subject: [PATCH] Use theindex.inc and theindex.org as described in the manual. * org-publish.el (org-publish-index-generate-theindex): Use theindex.inc for storing index entries, and theindex.org for including theindex.inc. Commit f0d7ac removed the theindex.inc and directly included index entries in theindex.org. This is not as flexible as using theindex.org as a page you want to manually edit, which can then include theindex.inc with proper content. Thanks to Stefan Vollmar for insisting about this issue. --- lisp/org-publish.el | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lisp/org-publish.el b/lisp/org-publish.el index 8e32658d0..228666b97 100644 --- a/lisp/org-publish.el +++ b/lisp/org-publish.el @@ -997,7 +997,7 @@ the project." (kill-buffer buf)) (setq index (sort index (lambda (a b) (string< (downcase (car a)) (downcase (car b)))))) - (setq ibuffer (find-file-noselect (expand-file-name "theindex.org" directory))) + (setq ibuffer (find-file-noselect (expand-file-name "theindex.inc" directory))) (with-current-buffer ibuffer (erase-buffer) (insert "* Index\n") @@ -1024,7 +1024,16 @@ the project." (insert " - " link "\n") (insert " - " link "\n"))) (save-buffer)) - (kill-buffer ibuffer))) + (kill-buffer ibuffer) + ;; Create theindex.org if it doesn't exist already + (let ((index-file (expand-file-name "theindex.org" directory))) + (unless (file-exists-p index-file) + (setq ibuffer (find-file-noselect index-file)) + (with-current-buffer ibuffer + (erase-buffer) + (insert "\n\n#+include: \"theindex.inc\"\n\n") + (save-buffer)) + (kill-buffer ibuffer))))) ;; Caching functions: -- 2.11.4.GIT