emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orgmode] Exporting non utf8 org documents


From: Francesco Pizzolante
Subject: Re: [Orgmode] Exporting non utf8 org documents
Date: Mon, 22 Mar 2010 15:20:56 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (windows-nt)

Hi Carsten,

I'm sorry for my very very late reply on this topic, but I'm just observing
problem with this.

> you can remove the code I sent you again, and instead grab the latest git
> release.
>
> Then you can also do
>
> (setq org-export-latex-inputenc-alist '(("utf8" . "utf8x")))
>
> to get utf8x instead of utf8.

I still get the utf8 encoding even if, as you said, I set this:

--8<---------------cut here---------------start------------->8---
(setq org-export-latex-inputenc-alist '(("utf8" . "utf8x")))
--8<---------------cut here---------------end--------------->8---


So, we get the following code:

--8<---------------cut here---------------start------------->8---
(defun org-export-latex-fix-inputenc ()
  "Set the codingsystem in inputenc to what the buffer is."
  (let* ((cs buffer-file-coding-system)
         (opt (or (ignore-errors (latexenc-coding-system-to-inputenc cs))
                  "utf8")))
    (when opt
      ;; Translate if that is requested
      (setq opt (or (cdr (assoc opt org-export-latex-inputenc-alist)) opt))
      ;; find the \usepackage statement and replace the option
      (goto-char (point-min))
      (while (re-search-forward "\\\\usepackage\\[\\(AUTO\\)\\]{inputenc}"
                                nil t)
        (goto-char (match-beginning 1))
        (delete-region (match-beginning 1) (match-end 1))
        (insert opt))
      (and buffer-file-name
           (save-buffer)))))
--8<---------------cut here---------------end--------------->8---

If I print the opt variable (message opt), I can see that its value is
correctly set to utf8x.

But, the re-search-forward command always fails. In effect, if I change the
last argument from t to nil, I get the following error:

--8<---------------cut here---------------start------------->8---
while: Search failed: "\\\\usepackage\\[\\(AUTO\\)\\]{inputenc}"
--8<---------------cut here---------------end--------------->8---

I'm using an almost empty Org buffer with no option at all, so it generates a
simple article document class.

I would like to give you more input, but I don't know how to better debug
this. If you have any idea, please let me know.

Thanks a lot,
Francesco




reply via email to

[Prev in Thread] Current Thread [Next in Thread]