unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#73719: [PATCH] Add imenu support for OpenOffice documents in doc-view
@ 2024-10-09 14:10 Visuwesh
  2024-10-10  6:53 ` Tassilo Horn
  0 siblings, 1 reply; 5+ messages in thread
From: Visuwesh @ 2024-10-09 14:10 UTC (permalink / raw)
  To: 73719; +Cc: Tassilo Horn

[-- Attachment #1: Type: text/plain, Size: 766 bytes --]

Tags: patch

Hi again, Tassilo!

The attached patch adds imenu index support for docx files.  This is
done by simply passing the PDF file to doc-view--pdf-outline.  This
should be the last patch I have in store for doc-view. Many thanks for
your attention thus far.


In GNU Emacs 31.0.50 (build 13, x86_64-pc-linux-gnu, X toolkit, cairo
 version 1.18.0, Xaw scroll bars) of 2024-10-06 built on astatine
Repository revision: 500f5da5fb62cd0bbded8df754d93e3147d1d847
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12101011
System Description: Debian GNU/Linux trixie/sid

Configured using:
 'configure --with-sound=alsa --with-x-toolkit=lucid --without-xaw3d
 --without-gconf --without-libsystemd --with-cairo CFLAGS=-g3'

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-imenu-support-for-OpenOffice-documents-in-doc-vi.patch --]
[-- Type: text/patch, Size: 3204 bytes --]

From 15db10f756e1069ba59a4a22462da408a58088e7 Mon Sep 17 00:00:00 2001
From: Visuwesh <visuweshm@gmail.com>
Date: Wed, 9 Oct 2024 19:36:18 +0530
Subject: [PATCH] Add imenu support for OpenOffice documents in doc-view

* lisp/doc-view.el (doc-view--outline): Pass the right file to
doc-view--pdf-outline.
* doc/emacs/misc.texi (DocView Navigation): Mention support for
OpenOffice documents too.
* etc/NEWS: Announce the change.
---
 doc/emacs/misc.texi | 14 ++++++++------
 etc/NEWS            |  6 ++++--
 lisp/doc-view.el    |  2 ++
 3 files changed, 14 insertions(+), 8 deletions(-)

diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 83b83ea7ae9..14196c107c1 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -586,12 +586,14 @@ DocView Navigation
 @vindex doc-view-djvused-program
   DocView can generate an outline menu for PDF and DjVu documents using
 the @command{mutool} and the @command{djvused} programs, respectively,
-when they are available.  This uses the @code{imenu} facility
-(@pxref{Imenu}).  You can customize how the @code{imenu} items for this
-outline are formatted and displayed using the variables
-@code{doc-view-imenu-format} and @code{doc-view-imenu-flatten}.  The
-filename of the @command{djvused} program can be customized by changing
-the @code{doc-view-djvused-program} user option.
+when they are available.  The outline for OpenOffice documents are also
+generated using the @command{mutool} after they are converted to PDF.
+This uses the @code{imenu} facility (@pxref{Imenu}).  You can customize
+how the @code{imenu} items for this outline are formatted and displayed
+using the variables @code{doc-view-imenu-format} and
+@code{doc-view-imenu-flatten}.  The filename of the @command{djvused}
+program can be customized by changing the
+@code{doc-view-djvused-program} user option.
 
 @cindex registers, in DocView mode
 @findex doc-view-page-to-register
diff --git a/etc/NEWS b/etc/NEWS
index 67d768f0584..5b6dcf6fa18 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -390,9 +390,11 @@ command 'doc-view-page-to-register' (bound to 'm'), and later the stored
 page can be restored with 'doc-view-jump-to-register' (bound to ''').
 
 +++
-*** Docview can generate imenu index for DjVu files.
+*** Docview can generate imenu index for DjVu and OpenOffice documents.
 When the 'djvused' program is available, Docview can now generate imenu
-index for DjVu files from its outline.
+index for DjVu files from its outline.  Index for OpenOffice files are
+generated using the 'mutool' program after their initial conversion to
+PDF format.
 The name of the 'djvused' program can be customized by changing the user
 option 'doc-view-djvused-program'.
 
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 57a24418616..bbfbbdec925 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -2103,6 +2103,8 @@ doc-view--outline
            ('djvu
             (when doc-view-djvused-program
               (doc-view--djvu-outline file-name)))
+           ('odf
+            (doc-view--pdf-outline (doc-view-current-cache-doc-pdf)))
            (_
             (doc-view--pdf-outline file-name)))))
     (when outline (imenu-add-to-menubar "Outline"))
-- 
2.45.2


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

* bug#73719: [PATCH] Add imenu support for OpenOffice documents in doc-view
  2024-10-09 14:10 bug#73719: [PATCH] Add imenu support for OpenOffice documents in doc-view Visuwesh
@ 2024-10-10  6:53 ` Tassilo Horn
  2024-10-10  8:42   ` Visuwesh
  0 siblings, 1 reply; 5+ messages in thread
From: Tassilo Horn @ 2024-10-10  6:53 UTC (permalink / raw)
  To: Visuwesh; +Cc: 73719

Visuwesh <visuweshm@gmail.com> writes:

Hi Visuwesh,

> The attached patch adds imenu index support for docx files.

docx is M$ Office, isn't it?  But as far as reading your patch tells me,
we do that for all ODF files which are indeed Libre/OpenOffice and
friends.  And, yes, M$ Office files are also handled by the ODF
transformation chain.

Anyway, I think it would be appropriate to speak of "Open Document
Format files as used by LibreOffice and OpenOffice" in the commit
message, NEWS, and the docs simply because the format is used by more
office suits and OpenOffice is mostly dead nowadays, superseded by
LibreOffice.

Otherwise, the patch is fine. :-)

> This should be the last patch I have in store for doc-view. Many
> thanks for your attention thus far.

We thank you, too!  Those were all very nice features. :-)

Bye,
  Tassilo





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

* bug#73719: [PATCH] Add imenu support for OpenOffice documents in doc-view
  2024-10-10  6:53 ` Tassilo Horn
