summaryrefslogtreecommitdiff
path: root/lisp/ob-latex.el
diff options
context:
space:
mode:
authorAaron Ecay <aaronecay@gmail.com>2016-08-24 16:05:54 +0100
committerAaron Ecay <aaronecay@gmail.com>2016-08-24 16:05:54 +0100
commit6b52bc6a2153a8c60d23d0915246a60d3ee37a52 (patch)
tree7c22f92b76d47ea0bda99a902d9dd9af9df8d1a8 /lisp/ob-latex.el
parent9873e59913b696d9ece019dee4696cd0365c939c (diff)
Clean up string handling.
* lisp/org-compat.el (string-prefix-p, string-suffix-p): Add compatibility definitions for 24.3. * lisp/ob-R.el (org-babel-edit-prep:R): * lisp/ob-core.el (org-babel-demarcate-block): * lisp/ob-js.el (org-babel-js-read): * lisp/ob-latex.el (org-babel-execute:latex): * lisp/ob-ref.el (org-babel-ref-parse): * lisp/ob-shell.el (org-babel-variable-assignments:shell): * lisp/org-protocol.el (org-protocol-create): * lisp/org-table.el (org-table-field-info): * lisp/org.el (org-get-buffer-for-internal-link): * lisp/ox-publish.el (org-publish-compare-directory-files): * lisp/ox-texinfo.el (org-texinfo-template): Use `string-{suffix,prefix}-p' instead of `string-match(-p)'. * lisp/ob-python.el (org-babel-python-read-string): Ditto, also use `substring' rather than `match-string'. * lisp/org-table.el (org-table-copy-down): (org-table-insert-hline, org-table-current-field-formula): (org-table-get-formula): Use `string-match-p' instead of `string-match'.
Diffstat (limited to 'lisp/ob-latex.el')
-rw-r--r--lisp/ob-latex.el14
1 files changed, 7 insertions, 7 deletions
diff --git a/lisp/ob-latex.el b/lisp/ob-latex.el
index a11e6e1ea..e4327a2e5 100644
--- a/lisp/ob-latex.el
+++ b/lisp/ob-latex.el
@@ -106,15 +106,15 @@ This function is called by `org-babel-execute-src-block'."
(org-latex-packages-alist
(append (cdr (assoc :packages params)) org-latex-packages-alist)))
(cond
- ((and (string-match "\\.png$" out-file) (not imagemagick))
+ ((and (string-suffix-p ".png" out-file) (not imagemagick))
(org-create-formula-image
body out-file org-format-latex-options in-buffer))
- ((string-match "\\.tikz$" out-file)
+ ((string-suffix-p ".tikz" out-file)
(when (file-exists-p out-file) (delete-file out-file))
(with-temp-file out-file
(insert body)))
- ((and (or (string-match "\\.svg$" out-file)
- (string-match "\\.html$" out-file))
+ ((and (or (string-suffix-p ".svg" out-file)
+ (string-suffix-p ".html" out-file))
(executable-find org-babel-latex-htlatex))
;; TODO: this is a very different way of generating the
;; frame latex document than in the pdf case. Ideally, both
@@ -144,7 +144,7 @@ This function is called by `org-babel-execute-src-block'."
(shell-command (format "%s %s" org-babel-latex-htlatex tex-file)))
(cond
((file-exists-p (concat (file-name-sans-extension tex-file) "-1.svg"))
- (if (string-match "\\.svg$" out-file)
+ (if (string-suffix-p ".svg" out-file)
(progn
(shell-command "pwd")
(shell-command (format "mv %s %s"
@@ -152,13 +152,13 @@ This function is called by `org-babel-execute-src-block'."
out-file)))
(error "SVG file produced but HTML file requested")))
((file-exists-p (concat (file-name-sans-extension tex-file) ".html"))
- (if (string-match "\\.html$" out-file)
+ (if (string-suffix-p ".html" out-file)
(shell-command "mv %s %s"
(concat (file-name-sans-extension tex-file)
".html")
out-file)
(error "HTML file produced but SVG file requested")))))
- ((or (string-match "\\.pdf$" out-file) imagemagick)
+ ((or (string-suffix-p ".pdf" out-file) imagemagick)
(with-temp-file tex-file
(require 'ox-latex)
(insert