diff options
author | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-11-28 00:26:24 +0100 |
---|---|---|
committer | Nicolas Goaziou <mail@nicolasgoaziou.fr> | 2018-11-28 00:26:24 +0100 |
commit | e3fdef74b9092f7c8fc49013bfc7bb8d1ef5f72a (patch) | |
tree | a147832c7141dd4e7a7b25700aa25c7806699771 | |
parent | 3216cbe776900135c7ab5e1bbe4fc7cab921e9d5 (diff) | |
download | org-mode-e3fdef74b9092f7c8fc49013bfc7bb8d1ef5f72a.tar.gz |
Improve docstrings
* lisp/org.el (org-latex-default-packages-alist):
(org-latex-packages-alist): Improve docstring.
* lisp/ox-latex.el (org-latex--remove-packages): Small refactoring.
-rw-r--r-- | lisp/org.el | 15 | ||||
-rw-r--r-- | lisp/ox-latex.el | 31 |
2 files changed, 24 insertions, 22 deletions
diff --git a/lisp/org.el b/lisp/org.el index 3d239c8..8dddf02 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -4138,10 +4138,12 @@ A cell is of the format If SNIPPET-FLAG is non-nil, the package also needs to be included when compiling LaTeX snippets into images for inclusion into -non-LaTeX output. COMPILERS is a list of compilers that should -include the package, see `org-latex-compiler'. If the document -compiler is not in the list, and the list is non-nil, the package -will not be inserted in the final document. +non-LaTeX output. + +COMPILERS is a list of compilers that should include the package, +see `org-latex-compiler'. If the document compiler is not in the +list, and the list is non-nil, the package will not be inserted +in the final document. A string will be inserted as-is in the header of the document." :group 'org-latex @@ -4175,6 +4177,11 @@ SNIPPET-FLAG, when non-nil, indicates that this package is also needed when turning LaTeX snippets into images for inclusion into non-LaTeX output. +COMPILERS is a list of compilers that should include the package, +see `org-latex-compiler'. If the document compiler is not in the +list, and the list is non-nil, the package will not be inserted +in the final document. + A string will be inserted as-is in the header of the document. Make sure that you only list packages here which: diff --git a/lisp/ox-latex.el b/lisp/ox-latex.el index d4ceac9..2d77167 100644 --- a/lisp/ox-latex.el +++ b/lisp/ox-latex.el @@ -1440,26 +1440,21 @@ Return the new header." (defun org-latex--remove-packages (pkg-alist info) "Remove packages based on the current LaTeX compiler. -If the fourth argument of an element is set in pkg-alist, and it -is not a member of the LaTeX compiler of the document, the packages -is removed. See also `org-latex-compiler'. +PKG-ALIST is a list of packages, as in `org-latex-packages-alist' +and `org-latex-default-packages-alist'. If the fourth argument +of a package is neither nil nor a member of the LaTeX compiler +associated to the document, the package is removed. -Return modified pkg-alist." +Return new list of packages." (let ((compiler (or (plist-get info :latex-compiler) ""))) - (if (member-ignore-case compiler org-latex-compilers) - (delq nil - (mapcar - (lambda (pkg) - (unless (and - (listp pkg) - (let ((third (nth 3 pkg))) - (and third - (not (member-ignore-case - compiler - (if (listp third) third (list third))))))) - pkg)) - pkg-alist)) - pkg-alist))) + (if (not (member-ignore-case compiler org-latex-compilers)) pkg-alist + (cl-remove-if-not + (lambda (package) + (pcase package + (`(,_ ,_ ,_ nil) t) + (`(,_ ,_ ,_ ,compilers) (member-ignore-case compiler compilers)) + (_ t))) + pkg-alist)))) (defun org-latex--find-verb-separator (s) "Return a character not used in string S. |