From mboxrd@z Thu Jan 1 00:00:00 1970 From: John Kitchin Subject: Re: filter for svg latex-export Date: Mon, 08 Jan 2018 22:34:06 -0500 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:47420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eYkg4-0003ZB-2F for emacs-orgmode@gnu.org; Mon, 08 Jan 2018 22:34:17 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eYkfz-0003AF-5g for emacs-orgmode@gnu.org; Mon, 08 Jan 2018 22:34:16 -0500 Received: from mail-qt0-x22f.google.com ([2607:f8b0:400d:c0d::22f]:37482) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eYkfy-00039S-Vb for emacs-orgmode@gnu.org; Mon, 08 Jan 2018 22:34:11 -0500 Received: by mail-qt0-x22f.google.com with SMTP id f2so16275715qtj.4 for ; Mon, 08 Jan 2018 19:34:10 -0800 (PST) In-reply-to: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: edgar@openmail.cc Cc: emacs-orgmode@gnu.org If all you are doing is replacing includesvg with simplesvg, then you might try this: #+BEGIN_SRC emacs-lisp (let ((org-export-filter-link-functions '((lambda (txt _ _) (replace-regexp-in-string "includesvg" "simplesvg" txt))))) (org-latex-export-as-latex)) #+END_SRC If you are doing more than that (it looks like you are adding options?) then one alternative option is just put a copy of your modified function in your init file after you load org, and then it will shadow the ox-latex function and you might not have to change anything when you update as long as no incompatible changes are in the update. I know, that is hacky, but it works in cases like this. edgar@openmail.cc writes: > Hello, > > I once tried to create a filter (is that the name?) to modify the > function which exports SVG files. Verdict: I suck! Thus, I keep > modifying the ox-latex.el every time that I upgrade (see attached). > Would someone please tell me what is the right way to achieve that > (without modifying the code, please? Thanks! > > ------------------------------------------------- > > ONLY AT VFEmail! - Use our Metadata Mitigator to keep your email out of the NSA's hands! > $24.95 ONETIME Lifetime accounts with Privacy Features! > 15GB disk! No bandwidth quotas! > Commercial and Bulk Mail Options! *** org-20180103/ox-latex.el 2018-01-07 16:53:43.477464348 -0700 > --- plugins/ox-latex.el 2018-01-07 16:39:52.117462098 -0700 > *************** > *** 2425,2434 **** > (t (format "[%s]" options))) > path)) > (when (equal filetype "svg") > ! (setq image-code (replace-regexp-in-string "^\\\\includegraphics" > ! "\\includesvg" > ! image-code > ! nil t)) > (setq image-code (replace-regexp-in-string "\\.svg}" > "}" > image-code > --- 2425,2437 ---- > (t (format "[%s]" options))) > path)) > (when (equal filetype "svg") > ! (setq image-code > ! (format "\\simplesvg%s{%s}" > ! (cond ((not (org-string-nw-p options)) "") > ! ((string-prefix-p "," options) > ! (format "{%s}" (substring options 1))) > ! (t (format "{%s}" options))) > ! path)) > (setq image-code (replace-regexp-in-string "\\.svg}" > "}" > image-code -- Professor John Kitchin Doherty Hall A207F Department of Chemical Engineering Carnegie Mellon University Pittsburgh, PA 15213 412-268-7803 @johnkitchin http://kitchingroup.cheme.cmu.edu