diff -u /home/guerry/elisp/testing/org/org.el /home/guerry/elisp/testing/bzg/org.el --- /home/guerry/elisp/testing/org/org.el 2007-10-12 20:32:10.000000000 +0100 +++ /home/guerry/elisp/testing/bzg/org.el 2007-10-18 13:17:18.000000000 +0100 @@ -17885,7 +17885,8 @@ (error "Cannot write agenda to file %s" file)) (cond ((string-match "\\.html?\\'" file) (require 'htmlize)) - ((string-match "\\.ps\\'" file) (require 'ps-print))) + ((string-match "\\.ps\\'" file) (require 'ps-print)) + ((string-match "\\.tex\\'" file) (require 'org-export-latex))) (org-let (if nosettings nil org-agenda-exporter-settings) '(save-excursion (save-window-excursion @@ -17903,6 +17904,23 @@ (write-file file) (kill-buffer (current-buffer)) (message "HTML written to %s" file)) + ((string-match "\\.tex\\'" file) + (let ((buffer-file-name file)) + (set-buffer (org-export-as-latex nil nil nil "*Org LaTeX export*"))) + (goto-char (point-min)) + (save-excursion + (when (re-search-forward "^[a-zA-Z0-9]" nil t) + (replace-match "\\\\begin{verbatim}\n\\&" t nil)) + (while (re-search-forward + "\\\\\\([a-z]+\\){\\([^}]+\\)}\\(?:{\\([^}]+\\)}\\)?" nil t) + (unless (string-match "begin\\|end" (match-string 1)) + (replace-match (or (match-string 3) (match-string 2)) t t)))) + (while (re-search-forward "\\[\\\\#" nil t) + (replace-match "[#" t t)) + (when (search-forward "\\end{document}" nil t) + (replace-match "\\\\end{verbatim}\n\\&" t nil)) + (write-file file) + (message "LaTeX written to %s" file)) ((string-match "\\.ps\\'" file) (ps-print-buffer-with-faces file) (message "Postscript written to %s" file)) Diff finished. Thu Oct 18 13:18:45 2007