From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] Revised my #+index preprocessor to fontify index entries. Date: Thu, 5 May 2011 10:30:56 +0200 Message-ID: <45456105-7E6D-4003-AE06-2D6018A82D63@gmail.com> References: <1304265709-1322-1-git-send-email-rpgoldman@sift.info> <2BF4FC2D-E342-4BAD-9E30-94804770785A@gmail.com> <4DC15048.3010108@sift.info> Mime-Version: 1.0 (Apple Message framework v1084) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Return-path: Received: from eggs.gnu.org ([140.186.70.92]:39825) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHtxe-0003Uo-8M for emacs-orgmode@gnu.org; Thu, 05 May 2011 04:31:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QHtxd-0003rE-2q for emacs-orgmode@gnu.org; Thu, 05 May 2011 04:31:02 -0400 Received: from mail-fx0-f41.google.com ([209.85.161.41]:41049) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QHtxc-0003qy-UZ for emacs-orgmode@gnu.org; Thu, 05 May 2011 04:31:01 -0400 Received: by fxm18 with SMTP id 18so1697433fxm.0 for ; Thu, 05 May 2011 01:30:59 -0700 (PDT) In-Reply-To: <4DC15048.3010108@sift.info> 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-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: rpgoldman@sift.info Cc: emacs-orgmode@gnu.org On 4.5.2011, at 15:10, Robert Goldman wrote: > On 5/4/11 May 4 -3:03 AM, Carsten Dominik wrote: >> Hi Robert, >>=20 >> I am rejecting this part of the patch for now. More thinking is = needed here, >> also about special characters etc. No sure yet what the right course = will be, >> but this is much too limited. >=20 > Carsten, >=20 > I don't fully understand the latex exporter, but I believe that > somewhere in it, LaTeX contexts are protected from translation. > Question: would it be possible to somehow mark the argument to = \index{} > as being NOT protected? If we could do that, I suspect the rest of = the > processing would run its course. >=20 > I am working on a manual so correct indexing of monospaced entries is > critical to me! ;-) I took another look, and your idea actually works, because the function = you used does do quite complete formatting. I have put this part back into the code. - Carsten >=20 > Best, > r >=20 >>=20 >> - Carsten >>=20 >>=20 >> On May 1, 2011, at 6:01 PM, rpgoldman@sift.info wrote: >>=20 >>> From: Robert P. Goldman >>>=20 >>> --- >>> The previous patch wasn't quite right because, e.g., it would index >>> #+INDEX: =3DClass=3D >>> as=20 >>> \\index{=3DClass=3D} >>> instead of >>> \\index{\texttt{Class}} >>> This patch attempts to fix that. >>>=20 >>> Question: would you prefer to have this reformulated as some kind = of unified patch >>> with the earlier one? >>>=20 >>> lisp/org-latex.el | 12 +++++++++--- >>> 1 files changed, 9 insertions(+), 3 deletions(-) >>>=20 >>> diff --git a/lisp/org-latex.el b/lisp/org-latex.el >>> index 731d6e6..b8f7019 100644 >>> --- a/lisp/org-latex.el >>> +++ b/lisp/org-latex.el >>> @@ -1,4 +1,4 @@ >>> -;;; org-latex.el --- LaTeX exporter for org-mode >>> +;; org-latex.el --- LaTeX exporter for org-mode >>> ;; >>> ;; Copyright (C) 2007, 2008, 2009, 2010 Free Software Foundation, = Inc. >>> ;; >>> @@ -2331,9 +2331,15 @@ The conversion is made depending of = STRING-BEFORE and STRING-AFTER." >>> (let ((case-fold-search t)) >>> (re-search-forward "^[ \t]*#\\+index:[ \t]*\\(.*?\\)[ \t]*$" = nil t)) >>> (> (match-end 1) (match-beginning 1))) >>> + ;; (message "Found a #+INDEX match...") >>> (let ((entry (match-string 1))) >>> -;; (message "Found a #+INDEX match...") >>> - (replace-match (format "\\index{%s}" entry) t t))) >>> + (replace-match (format "\\index{%s}" entry) t t) >>> + ;; now process font directives in the index entry >>> + (re-search-forward "^[ \t]*\\\\index{\\([^}]\\)}" nil t) >>> + ;; (message (format "Trying to fontify string %s" = (match-string 1))) >>> + (save-restriction >>> + (narrow-to-region (match-beginning 1) (match-end 1)) >>> + (org-export-latex-fontify)))) >>>=20 >>> ;; Convert center >>> (goto-char (point-min)) >>> --=20 >>> 1.7.3.5 >>>=20 >>>=20 >>=20 >> - Carsten >>=20 >>=20 >>=20 >=20