emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: rpgoldman@sift.info
To: emacs-orgmode@gnu.org
Cc: "Robert P. Goldman" <rpgoldman@real-time.com>
Subject: [PATCH] Revised my #+index preprocessor to fontify index entries.
Date: Sun,  1 May 2011 11:01:49 -0500	[thread overview]
Message-ID: <1304265709-1322-1-git-send-email-rpgoldman@sift.info> (raw)

From: Robert P. Goldman <rpgoldman@real-time.com>

---
The previous patch wasn't quite right because, e.g., it would index
#+INDEX: =Class=
as 
\\index{=Class=}
instead of
\\index{\texttt{Class}}
This patch attempts to fix that.

Question:  would you prefer to have this reformulated as some kind of unified patch
with the earlier one?

 lisp/org-latex.el |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

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))))
 
   ;; Convert center
   (goto-char (point-min))
-- 
1.7.3.5

             reply	other threads:[~2011-05-01 16:02 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-01 16:01 rpgoldman [this message]
2011-05-04  8:03 ` [PATCH] Revised my #+index preprocessor to fontify index entries Carsten Dominik
2011-05-04 13:10   ` Robert Goldman
2011-05-05  8:30     ` Carsten Dominik

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1304265709-1322-1-git-send-email-rpgoldman@sift.info \
    --to=rpgoldman@sift.info \
    --cc=emacs-orgmode@gnu.org \
    --cc=rpgoldman@real-time.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).