all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Revised my #+index preprocessor to fontify index entries.
@ 2011-05-01 16:01 rpgoldman
  2011-05-04  8:03 ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: rpgoldman @ 2011-05-01 16:01 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Robert P. Goldman

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

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] Revised my #+index preprocessor to fontify index entries.
  2011-05-01 16:01 [PATCH] Revised my #+index preprocessor to fontify index entries rpgoldman
@ 2011-05-04  8:03 ` Carsten Dominik
  2011-05-04 13:10   ` Robert Goldman
  0 siblings, 1 reply; 4+ messages in thread
From: Carsten Dominik @ 2011-05-04  8:03 UTC (permalink / raw)
  To: rpgoldman; +Cc: Robert P. Goldman, emacs-orgmode

Hi Robert,

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.

- Carsten


On May 1, 2011, at 6:01 PM, rpgoldman@sift.info wrote:

> 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
> 
> 

- Carsten

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Revised my #+index preprocessor to fontify index entries.
  2011-05-04  8:03 ` Carsten Dominik
@ 2011-05-04 13:10   ` Robert Goldman
  2011-05-05  8:30     ` Carsten Dominik
  0 siblings, 1 reply; 4+ messages in thread
From: Robert Goldman @ 2011-05-04 13:10 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

On 5/4/11 May 4 -3:03 AM, Carsten Dominik wrote:
> Hi Robert,
> 
> 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.

Carsten,

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.

I am working on a manual so correct indexing of monospaced entries is
critical to me! ;-)

Best,
r

> 
> - Carsten
> 
> 
> On May 1, 2011, at 6:01 PM, rpgoldman@sift.info wrote:
> 
>> 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
>>
>>
> 
> - Carsten
> 
> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] Revised my #+index preprocessor to fontify index entries.
  2011-05-04 13:10   ` Robert Goldman
@ 2011-05-05  8:30     ` Carsten Dominik
  0 siblings, 0 replies; 4+ messages in thread
From: Carsten Dominik @ 2011-05-05  8:30 UTC (permalink / raw)
  To: rpgoldman; +Cc: emacs-orgmode


On 4.5.2011, at 15:10, Robert Goldman wrote:

> On 5/4/11 May 4 -3:03 AM, Carsten Dominik wrote:
>> Hi Robert,
>> 
>> 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.
> 
> Carsten,
> 
> 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.
> 
> 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

> 
> Best,
> r
> 
>> 
>> - Carsten
>> 
>> 
>> On May 1, 2011, at 6:01 PM, rpgoldman@sift.info wrote:
>> 
>>> 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
>>> 
>>> 
>> 
>> - Carsten
>> 
>> 
>> 
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-05-05  8:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-01 16:01 [PATCH] Revised my #+index preprocessor to fontify index entries rpgoldman
2011-05-04  8:03 ` Carsten Dominik
2011-05-04 13:10   ` Robert Goldman
2011-05-05  8:30     ` Carsten Dominik

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.