Derek Thomas <derekctho...@gmail.com> wrote: > > Nick Dokos <nicholas.do...@hp.com> writes: > > > >> (defun org-list-to-paragraph () > >> "Convert the list at point into a paragraph." > >> (interactive) > >> (insert (org-list-to-generic (org-list-parse-list t) > >> '(:ustart "" > >> :splice t > >> :isep " " > >> :nobr t )))) > >> > >> > >> (defun org-lists-to-paragraphs () > >> (goto-char (point-min)) > >> (condition-case nil > >> (while (org-list-search-forward "+ ") > >> (org-list-to-paragraph)) > >> (error nil))) > >> > >> (add-hook 'org-export-preprocess-hook > >> (function org-lists-to-paragraphs)) > > > This looks like it will do what I want. Is there any way to restrict > this export option to certain org files? Thanks, >
With elisp you can do anything: just a small matter of programming (TM). E.g. you can set up a list with the files that you want this to apply to and then check in org-lists-to-paragraphs whether the file you are exporting is in the list: if not, don't do anything. Here's a quick and rather dirty implementation - a minor variation on the above:
(setq ndk-list-to-paragraph-file-list '("/home/nick/src/org/list/to-paragraph/derek-thomas.org")) (defun org-list-to-paragraph () "Convert the list at point into a paragraph." (interactive) (insert (org-list-to-generic (org-list-parse-list t) '(:ustart "" :splice t :isep " " :nobr t )))) (defun ndk-buffer-file-name () ;;; if called from inside org-export-preprocess-string ;;; source-buffer will be bound to the original org buffer, not the temp buffer ;;; otherwise assume we want to operate on the current buffer ;;; don't bother telling me how ugly this is - I know ;;; but do bother telling me about a better way to do it. (if (boundp 'source-buffer) (buffer-file-name source-buffer) (buffer-file-name (current-buffer)))) (defun org-lists-to-paragraphs () (if (not (member (ndk-buffer-file-name) ndk-list-to-paragraph-file-list)) nil (goto-char (point-min)) (condition-case nil (while (org-list-search-forward "+ ") (org-list-to-paragraph)) (error nil)))) (add-hook 'org-export-preprocess-hook (function org-lists-to-paragraphs))
but depending on your needs, you might want to do it differently. It is just a matter of figuring out what criteria you want to apply and then figuring out how to implement those criteria. Nick PS Is there a better way to get the original buffer name?