From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Teemu Likonen Newsgroups: gmane.emacs.help Subject: Re: How to translate LaTeX into UTF-8 in Elisp? Date: Mon, 03 Jul 2017 11:37:22 +0300 Message-ID: <87bmp1ykzh.fsf@imladris.arda> References: <87shpyfj2q.fsf@mbork.pl> <87bmp2rud7.fsf@jane> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Trace: blaine.gmane.org 1499071191 22043 195.159.176.226 (3 Jul 2017 08:39:51 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Mon, 3 Jul 2017 08:39:51 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.1 (gnu/linux) Cc: Help Gnu Emacs mailing list To: Marcin Borkowski Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Mon Jul 03 10:39:46 2017 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1dRwtU-0005Kx-2L for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Jul 2017 10:39:44 +0200 Original-Received: from localhost ([::1]:33416 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dRwtZ-00026n-DV for geh-help-gnu-emacs@m.gmane.org; Mon, 03 Jul 2017 04:39:49 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36585) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1dRwrw-0001Tw-2r for help-gnu-emacs@gnu.org; Mon, 03 Jul 2017 04:38:09 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1dRwrs-00051C-W9 for help-gnu-emacs@gnu.org; Mon, 03 Jul 2017 04:38:08 -0400 Original-Received: from mail.kapsi.fi ([217.30.184.167]:52498) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1dRwrs-0004yn-Kf for help-gnu-emacs@gnu.org; Mon, 03 Jul 2017 04:38:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=kapsi.fi; s=20161220; h=Content-Type:MIME-Version:References:Message-ID:Date:In-Reply-To:Subject:Cc:To:From; bh=5xjoXiGKxG+XinfblN1ETscep/6MH/xCNoLgmAoJPQ0=; b=YprfnekPucTkvl2mxOMbSxG9XgYyT/vE55hc4hZWTsgq9qvMTKSjiuLV1yX9M/G1U22MJ45l/Q8O+fwK7lmfEaetLb6jUObgrot2/Wue7UwWSs9yAu4/igOF6NOMTuSSBapitHv7EKhPr+8F4FMV797rwoCCEZzgEVEaqNSFTeIiuYseSvnW3cA14qONJaTHQWzIg6c3yejRtfvN5Ww32ii41GTX3M2+aW7vA2xOxAvRqPYjl7BRvYPwcrgC6SmQgVs+NNAtwLRc7xbyFi+hEMWPQClJJOVDNR1VS6F3xfo6+pd7XvZK7h6PGOvCVQuIe4BWUOVhMvPGTG+bxkExKw==; Original-Received: from mobile-access-bcee0c-6.dhcp.inet.fi ([188.238.12.6] helo=imladris.arda) by mail.kapsi.fi with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dRwrm-0006a1-Oy; Mon, 03 Jul 2017 11:37:58 +0300 Original-Received: from dtw by imladris.arda with local (Exim 4.89) (envelope-from ) id 1dRwrm-0001Zt-4B; Mon, 03 Jul 2017 11:37:58 +0300 In-Reply-To: <87bmp2rud7.fsf@jane> (Marcin Borkowski's message of "Mon, 03 Jul 2017 06:56:36 +0200") X-SA-Exim-Connect-IP: 188.238.12.6 X-SA-Exim-Mail-From: tlikonen@iki.fi X-SA-Exim-Scanned: No (on mail.kapsi.fi); SAEximRunCond expanded to false X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 217.30.184.167 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:113666 Archived-At: --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Marcin Borkowski [2017-07-03 06:56:36+02] wrote: > On 2016-12-08, at 18:04, Marcin Borkowski wrote: >> I have a string with embedded sequences like "\'e" or "\H{o}". The >> Emacs TeX input method knows how to convert them into "=C3=A9" or "=C5= =91" (when >> typing, of course). Is there a way to use that to perform similar >> conversions in a string? > I'm revisiting this old thread now. > It is a horrible hack, but it should work. Any better ideas? I would filter buffer's content through recode command. [Highlight a region.] C-u M-x shell-command-on-region RET recode tex.. RET You wanted to do this for a string so we can write a function that uses a temporary buffer and returns its content as a string. Here is a quick example: (defun convert-from-latex (string) (with-temp-buffer (insert string) (call-process-region (point-min) (point-max) "recode" t t nil "tex..") (buffer-substring-no-properties (point-min) (point-max)))) =2D-=20 /// Teemu Likonen - .-.. // // PGP: 4E10 55DC 84E9 DFF6 13D7 8557 719D 69D3 2453 9450 /// --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEkhZiiC54Bnj5a16Skzo1BB5+rVEFAllaAkIACgkQkzo1BB5+ rVHWswf+Kuxb/zZH4fHIOgnqCxVwfKDfr12qU+A9MkYrVkkgc74jNyz85tAiSXTN I7Sn2mC08J09aPu9i9NatZ4vYZ858auKl1I0AMy8CK6D/iotrvFRMbpOHlNZUlUj PSRG6CrfmlomjMQqGmkGX9vG7KqUCQzhJBRcqV46YBePv2KtEGM+K0pF30RrA+5v ndf8z5wpJJ/CCGSyglMnlnOiMAweWdBshUldeBE20xJpq5mkF8aHZ+1el3fpZa/Z L386jfn0QEALzYwFuB1hUsjjR4EXuYzdV3xEtqbMrE+p+UdujUuVw/lXO0GwZOMP p0w5beqZS1h7wwNMoxL4rkVaD7BLIg== =CbO9 -----END PGP SIGNATURE----- --=-=-=--