@ 2024-10-10  8:42   ` Visuwesh
  2024-10-10 10:37     ` Tassilo Horn
  0 siblings, 1 reply; 5+ messages in thread
From: Visuwesh @ 2024-10-10  8:42 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: 73719

[-- Attachment #1: Type: text/plain, Size: 942 bytes --]

[வியாழன் அக்டோபர் 10, 2024] Tassilo Horn wrote:

> Visuwesh <visuweshm@gmail.com> writes:
>
> Hi Visuwesh,
>
>> The attached patch adds imenu index support for docx files.
>
> docx is M$ Office, isn't it?  But as far as reading your patch tells me,
> we do that for all ODF files which are indeed Libre/OpenOffice and
> friends.  And, yes, M$ Office files are also handled by the ODF
> transformation chain.

Yes, in the end, they are all marked as odf.  I tested it with a docx
file so I wrote it as it was still in my mind.

> Anyway, I think it would be appropriate to speak of "Open Document
> Format files as used by LibreOffice and OpenOffice" in the commit
> message, NEWS, and the docs simply because the format is used by more
> office suits and OpenOffice is mostly dead nowadays, superseded by
> LibreOffice.
>
> Otherwise, the patch is fine. :-)

Now done in the attached.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Add-imenu-support-for-ODF-files-in-doc-view.patch --]
[-- Type: text/x-diff, Size: 3400 bytes --]

From c77b2e0e161673da35be669cace5d7a214743de9 Mon Sep 17 00:00:00 2001
From: Visuwesh <visuweshm@gmail.com>
Date: Wed, 9 Oct 2024 19:36:18 +0530
Subject: [PATCH] Add imenu support for ODF files in doc-view

