Merge branch 'maint'
authorNicolas Goaziou <n.goaziou@gmail.com>
Fri, 12 Jul 2013 07:10:26 +0000 (09:10 +0200)
committerNicolas Goaziou <n.goaziou@gmail.com>
Fri, 12 Jul 2013 07:10:26 +0000 (09:10 +0200)
Conflicts:
contrib/lisp/ox-koma-letter.el

1  2 
contrib/lisp/ox-koma-letter.el
lisp/ox-beamer.el
lisp/ox-latex.el

@@@ -499,90 -176,46 +499,90 @@@ holding export options.
     (and (plist-get info :time-stamp-file)
          (format-time-string "%% Created %Y-%m-%d %a %H:%M\n"))
     ;; Document class and packages.
-    (let ((class (plist-get info :latex-class))
-          (class-options (plist-get info :latex-class-options)))
-      (org-element-normalize-string
-       (let* ((header (nth 1 (assoc class org-latex-classes)))
-              (document-class-string
-               (and (stringp header)
-                    (if (not class-options) header
-                    (replace-regexp-in-string
-                     "^[ \t]*\\\\documentclass\\(\\(\\[[^]]*\\]\\)?\\)"
-                     class-options header t nil 1)))))
-         (if (not document-class-string)
-           (user-error "Unknown LaTeX class `%s'" class)
-           (org-latex-guess-babel-language
-            (org-latex-guess-inputenc
-             (org-splice-latex-header
-              document-class-string
-              org-latex-default-packages-alist ; defined in org.el
-              org-latex-packages-alist nil     ; defined in org.el
-            (concat (plist-get info :latex-header)
-                    (plist-get info :latex-header-extra))))
-            info)))))
+    (let* ((class (plist-get info :latex-class))
+         (class-options (plist-get info :latex-class-options))
+         (header (nth 1 (assoc class org-latex-classes)))
+         (document-class-string
+          (and (stringp header)
+               (if (not class-options) header
+                 (replace-regexp-in-string
+                  "^[ \t]*\\\\documentclass\\(\\(\\[[^]]*\\]\\)?\\)"
+                  class-options header t nil 1)))))
+      (if (not document-class-string)
 -       (user-error "Unknown LaTeX class `%s'")
++       (user-error "Unknown LaTeX class `%s'" class)
+        (org-latex-guess-babel-language
+       (org-latex-guess-inputenc
+        (org-element-normalize-string
+         (org-splice-latex-header
+          document-class-string
+          org-latex-default-packages-alist ; Defined in org.el.
+          org-latex-packages-alist nil     ; Defined in org.el.
 -         (concat (org-element-normalize-string
 -                  (plist-get info :latex-header))
++         (concat (org-element-normalize-string (plist-get info :latex-header))
+                  (plist-get info :latex-header-extra)))))
+       info)))
 -   ;; Define "From" data.
 -   (format "\\setkomavar{fromname}{%s}\n"
 -           (org-export-data (plist-get info :author) info))
 -   (format "\\setkomavar{fromaddress}{%s}\n" (plist-get info :from-address))
 -   (format "\\setkomavar{signature}{%s}\n" (plist-get info :signature))
 -   (format "\\setkomavar{fromemail}{%s}\n"
 -           (org-export-data (plist-get info :email) info))
 -   (format "\\setkomavar{fromphone}{%s}\n" (plist-get info :phone-number))
 +   (let ((lco (plist-get info :lco))
 +       (author (plist-get info :author))
 +       (from-address (org-koma-letter--determine-special-value info 'from))
 +       (phone-number (plist-get info :phone-number))
 +       (email (plist-get info :email))
 +       (signature (plist-get info :signature)))
 +     (concat
 +      ;; Letter Class Option File
 +      (when lco
 +      (let ((lco-files (split-string lco " "))
 +            (lco-def ""))
 +        (dolist (lco-file lco-files lco-def)
 +          (setq lco-def (format "%s\\LoadLetterOption{%s}\n" lco-def lco-file)))
 +        lco-def))
 +      ;; Define "From" data.
 +      (when author (format "\\setkomavar{fromname}{%s}\n"
 +                         (org-export-data author info)))
 +      (when from-address (format "\\setkomavar{fromaddress}{%s}\n" from-address))
 +      (when phone-number (format "\\setkomavar{fromphone}{%s}\n" phone-number))
 +      (when email (format "\\setkomavar{fromemail}{%s}\n" email))
 +      (when signature (format "\\setkomavar{signature}{%s}\n" signature))))
     ;; Date.
     (format "\\date{%s}\n" (org-export-data (org-export-get-date info) info))
 -   ;; Letter Class Option File
 -   (format "\\LoadLetterOption{%s}\n" (plist-get info :lco))
 -   ;; Letter start.
 +   ;; Place
 +   (let ((with-place (plist-get info :with-place))
 +       (place (plist-get info :place)))
 +     (when (or place (not with-place))
 +       (format "\\setkomavar{place}{%s}\n" (if with-place place ""))))
 +   ;; KOMA options
 +   (let ((with-backaddress (plist-get info :with-backaddress))
 +       (with-foldmarks (plist-get info :with-foldmarks))
 +       (with-phone (plist-get info :with-phone))
 +       (with-email (plist-get info :with-email)))
 +     (concat
 +      (format "\\KOMAoption{backaddress}{%s}\n" (if with-backaddress "true" "false"))
 +      (format "\\KOMAoption{foldmarks}{%s}\n" (if with-foldmarks with-foldmarks "false"))
 +      (format "\\KOMAoption{fromphone}{%s}\n" (if with-phone "true" "false"))
 +      (format "\\KOMAoption{fromemail}{%s}\n" (if with-email "true" "false"))))
 +   ;; Document start
     "\\begin{document}\n\n"
 -   (format "\\setkomavar{subject}{%s}\n\n"
 -           (org-export-data (plist-get info :title) info))
 +   ;; Subject
 +   (let* ((with-subject (plist-get info :with-subject))
 +        (subject-format (cond ((member with-subject '("true" "t" t)) nil)
 +                              ((stringp with-subject) (list with-subject))
 +                              ((symbolp with-subject)
 +                               (list (symbol-name with-subject)))
 +                              (t with-subject)))
 +        (subject (org-export-data (plist-get info :title) info))
 +        (l (length subject-format))
 +        (y ""))
 +     (concat
 +      (when (and with-subject subject-format)
 +      (concat
 +       "\\KOMAoption{subject}{"
 +       (apply 'format
 +              (dotimes (x l y)
 +                (setq y (concat (if (> x 0) "%s," "%s") y)))
 +              subject-format) "}\n"))
-      (when (and subject with-subject)
-        (format "\\setkomavar{subject}{%s}\n\n" subject))))
++      (when (and subject with-subject)
++      (format "\\setkomavar{subject}{%s}\n\n" subject))))
 +   ;; Letter start
     (format "\\begin{letter}{%%\n%s}\n\n"
 -         (or (plist-get info :to-address) "no address given"))
 +         (org-koma-letter--determine-special-value info 'to))
     ;; Opening.
     (format "\\opening{%s}\n\n" (plist-get info :opening))
     ;; Letter body.
Simple merge
Simple merge