Browse Source

LaTeX export: Modify the structure of the listings name option.

The variable `org-export-latex-listings-langs' is now an alist.
Carsten Dominik 15 years ago
parent
commit
0a7e8ab221
3 changed files with 37 additions and 18 deletions
  1. 9 0
      lisp/ChangeLog
  2. 8 4
      lisp/org-exp.el
  3. 20 14
      lisp/org-latex.el

+ 9 - 0
lisp/ChangeLog

@@ -1,3 +1,12 @@
+2009-08-23  Carsten Dominik  <carsten.dominik@gmail.com>
+
+	* org-exp.el (org-export-format-source-code-or-example): Deal wit
+	the new structure of the `org-export-latex-listings-langs'
+	variable.
+
+	* org-latex.el (org-export-latex-listings-langs): Change structure
+	of the variable from plist to alist.
+
 2009-08-21  Carsten Dominik  <carsten.dominik@gmail.com>
 
 	* org.el (org-in-commented-line): New function.

+ 8 - 4
lisp/org-exp.el

@@ -2323,10 +2323,14 @@ INDENT was the original indentation of the block."
                           (if org-export-latex-listings
                               (concat
                                (if lang
-                                   (let* ((lang-sym (intern (concat ":" lang)))
-                                          (lstlang (or (plist-get org-export-latex-listings-langs
-                                                                  lang-sym)
-                                                       lang)))
+                                   (let*
+				       ((lang-sym (intern lang))
+					(lstlang
+					 (or (cadr
+					      (assq
+					       lang-sym
+					       org-export-latex-listings-langs))
+					     lang)))
                                      (format "\\lstset{language=%s}\n" lstlang))
                                  "")
                                "\\begin{lstlisting}\n"

+ 20 - 14
lisp/org-latex.el

@@ -318,21 +318,27 @@ for example using customize, or with something like
   :type 'boolean)
 
 (defcustom org-export-latex-listings-langs
-  '(:emacs-lisp "Lisp" :lisp "Lisp"
-		:c "C" :cc "C++"
-		:fortran "fortran"
-		:perl "Perl" :cperl "Perl" :python "Python" :ruby "Ruby"
-		:html "HTML" :xml "XML"
-		:tex "TeX" :latex "TeX"
-		:shell-script "bash"
-		:gnuplot "Gnuplot"
-		:ocaml "Caml" :caml "Caml"
-		:sql "SQL")
-  "Property list mapping languages to their listing language counterpart.
-The key is the major mode symbol, the value is the string that should be
-inserted as the language parameter for the listings package."
+  '((emacs-lisp "Lisp") (lisp "Lisp")
+    (c "C") (cc "C++")
+    (fortran "fortran")
+    (perl "Perl") (cperl "Perl") (python "Python") (ruby "Ruby")
+    (html "HTML") (xml "XML")
+    (tex "TeX") (latex "TeX")
+    (shell-script "bash")
+    (gnuplot "Gnuplot")
+    (ocaml "Caml") (caml "Caml")
+    (sql "SQL"))
+  "Alist mapping languages to their listing language counterpart.
+The key is a symbol, the major mode symbol without the \"-mode\".
+The value is the string that should be inserted as the language parameter
+for the listings package.  If the mode name and the listings name are
+the same, the language does not need an entry in this list - but it does not
+hurt if it is present."
   :group 'org-export-latex
-  :type 'plist)
+  :type '(repeat
+	  (list
+	   (symbol :tag "Major mode       ")
+	   (string :tag "Listings language"))))
 
 (defcustom org-export-latex-remove-from-headlines
   '(:todo nil :priority nil :tags nil)