Nicolas Goaziou <m...@nicolasgoaziou.fr> writes: > Hello, > > Matt Lundin <m...@imapmail.org> writes: > >> Clearly, this is still very inadequate, but it is an improvement. I >> would love to use the built in site-map functions, but they are simply >> to slow for any larger projects. >> >> Could we do something like this to speed it up? >> >> (with-temp-buffer >> (insert-file-contents file) >> (goto-char (point-min)) >> (when (re-search-forward "^#\\+TITLE:" nil t) >> (org-element-at-point))) > > No, you also need to parse #+SETUPFILE: keywords. You could also get > false positive within a verbatim block: > > #+begin_example > #+title: something > #+end_example
> However, it is possible to write a specialized function to extract > only #+TITLE. > > Another option is to cache results. See `org-publish-cache-set' and > `org-publish-cache-get'. Thanks for the helpful information. I think the cache would be a nice way to go, especially if it were combined a timestamp check. E.g., only files that have been updated since the last publishing should be queried for titles; otherwise, use the cached file. I notice that org-publish-find-title does cache the title, but AFAICT this is never used, since org-publish-format-file-entry calls org-publish-find-title with the reset argument. Perhaps we could add a variable to make this optional in org-publish-format-file-entry. E.g., --8<---------------cut here---------------start------------->8--- (defun org-publish-format-file-entry (fmt file project-plist) (format-spec fmt `((?t . ,(org-publish-find-title file org-publish-find-title-use-cache)) [...] --8<---------------cut here---------------end--------------->8--- A similar option could be added to the date function date function. Would it be O.K. if I went ahead and implemented this? Thanks, Matt