emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Translate #+INDEX to Latex \index{} on export
@ 2011-04-28 11:47 rpgoldman
  2011-04-28 11:47 ` [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index rpgoldman
  0 siblings, 1 reply; 16+ messages in thread
From: rpgoldman @ 2011-04-28 11:47 UTC (permalink / raw)
  To: emacs-orgmode

The following email contains a patch that will cause the latex export
preprocessor to rewrite #+INDEX: lines in an org file into LaTeX style
\index{} entries.

As far as I can tell, this should be The Right Thing --- latex doesn't seem
to do anything bad if there are index entries without makeindex.  So no
downside.  And it doesn't seem right to have to do #+INDEX for HTML export
and #+LATEX: \index{} for latex export.

I believe that this should be complemented by some additional code that
would:

1. Add code to turn on and off index generation and appropriately add the
makeindex package and the \makeindex

2. Possibly add code to turn /off/ this translation in the case where the
user wishes to have HTML and Latex documents indexed differently.

Cheers,
r

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

* [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index.
  2011-04-28 11:47 Translate #+INDEX to Latex \index{} on export rpgoldman
@ 2011-04-28 11:47 ` rpgoldman
  2011-04-28 12:33   ` Nick Dokos
                     ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: rpgoldman @ 2011-04-28 11:47 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Robert P. Goldman

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

---
 lisp/org-latex.el |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/lisp/org-latex.el b/lisp/org-latex.el
index e7307ef..731d6e6 100644
--- a/lisp/org-latex.el
+++ b/lisp/org-latex.el
@@ -1775,6 +1775,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
 	(end-of-line 1)
 	(insert "\n")))))
 
+
+
 (defun org-export-latex-fixed-width (opt)
   "When OPT is non-nil convert fixed-width sections to LaTeX."
   (goto-char (point-min))
@@ -2322,6 +2324,17 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
     (and (looking-at "[ \t]*ORG-VERSE-END.*")
 	 (org-replace-match-keep-properties "\\end{verse}" t t)))
 
+  ;; Convert #+INDEX to LaTeX \\index.
+  (goto-char (point-min))
+  (while
+      (and
+       (let ((case-fold-search t))
+	 (re-search-forward "^[ \t]*#\\+index:[ \t]*\\(.*?\\)[ \t]*$" nil t))
+       (> (match-end 1) (match-beginning 1)))
+    (let ((entry (match-string 1)))
+;;      (message "Found a #+INDEX match...")
+      (replace-match (format "\\index{%s}" entry) t t)))
+
   ;; Convert center
   (goto-char (point-min))
   (while (search-forward "ORG-CENTER-START" nil t)
-- 
1.7.3.5

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

* Re: [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index.
  2011-04-28 11:47 ` [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index rpgoldman
@ 2011-04-28 12:33   ` Nick Dokos
  2011-04-28 15:23     ` Robert Goldman
                       ` (2 more replies)
  2011-04-29 21:45   ` Bug Re: [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index Robert Goldman
  2011-05-04  7:59   ` [Accepted] " Carsten Dominik
  2 siblings, 3 replies; 16+ messages in thread
From: Nick Dokos @ 2011-04-28 12:33 UTC (permalink / raw)
  To: rpgoldman; +Cc: Robert P. Goldman, nicholas.dokos, emacs-orgmode

rpgoldman@sift.info wrote:

> From: Robert P. Goldman <rpgoldman@real-time.com>
> 
> ---
>  lisp/org-latex.el |   13 +++++++++++++
>  1 files changed, 13 insertions(+), 0 deletions(-)
>  ...

Very nice! Did a small test and it works as advertised.

Suggestion: maybe add an "I" easy template for it? This can be done
per-user of course, so it is not strictly necessary and easy templates
are experimental anyway, but it might be a good idea to reserve the "I"
for this.  Actually, it might be better to reserve "i" for this and
shift the include to "I", since there will only be a few includes but
potentially hundreds of index entries in a file.

Thanks,
Nick

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

* Re: [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index.
  2011-04-28 12:33   ` Nick Dokos
@ 2011-04-28 15:23     ` Robert Goldman
  2011-04-28 15:29       ` Robert Goldman
  2011-04-28 15:38     ` Patch --- adding an easy template for #+index rpgoldman
  2011-04-28 15:38     ` [PATCH] Add an easy template for index (i), and move include file to I from i rpgoldman
  2 siblings, 1 reply; 16+ messages in thread
From: Robert Goldman @ 2011-04-28 15:23 UTC (permalink / raw)
  To: nicholas.dokos; +Cc: emacs-orgmode, rpgoldman

On 4/28/11 Apr 28 -7:33 AM, Nick Dokos wrote:
> rpgoldman@sift.info wrote:
> 
>> From: Robert P. Goldman <rpgoldman@real-time.com>
>>
>> ---
>>  lisp/org-latex.el |   13 +++++++++++++
>>  1 files changed, 13 insertions(+), 0 deletions(-)
>>  ...
> 
> Very nice! Did a small test and it works as advertised.
> 
> Suggestion: maybe add an "I" easy template for it? This can be done
> per-user of course, so it is not strictly necessary and easy templates
> are experimental anyway, but it might be a good idea to reserve the "I"
> for this.  Actually, it might be better to reserve "i" for this and
> shift the include to "I", since there will only be a few includes but
> potentially hundreds of index entries in a file.

I'm not sure that this is feasible.  I tried doing this and as far as I
can tell the template matching is not case-sensitive.  I could wrap the
string-match there in a

(let ((case-fold-search nil))
  ...)

but I'd like some advice from a core maintainer before doing this (I'll
check in on IRC, too).

I've got a patch ready if that's the right way to go.

cheers,
r

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

* Re: [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index.
  2011-04-28 15:23     ` Robert Goldman
@ 2011-04-28 15:29       ` Robert Goldman
  0 siblings, 0 replies; 16+ messages in thread
From: Robert Goldman @ 2011-04-28 15:29 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: nicholas.dokos

My mistake -- I made the template wrong; it wasn't a case-fold issue,
after all.

I have a patch that will do this now.  Will post it soon.

Cheers,
r

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

* Patch --- adding an easy template for #+index
  2011-04-28 12:33   ` Nick Dokos
  2011-04-28 15:23     ` Robert Goldman
@ 2011-04-28 15:38     ` rpgoldman
  2011-04-28 19:11       ` Bernt Hansen
  2011-04-28 15:38     ` [PATCH] Add an easy template for index (i), and move include file to I from i rpgoldman
  2 siblings, 1 reply; 16+ messages in thread
From: rpgoldman @ 2011-04-28 15:38 UTC (permalink / raw)
  To: emacs-orgmode


The next message will contain a patch that provides a new easy template for adding index entries, per Nick Dokos's suggestion.

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

* [PATCH] Add an easy template for index (i), and move include file to I from i.
  2011-04-28 12:33   ` Nick Dokos
  2011-04-28 15:23     ` Robert Goldman
  2011-04-28 15:38     ` Patch --- adding an easy template for #+index rpgoldman
@ 2011-04-28 15:38     ` rpgoldman
  2011-05-04  7:49       ` [Accepted] " Carsten Dominik
  2 siblings, 1 reply; 16+ messages in thread
From: rpgoldman @ 2011-04-28 15:38 UTC (permalink / raw)
  To: emacs-orgmode; +Cc: Robert P. Goldman

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

Implement Nick Dokos' suggestion for inserting #+INDEX.

Notes about this patch:
1.  It breaks some old user-visible behavior, since <i changes meaning.
    Per Nick's posting, we expect that if index is used, it will be used
    more commonly than include file.  However, since this is a custom,
    behavior could be changed.  Indeed, we could put index on capital
    I with a suggestion that users who are indexing should swap in their
    customizations.
2.  I modified the docstring for org-structure-template-alist, which did
    not explain the function of the "?" in the string.  Someone should
    check and verify I didn't get this wrong.
3.  There doesn't seem to be a Muse tag equivalent for #+index, so I
    just made the Muse equivalent of #+index be #+index.  I don't know
    org-mtags enough to know if this is appropriate.
---
 lisp/org.el |    9 ++++++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/org.el b/lisp/org.el
index e17c90f..fdff7ef 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -10753,14 +10753,17 @@ This function can be used in a hook."
          "<literal style=\"html\">?</literal>")
     ("a" "#+begin_ascii\n?\n#+end_ascii")
     ("A" "#+ascii: ")
-    ("i" "#+include %file ?"
+    ("i" "#+index: ?"
+     "#+index: ?")
+    ("I" "#+include %file ?"
          "<include file=%file markup=\"?\">")
     )
   "Structure completion elements.
 This is a list of abbreviation keys and values.  The value gets inserted
 if you type `<' followed by the key and then press the completion key,
 usually `M-TAB'.  %file will be replaced by a file name after prompting
-for the file using completion.
+for the file using completion.  The cursor will be placed at the position
+of the `?` in the template.
 There are two templates for each key, the first uses the original Org syntax,
 the second uses Emacs Muse-like syntax tags.  These Muse-like tags become
 the default when the /org-mtags.el/ module has been loaded.  See also the
@@ -10779,7 +10782,7 @@ expands them."
   (let ((l (buffer-substring (point-at-bol) (point)))
 	a)
     (when (and (looking-at "[ \t]*$")
-	       (string-match "^[ \t]*<\\([a-z]+\\)$"l)
+	       (string-match "^[ \t]*<\\([a-zA-Z]+\\)$" l)
 	       (setq a (assoc (match-string 1 l) org-structure-template-alist)))
       (org-complete-expand-structure-template (+ -1 (point-at-bol)
 						 (match-beginning 1)) a)
-- 
1.7.3.5

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

* Re: Patch --- adding an easy template for #+index
  2011-04-28 15:38     ` Patch --- adding an easy template for #+index rpgoldman
@ 2011-04-28 19:11       ` Bernt Hansen
  2011-04-28 19:59         ` Robert Goldman
  0 siblings, 1 reply; 16+ messages in thread
From: Bernt Hansen @ 2011-04-28 19:11 UTC (permalink / raw)
  To: rpgoldman; +Cc: emacs-orgmode

rpgoldman@sift.info writes:

> The next message will contain a patch that provides a new easy template for adding index entries, per Nick Dokos's suggestion.

Hi Robert,

Just a FYI: you can include the above information right in your patch
after the --- and before the diffstat like this:

--8<---------------cut here---------------start------------->8---
...
    just made the Muse equivalent of #+index be #+index.  I don't know
    org-mtags enough to know if this is appropriate.
---
The next message will contain a patch that provides a new easy template
for adding index entries, per Nick Dokos's suggestion.

Any text you put in here after the '---' and before the diffstat is
discarded by the git tools that apply the patch.  This is a great place
to add extra comments and details that do not belong in the commit
message itself.

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

diff --git a/lisp/org.el b/lisp/org.el
...
--8<---------------cut here---------------end--------------->8---

Regards,
Bernt

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

* Re: Patch --- adding an easy template for #+index
  2011-04-28 19:11       ` Bernt Hansen
@ 2011-04-28 19:59         ` Robert Goldman
  2011-04-28 21:31           ` Bernt Hansen
  0 siblings, 1 reply; 16+ messages in thread
From: Robert Goldman @ 2011-04-28 19:59 UTC (permalink / raw)
  To: Bernt Hansen; +Cc: emacs-orgmode

On 4/28/11 Apr 28 -2:11 PM, Bernt Hansen wrote:
> rpgoldman@sift.info writes:
> 
>> The next message will contain a patch that provides a new easy template for adding index entries, per Nick Dokos's suggestion.
> 
> Hi Robert,
> 
> Just a FYI: you can include the above information right in your patch
> after the --- and before the diffstat like this:

I have been using git send-email, and the only option I understand is
the --compose one, which generates these predecessor emails.  Are you
sending an email with a different client and then attaching the patch
files?  Or something else?

> 
> --8<---------------cut here---------------start------------->8---
> ...
>     just made the Muse equivalent of #+index be #+index.  I don't know
>     org-mtags enough to know if this is appropriate.
> ---
> The next message will contain a patch that provides a new easy template
> for adding index entries, per Nick Dokos's suggestion.
> 
> Any text you put in here after the '---' and before the diffstat is
> discarded by the git tools that apply the patch.  This is a great place
> to add extra comments and details that do not belong in the commit
> message itself.
> 
>  lisp/org.el |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/lisp/org.el b/lisp/org.el
> ...
> --8<---------------cut here---------------end--------------->8---
> 
> Regards,
> Bernt

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

* Re: Patch --- adding an easy template for #+index
  2011-04-28 19:59         ` Robert Goldman
@ 2011-04-28 21:31           ` Bernt Hansen
  0 siblings, 0 replies; 16+ messages in thread
From: Bernt Hansen @ 2011-04-28 21:31 UTC (permalink / raw)
  To: rpgoldman; +Cc: emacs-orgmode

Robert Goldman <rpgoldman@sift.info> writes:

> On 4/28/11 Apr 28 -2:11 PM, Bernt Hansen wrote:
>> rpgoldman@sift.info writes:
>> 
>>> The next message will contain a patch that provides a new easy template for adding index entries, per Nick Dokos's suggestion.
>> 
>> Hi Robert,
>> 
>> Just a FYI: you can include the above information right in your patch
>> after the --- and before the diffstat like this:
>
> I have been using git send-email, and the only option I understand is
> the --compose one, which generates these predecessor emails.  Are you
> sending an email with a different client and then attaching the patch
> files?  Or something else?

To send a single patch I use

git send-email --annotate -1

which drops the patch in an editor before it is sent out.  I just add
the extra details between the --- and diffstat before the email is sent
to the list.

--annotate just means you want to edit (annotate) the message before it
gets sent.

HTH,
Bernt

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

* Bug Re: [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index.
  2011-04-28 11:47 ` [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index rpgoldman
  2011-04-28 12:33   ` Nick Dokos
@ 2011-04-29 21:45   ` Robert Goldman
  2011-05-04  7:59   ` [Accepted] " Carsten Dominik
  2 siblings, 0 replies; 16+ messages in thread
From: Robert Goldman @ 2011-04-29 21:45 UTC (permalink / raw)
  To: emacs-orgmode

Drat.  This patch isn't quite right; it mis-handles typeface
specifications.  E.g.

#+index: =Class=

generates an index entry for =Class= instead of an entry for "Class" set
in monospace font.

Maybe someone who understands the intricacies of exporting can figure
out a fix.  The problem is likely to be the fact that my \index{=Class=}
is protected from the font rewriting.

Any suggestions?

Best,
r

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

* [Accepted]  Add an easy template for index (i), and move include file to I from i.
  2011-04-28 15:38     ` [PATCH] Add an easy template for index (i), and move include file to I from i rpgoldman
@ 2011-05-04  7:49       ` Carsten Dominik
  0 siblings, 0 replies; 16+ messages in thread
From: Carsten Dominik @ 2011-05-04  7:49 UTC (permalink / raw)
  To: emacs-orgmode

Patch 768 (http://patchwork.newartisans.com/patch/768/) is now "Accepted".

Maintainer comment: I added documentation in org.texi

This relates to the following submission:

http://mid.gmane.org/%3C1304005134-31639-2-git-send-email-rpgoldman%40sift.info%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [O] Add an easy template for index (i),
> 	and move include file to I from i.
> Date: Thu, 28 Apr 2011 20:38:54 -0000
> From: Robert Goldman <rpgoldman@sift.info>
> X-Patchwork-Id: 768
> Message-Id: <1304005134-31639-2-git-send-email-rpgoldman@sift.info>
> To: emacs-orgmode@gnu.org
> Cc: "Robert P. Goldman" <rpgoldman@real-time.com>
> 
> From: Robert P. Goldman <rpgoldman@real-time.com>
> 
> Implement Nick Dokos' suggestion for inserting #+INDEX.
> 
> Notes about this patch:
> 1.  It breaks some old user-visible behavior, since <i changes meaning.
>     Per Nick's posting, we expect that if index is used, it will be used
>     more commonly than include file.  However, since this is a custom,
>     behavior could be changed.  Indeed, we could put index on capital
>     I with a suggestion that users who are indexing should swap in their
>     customizations.
> 2.  I modified the docstring for org-structure-template-alist, which did
>     not explain the function of the "?" in the string.  Someone should
>     check and verify I didn't get this wrong.
> 3.  There doesn't seem to be a Muse tag equivalent for #+index, so I
>     just made the Muse equivalent of #+index be #+index.  I don't know
>     org-mtags enough to know if this is appropriate.
> 
> ---
> lisp/org.el |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/lisp/org.el b/lisp/org.el
> index e17c90f..fdff7ef 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -10753,14 +10753,17 @@ This function can be used in a hook."
>           "<literal style=\"html\">?</literal>")
>      ("a" "#+begin_ascii\n?\n#+end_ascii")
>      ("A" "#+ascii: ")
> -    ("i" "#+include %file ?"
> +    ("i" "#+index: ?"
> +     "#+index: ?")
> +    ("I" "#+include %file ?"
>           "<include file=%file markup=\"?\">")
>      )
>    "Structure completion elements.
>  This is a list of abbreviation keys and values.  The value gets inserted
>  if you type `<' followed by the key and then press the completion key,
>  usually `M-TAB'.  %file will be replaced by a file name after prompting
> -for the file using completion.
> +for the file using completion.  The cursor will be placed at the position
> +of the `?` in the template.
>  There are two templates for each key, the first uses the original Org syntax,
>  the second uses Emacs Muse-like syntax tags.  These Muse-like tags become
>  the default when the /org-mtags.el/ module has been loaded.  See also the
> @@ -10779,7 +10782,7 @@ expands them."
>    (let ((l (buffer-substring (point-at-bol) (point)))
>  	a)
>      (when (and (looking-at "[ \t]*$")
> -	       (string-match "^[ \t]*<\\([a-z]+\\)$"l)
> +	       (string-match "^[ \t]*<\\([a-zA-Z]+\\)$" l)
>  	       (setq a (assoc (match-string 1 l) org-structure-template-alist)))
>        (org-complete-expand-structure-template (+ -1 (point-at-bol)
>  						 (match-beginning 1)) a)
> 

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

* [Accepted] Make the latex export preprocessor rewrite #+INDEX to \index.
  2011-04-28 11:47 ` [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index rpgoldman
  2011-04-28 12:33   ` Nick Dokos
  2011-04-29 21:45   ` Bug Re: [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index Robert Goldman
@ 2011-05-04  7:59   ` Carsten Dominik
  2011-05-04 15:08     ` Robert Goldman
  2 siblings, 1 reply; 16+ messages in thread
From: Carsten Dominik @ 2011-05-04  7:59 UTC (permalink / raw)
  To: emacs-orgmode

Patch 767 (http://patchwork.newartisans.com/patch/767/) is now "Accepted".

Maintainer comment: Pushed with modifications.  Some optimization, and the original patch would have stopped at the first #+index line that was missing the entry...  Please verify that it still works

This relates to the following submission:

http://mid.gmane.org/%3C1303991243-30731-2-git-send-email-rpgoldman%40sift.info%3E

Here is the original message containing the patch:

> Content-Type: text/plain; charset="utf-8"
> MIME-Version: 1.0
> Content-Transfer-Encoding: 7bit
> Subject: [O] Make the latex export preprocessor rewrite #+INDEX to \index.
> Date: Thu, 28 Apr 2011 16:47:23 -0000
> From: Robert Goldman <rpgoldman@sift.info>
> X-Patchwork-Id: 767
> Message-Id: <1303991243-30731-2-git-send-email-rpgoldman@sift.info>
> To: emacs-orgmode@gnu.org
> Cc: "Robert P. Goldman" <rpgoldman@real-time.com>
> 
> From: Robert P. Goldman <rpgoldman@real-time.com>
> 
> ---
> lisp/org-latex.el |   13 +++++++++++++
>  1 files changed, 13 insertions(+), 0 deletions(-)
> 
> diff --git a/lisp/org-latex.el b/lisp/org-latex.el
> index e7307ef..731d6e6 100644
> --- a/lisp/org-latex.el
> +++ b/lisp/org-latex.el
> @@ -1775,6 +1775,8 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
>  	(end-of-line 1)
>  	(insert "\n")))))
>  
> +
> +
>  (defun org-export-latex-fixed-width (opt)
>    "When OPT is non-nil convert fixed-width sections to LaTeX."
>    (goto-char (point-min))
> @@ -2322,6 +2324,17 @@ The conversion is made depending of STRING-BEFORE and STRING-AFTER."
>      (and (looking-at "[ \t]*ORG-VERSE-END.*")
>  	 (org-replace-match-keep-properties "\\end{verse}" t t)))
>  
> +  ;; Convert #+INDEX to LaTeX \\index.
> +  (goto-char (point-min))
> +  (while
> +      (and
> +       (let ((case-fold-search t))
> +	 (re-search-forward "^[ \t]*#\\+index:[ \t]*\\(.*?\\)[ \t]*$" nil t))
> +       (> (match-end 1) (match-beginning 1)))
> +    (let ((entry (match-string 1)))
> +;;      (message "Found a #+INDEX match...")
> +      (replace-match (format "\\index{%s}" entry) t t)))
> +
>    ;; Convert center
>    (goto-char (point-min))
>    (while (search-forward "ORG-CENTER-START" nil t)
> 

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

* Re: [Accepted] Make the latex export preprocessor rewrite #+INDEX to \index.
  2011-05-04  7:59   ` [Accepted] " Carsten Dominik
@ 2011-05-04 15:08     ` Robert Goldman
  2011-05-04 22:36       ` Carsten Dominik
  0 siblings, 1 reply; 16+ messages in thread
From: Robert Goldman @ 2011-05-04 15:08 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

On 5/4/11 May 4 -2:59 AM, Carsten Dominik wrote:
> Patch 767 (http://patchwork.newartisans.com/patch/767/) is now "Accepted".
> 
> Maintainer comment: Pushed with modifications.  Some optimization, and the original patch would have stopped at the first #+index line that was missing the entry...  Please verify that it still works
> 
> This relates to the following submission:
> 
> http://mid.gmane.org/%3C1303991243-30731-2-git-send-email-rpgoldman%40sift.info%3E

I think there's a minor problem with the patch.  AFAICT, it binds the
local variable 'entry' but does not read it (instead it uses the match
text directly).

As an aside, it might be desirable to handle the empty index case that
you identified.  E.g.,

(if (> (match-end 1) (match-beginning 1))
    ...rewrite the index entry...
    ;; else
    emit a warning
    rewrite the index entry as the empty string
)

Hope that helps,
Robert

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

* Re: [Accepted] Make the latex export preprocessor rewrite #+INDEX to \index.
  2011-05-04 15:08     ` Robert Goldman
@ 2011-05-04 22:36       ` Carsten Dominik
  2011-05-04 22:46         ` Robert Goldman
  0 siblings, 1 reply; 16+ messages in thread
From: Carsten Dominik @ 2011-05-04 22:36 UTC (permalink / raw)
  To: rpgoldman; +Cc: Carsten Dominik, emacs-orgmode


On 4.5.2011, at 17:08, Robert Goldman wrote:

> On 5/4/11 May 4 -2:59 AM, Carsten Dominik wrote:
>> Patch 767 (http://patchwork.newartisans.com/patch/767/) is now "Accepted".
>> 
>> Maintainer comment: Pushed with modifications.  Some optimization, and the original patch would have stopped at the first #+index line that was missing the entry...  Please verify that it still works
>> 
>> This relates to the following submission:
>> 
>> http://mid.gmane.org/%3C1303991243-30731-2-git-send-email-rpgoldman%40sift.info%3E
> 
> I think there's a minor problem with the patch.  AFAICT, it binds the
> local variable 'entry' but does not read it (instead it uses the match
> text directly).

That is right, that is unnecessary.  I removed that, thanks.

> As an aside, it might be desirable to handle the empty index case that
> you identified.  E.g.,
> 
> (if (> (match-end 1) (match-beginning 1))
>    ...rewrite the index entry...
>    ;; else
>    emit a warning
>    rewrite the index entry as the empty string
> )

You mean, instead of ignoring it, there should be an error message
or warning?

- Carsten

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

* Re: [Accepted] Make the latex export preprocessor rewrite #+INDEX to \index.
  2011-05-04 22:36       ` Carsten Dominik
@ 2011-05-04 22:46         ` Robert Goldman
  0 siblings, 0 replies; 16+ messages in thread
From: Robert Goldman @ 2011-05-04 22:46 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Carsten Dominik, emacs-orgmode

On 5/4/11 May 4 -5:36 PM, Carsten Dominik wrote:
> 
> On 4.5.2011, at 17:08, Robert Goldman wrote:
> 
>> On 5/4/11 May 4 -2:59 AM, Carsten Dominik wrote:
>>> Patch 767 (http://patchwork.newartisans.com/patch/767/) is now "Accepted".
>>>
>>> Maintainer comment: Pushed with modifications.  Some optimization, and the original patch would have stopped at the first #+index line that was missing the entry...  Please verify that it still works
>>>
>>> This relates to the following submission:
>>>
>>> http://mid.gmane.org/%3C1303991243-30731-2-git-send-email-rpgoldman%40sift.info%3E
>>
>> I think there's a minor problem with the patch.  AFAICT, it binds the
>> local variable 'entry' but does not read it (instead it uses the match
>> text directly).
> 
> That is right, that is unnecessary.  I removed that, thanks.
> 
>> As an aside, it might be desirable to handle the empty index case that
>> you identified.  E.g.,
>>
>> (if (> (match-end 1) (match-beginning 1))
>>    ...rewrite the index entry...
>>    ;; else
>>    emit a warning
>>    rewrite the index entry as the empty string
>> )
> 
> You mean, instead of ignoring it, there should be an error message
> or warning?
> 
> - Carsten

I was suggesting a warning.  I don't /believe/ (I'm not in a position to
check right now) that the previous code ignored it --- I think it was
going to write an empty index --- \index{} --- and I'm not sure whether
that would be happy with Latex, or would generate a hard-to-debug error
downstream after processing the generated latex.

I also don't know if it's easy to report the particular line in the org
file that's bad.  I suspect not, because of the preprocessing, but I
could be wrong.

best,
R

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

end of thread, other threads:[~2011-05-04 22:46 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-28 11:47 Translate #+INDEX to Latex \index{} on export rpgoldman
2011-04-28 11:47 ` [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index rpgoldman
2011-04-28 12:33   ` Nick Dokos
2011-04-28 15:23     ` Robert Goldman
2011-04-28 15:29       ` Robert Goldman
2011-04-28 15:38     ` Patch --- adding an easy template for #+index rpgoldman
2011-04-28 19:11       ` Bernt Hansen
2011-04-28 19:59         ` Robert Goldman
2011-04-28 21:31           ` Bernt Hansen
2011-04-28 15:38     ` [PATCH] Add an easy template for index (i), and move include file to I from i rpgoldman
2011-05-04  7:49       ` [Accepted] " Carsten Dominik
2011-04-29 21:45   ` Bug Re: [PATCH] Make the latex export preprocessor rewrite #+INDEX to \index Robert Goldman
2011-05-04  7:59   ` [Accepted] " Carsten Dominik
2011-05-04 15:08     ` Robert Goldman
2011-05-04 22:36       ` Carsten Dominik
2011-05-04 22:46         ` Robert Goldman

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