From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Publishing org files : index Date: Wed, 9 Jul 2008 09:56:45 -0700 Message-ID: References: <18532.22619.459713.33756@clip.dia.fi.upm.es> <8F8FE6E3-F310-41AD-A56A-6E1516683E7C@uva.nl> <18548.17518.100718.653924@clip.dia.fi.upm.es> Mime-Version: 1.0 (Apple Message framework v924) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KGcyP-0006pV-1T for emacs-orgmode@gnu.org; Wed, 09 Jul 2008 12:56:57 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KGcyO-0006on-0o for emacs-orgmode@gnu.org; Wed, 09 Jul 2008 12:56:56 -0400 Received: from [199.232.76.173] (port=34723 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KGcyN-0006od-SJ for emacs-orgmode@gnu.org; Wed, 09 Jul 2008 12:56:55 -0400 Received: from korteweg.uva.nl ([146.50.98.70]:3699) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KGcyM-0006m1-AS for emacs-orgmode@gnu.org; Wed, 09 Jul 2008 12:56:55 -0400 In-Reply-To: <18548.17518.100718.653924@clip.dia.fi.upm.es> List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Manuel Hermenegildo Cc: org-mode , Richard G Riley Hi Manuel, I added this change and like the idea. However, I again had problems with your patch, so I had to apply by hand. Please check that everything arrived correctly in the git repo. Thanks a lot. I left the default for now at `tree'. - Carsten On Jul 8, 2008, at 9:54 PM, Manuel Hermenegildo wrote: > > Hi Carsten, > >> Any news on this, Manuel? > > A call went missing when the patch I sent you was applied (my fault > for not using -u ;-)) but it is actually fixed in the current git > version. > > Btw, the current index includes directory information, so that if I > have in my project two files: > > org/test/too/foo.org (Title: This is file foo) > org/test/simple.org (Title: This is a simple Org-generated web page) > > the index looks like: > > * org/ > o test/ > + too/ > # This is file foo > * org/ > o test/ > + This is a simple Org-generated web page > > which can be useful if the directory names are explicit > enough. However, I think in some cases one actually wants the index to > look simply like: > > * This is file foo > * This is a simple Org-generated web page > > I send a patch that implements a new index option: > > :index-style Can be 'list (index is just an itemized list > of the titles of the files involved) or > 'tree (the directory structure of the source > files is reflected in the index). Defaults to > 'tree." > > (Btw, I would actually prefer to default to 'list, but I leave that to > you Carsten, or what people prefer, since it would change the current > behavior.) > > Please include the patch if you find it useful. > > Cheers, > > Manuel > > > ================================================================= > > --- org-publish.el 2008-07-08 22:30:49.000000000 -0600 > +++ org-publish.el.git 2008-07-08 19:00:04.000000000 -0600 > @@ -263,12 +263,7 @@ > :index-function Plugin function to use for generation of > index. > Defaults to `org-publish-org-index', which > generates a plain list of links to all files > - in the project. > - :index-style Can be 'list (index is just an itemized list > - of the titles of the files involved) or > - 'tree (the directory structure of the source > - files is reflected in the index). Defaults > to > - 'tree." > + in the project." > :group 'org-publish > :type 'alist) > > @@ -612,8 +607,6 @@ > (index-filename (concat dir (or index-filename "index.org"))) > (index-title (or (plist-get project-plist :index-title) > (concat "Index for project " (car project)))) > - (index-style (or (plist-get project-plist :index-style) > - 'tree)) > (index-buffer (find-buffer-visiting index-filename)) > (ifn (file-name-nondirectory index-filename)) > file) > @@ -628,32 +621,25 @@ > (oldlocal localdir)) > ;; index shouldn't index itself > (unless (string= fn ifn) > - (if (eq index-style 'list) > - (message "Generating list-style index for %s" index-title) > - (message "Generating tree-style index for %s" index-title) > - (setq localdir (concat (file-name-as-directory dir) > - (file-name-directory link))) > - (unless (string= localdir oldlocal) > - (if (string= localdir dir) > - (setq indent-str (make-string 2 ?\ )) > - (let ((subdirs > - (split-string > - (directory-file-name > - (file-name-directory > - (file-relative-name localdir dir))) "/")) > - (subdir "")) > - (setq indent-str (make-string 2 ?\ )) > - (dolist (d subdirs) > - (setq subdir (concat subdir d "/")) > - (insert (concat indent-str " + [[file:" > - subdir "][" d "/]]\n")) > - (setq indent-str (make-string > - (+ (length indent-str) 2) ?\ ))))))) > - ;; This is common to 'flat and 'tree > + (setq localdir (concat (file-name-as-directory dir) > + (file-name-directory link))) > + (unless (string= localdir oldlocal) > + (if (string= localdir dir) > + (setq indent-str (make-string 2 ?\ )) > + (let ((subdirs > + (split-string > + (directory-file-name > + (file-name-directory > + (file-relative-name localdir dir))) "/")) > + (subdir "")) > + (setq indent-str (make-string 2 ?\ )) > + (dolist (d subdirs) > + (setq subdir (concat subdir d "/")) > + (insert (concat indent-str " + [[file:" subdir "][" d "/]]\n")) > + (setq indent-str (make-string (+ (length indent-str) 2) ? > \ )))))) > (insert (concat indent-str " + [[file:" link "][" > (org-publish-find-title file) > - "]]\n")) > - ))) > + "]]\n"))))) > (write-file index-filename) > (kill-buffer (current-buffer))))) > > > -- > ------------------------------------------------------------------------------- > Manuel Hermenegildo | Prof., C.S. > Department > Director, IMDEA-Software and CLIP Group | T.U. of > Madrid (UPM) > http://www.cliplab.org/herme | +34-91-336-7435 (W) > -352-4819 (Fax) > ------------------------------------------------------------------------------- >