* lisp/doc-view.el (doc-view--outline): Pass the right file to
doc-view--pdf-outline.
* doc/emacs/misc.texi (DocView Navigation): Mention support for
Open Format Document (ODF) files too.
* etc/NEWS: Announce the change.  (bug#73719)
---
 doc/emacs/misc.texi | 15 +++++++++------
 etc/NEWS            |  8 +++++---
 lisp/doc-view.el    |  2 ++
 3 files changed, 16 insertions(+), 9 deletions(-)

diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 83b83ea7ae9..f618dadc0d6 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -586,12 +586,15 @@ DocView Navigation
 @vindex doc-view-djvused-program
   DocView can generate an outline menu for PDF and DjVu documents using
 the @command{mutool} and the @command{djvused} programs, respectively,
-when they are available.  This uses the @code{imenu} facility
-(@pxref{Imenu}).  You can customize how the @code{imenu} items for this
-outline are formatted and displayed using the variables
-@code{doc-view-imenu-format} and @code{doc-view-imenu-flatten}.  The
-filename of the @command{djvused} program can be customized by changing
-the @code{doc-view-djvused-program} user option.
+when they are available.  The outline for Open Document Format files as
+used by OpenOffice and LibreOffice are also generated using the
+@command{mutool} after they are converted to PDF.  This uses the
+@code{imenu} facility (@pxref{Imenu}).  You can customize how the
+@code{imenu} items for this outline are formatted and displayed using
+the variables @code{doc-view-imenu-format} and
+@code{doc-view-imenu-flatten}.  The filename of the @command{djvused}
+program can be customized by changing the
+@code{doc-view-djvused-program} user option.
 
 @cindex registers, in DocView mode
 @findex doc-view-page-to-register
diff --git a/etc/NEWS b/etc/NEWS
index 67d768f0584..94c27f77765 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -390,10 +390,12 @@ command 'doc-view-page-to-register' (bound to 'm'), and later the stored
 page can be restored with 'doc-view-jump-to-register' (bound to ''').
 
 +++
-*** Docview can generate imenu index for DjVu files.
+*** Docview can generate imenu index for DjVu and ODF documents.
 When the 'djvused' program is available, Docview can now generate imenu
-index for DjVu files from its outline.
-The name of the 'djvused' program can be customized by changing the user
+index for DjVu files from its outline.  Index for Open Document Format
+(ODF) files as used by OpenOffice and LibreOffice are generated using
+the 'mutool' program after their initial conversion to PDF format.  The
+name of the 'djvused' program can be customized by changing the user
 option 'doc-view-djvused-program'.
 
 ** Tramp
diff --git a/lisp/doc-view.el b/lisp/doc-view.el
index 57a24418616..bbfbbdec925 100644
--- a/lisp/doc-view.el
+++ b/lisp/doc-view.el
@@ -2103,6 +2103,8 @@ doc-view--outline
            ('djvu
             (when doc-view-djvused-program
               (doc-view--djvu-outline file-name)))
+           ('odf
+            (doc-view--pdf-outline (doc-view-current-cache-doc-pdf)))
            (_
             (doc-view--pdf-outline file-name)))))
     (when outline (imenu-add-to-menubar "Outline"))
-- 
2.45.2


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

* bug#73719: [PATCH] Add imenu support for OpenOffice documents in doc-view
  2024-10-10  8:42   ` Visuwesh
@ 2024-10-10 10:37     ` Tassilo Horn
  2024-10-10 11:13       ` Visuwesh
  0 siblings, 1 reply; 5+ messages in thread
From: Tassilo Horn @ 2024-10-10 10:37 UTC (permalink / raw)
  To: Visuwesh; +Cc: 73719-done

Visuwesh <visuweshm@gmail.com> writes:

> Yes, in the end, they are all marked as odf.  I tested it with a docx
> file so I wrote it as it was still in my mind.

Understandable.

>> Anyway, I think it would be appropriate to speak of "Open Document
>> Format files as used by LibreOffice and OpenOffice" in the commit
>> message, NEWS, and the docs simply because the format is used by more
>> office suits and OpenOffice is mostly dead nowadays, superseded by
>> LibreOffice.
>>
>> Otherwise, the patch is fine. :-)
>
> Now done in the attached.

Thanks!  Tested and pushed.

Bye,
  Tassilo





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

* bug#73719: [PATCH] Add imenu support for OpenOffice documents in doc-view
  2024-10-10 10:37     ` Tassilo Horn
@ 2024-10-10 11:13       ` Visuwesh
  0 siblings, 0 replies; 5+ messages in thread
From: Visuwesh @ 2024-10-10 11:13 UTC (permalink / raw)
  To: Tassilo Horn; +Cc: 73719-done

[வியாழன் அக்டோபர் 10, 2024] Tassilo Horn wrote:

Great, thank you!

> Visuwesh <visuweshm@gmail.com> writes:
>
>> Yes, in the end, they are all marked as odf.  I tested it with a docx
>> file so I wrote it as it was still in my mind.
>
> Understandable.
>
>>> Anyway, I think it would be appropriate to speak of "Open Document
>>> Format files as used by LibreOffice and OpenOffice" in the commit
>>> message, NEWS, and the docs simply because the format is used by more
>>> office suits and OpenOffice is mostly dead nowadays, superseded by
>>> LibreOffice.
>>>
>>> Otherwise, the patch is fine. :-)
>>
>> Now done in the attached.
>
> Thanks!  Tested and pushed.
>
> Bye,
>   Tassilo





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

end of thread, other threads:[~2024-10-10 11:13 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-09 14:10 bug#73719: [PATCH] Add imenu support for OpenOffice documents in doc-view Visuwesh
2024-10-10  6:53 ` Tassilo Horn
2024-10-10  8:42   ` Visuwesh
2024-10-10 10:37     ` Tassilo Horn
2024-10-10 11:13       ` Visuwesh

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.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).