* [PATCH] nextstep: Emacs can be used to edit PDF files @ 2021-11-10 8:38 David Edmondson 2021-11-19 0:15 ` Daniel Martín 0 siblings, 1 reply; 11+ messages in thread From: David Edmondson @ 2021-11-10 8:38 UTC (permalink / raw) To: emacs-devel; +Cc: David Edmondson Add editor role for PDF files, allowing them to be opened in Emacs via the Finder. --- nextstep/templates/Info.plist.in | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/nextstep/templates/Info.plist.in b/nextstep/templates/Info.plist.in index f9f0ec0857..bd86a75e79 100644 --- a/nextstep/templates/Info.plist.in +++ b/nextstep/templates/Info.plist.in @@ -488,6 +488,18 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. <key>CFBundleTypeRole</key> <string>Editor</string> </dict> + <dict> + <key>CFBundleTypeExtensions</key> + <array> + <string>pdf</string> + </array> + <key>CFBundleTypeIconFile</key> + <string>document.icns</string> + <key>CFBundleTypeName</key> + <string>PDF document</string> + <key>CFBundleTypeRole</key> + <string>Editor</string> + </dict> <dict> <key>CFBundleTypeExtensions</key> <array> -- 2.30.1 (Apple Git-130) ^ permalink raw reply related [flat|nested] 11+ messages in thread
* Re: [PATCH] nextstep: Emacs can be used to edit PDF files 2021-11-10 8:38 [PATCH] nextstep: Emacs can be used to edit PDF files David Edmondson @ 2021-11-19 0:15 ` Daniel Martín 2021-11-19 3:22 ` Stefan Monnier 2021-11-23 10:09 ` David Edmondson 0 siblings, 2 replies; 11+ messages in thread From: Daniel Martín @ 2021-11-19 0:15 UTC (permalink / raw) To: David Edmondson; +Cc: emacs-devel David Edmondson <dme@dme.org> writes: > Add editor role for PDF files, allowing them to be opened in Emacs via > the Finder. > --- > nextstep/templates/Info.plist.in | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/nextstep/templates/Info.plist.in b/nextstep/templates/Info.plist.in > index f9f0ec0857..bd86a75e79 100644 > --- a/nextstep/templates/Info.plist.in > +++ b/nextstep/templates/Info.plist.in > @@ -488,6 +488,18 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. > <key>CFBundleTypeRole</key> > <string>Editor</string> > </dict> > + <dict> > + <key>CFBundleTypeExtensions</key> > + <array> > + <string>pdf</string> > + </array> > + <key>CFBundleTypeIconFile</key> > + <string>document.icns</string> > + <key>CFBundleTypeName</key> > + <string>PDF document</string> > + <key>CFBundleTypeRole</key> > + <string>Editor</string> > + </dict> > <dict> > <key>CFBundleTypeExtensions</key> > <array> Thanks for the patch, but by default Emacs opens PDF files in fundamental-mode, which IMO is not very convenient for reading PDFs. It's true that there's also doc-view-mode, but that requires some extra configuration. If someone has configured Emacs to be a good PDF viewer, they can always force the Open With dialog to open PDFs with Emacs. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] nextstep: Emacs can be used to edit PDF files 2021-11-19 0:15 ` Daniel Martín @ 2021-11-19 3:22 ` Stefan Monnier 2021-11-19 3:42 ` Stefan Kangas 2021-11-23 10:09 ` David Edmondson 1 sibling, 1 reply; 11+ messages in thread From: Stefan Monnier @ 2021-11-19 3:22 UTC (permalink / raw) To: Daniel Martín; +Cc: David Edmondson, emacs-devel > Thanks for the patch, but by default Emacs opens PDF files in > fundamental-mode, It does? > It's true that there's also doc-view-mode, but that requires some extra > configuration. It works out of the box for me with `emacs -Q`. Stefan ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] nextstep: Emacs can be used to edit PDF files 2021-11-19 3:22 ` Stefan Monnier @ 2021-11-19 3:42 ` Stefan Kangas 2021-11-19 18:03 ` Stefan Monnier 0 siblings, 1 reply; 11+ messages in thread From: Stefan Kangas @ 2021-11-19 3:42 UTC (permalink / raw) To: Stefan Monnier, Daniel Martín; +Cc: emacs-devel, David Edmondson Stefan Monnier <monnier@iro.umontreal.ca> writes: >> Thanks for the patch, but by default Emacs opens PDF files in >> fundamental-mode, > > It does? I believe it depends on binaries (e.g. "gs") that are not available on macOS by default, but the patch itself is macOS-specific. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] nextstep: Emacs can be used to edit PDF files 2021-11-19 3:42 ` Stefan Kangas @ 2021-11-19 18:03 ` Stefan Monnier 2021-11-20 3:55 ` Stefan Kangas 0 siblings, 1 reply; 11+ messages in thread From: Stefan Monnier @ 2021-11-19 18:03 UTC (permalink / raw) To: Stefan Kangas; +Cc: Daniel Martín, David Edmondson, emacs-devel Stefan Kangas [2021-11-19 04:42:30] wrote: > Stefan Monnier <monnier@iro.umontreal.ca> writes: >>> Thanks for the patch, but by default Emacs opens PDF files in >>> fundamental-mode, >> It does? > I believe it depends on binaries (e.g. "gs") that are not available on > macOS by default, but the patch itself is macOS-specific. Ah, I see, makes sense. Any chance we could change doc-view so it works without `gs` (nor `mupdf`) using one of the tools pre-installed in macOS? Stefan ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] nextstep: Emacs can be used to edit PDF files 2021-11-19 18:03 ` Stefan Monnier @ 2021-11-20 3:55 ` Stefan Kangas 2021-11-20 13:06 ` Stefan Monnier 0 siblings, 1 reply; 11+ messages in thread From: Stefan Kangas @ 2021-11-20 3:55 UTC (permalink / raw) To: Stefan Monnier; +Cc: David Edmondson, emacs-devel, Daniel Martín Stefan Monnier <monnier@iro.umontreal.ca> writes: > Any chance we could change doc-view so it works without `gs` (nor > `mupdf`) using one of the tools pre-installed in macOS? It seems like we could, from searching the web there's apparently a tool called "sips" that is pre-installed on macOS. I just checked my machine and I have it there. AFAICT, you can't convert only one page with it, only the full page. But it seems to be a hard requirement of a `doc-view-pdf->png-converter-function' that we can specify a page number to it, so I'm not sure how tricky it is to fit into what we have now. Maybe someone more familiar with doc-view could take a look. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] nextstep: Emacs can be used to edit PDF files 2021-11-20 3:55 ` Stefan Kangas @ 2021-11-20 13:06 ` Stefan Monnier 2021-11-20 19:51 ` Alan Third 0 siblings, 1 reply; 11+ messages in thread From: Stefan Monnier @ 2021-11-20 13:06 UTC (permalink / raw) To: Stefan Kangas; +Cc: Daniel Martín, David Edmondson, emacs-devel Stefan Kangas [2021-11-20 04:55:17] wrote: > Stefan Monnier <monnier@iro.umontreal.ca> writes: > >> Any chance we could change doc-view so it works without `gs` (nor >> `mupdf`) using one of the tools pre-installed in macOS? > > It seems like we could, from searching the web there's apparently a tool > called "sips" that is pre-installed on macOS. I just checked my machine > and I have it there. > > AFAICT, you can't convert only one page with it, only the full page. > But it seems to be a hard requirement of a > `doc-view-pdf->png-converter-function' that we can specify a page number > to it, so I'm not sure how tricky it is to fit into what we have now. > > Maybe someone more familiar with doc-view could take a look. Apparently it might also be possible to do it via AppleScript (according to http://preserve.mactech.com/articles/mactech/Vol.21/21.03/BasicImageManipulation/index.html) But both of those seem to focus on image manipulation and completely skip describing the case of a PDF (or GIF, ...) that contains several images/pages. So yes, it might be doable but someone will have to play with it to see exactly what can be done. If it can only convert a whole document at a time, I think doc-view could be adapted to accommodate that requirement. Stefan ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] nextstep: Emacs can be used to edit PDF files 2021-11-20 13:06 ` Stefan Monnier @ 2021-11-20 19:51 ` Alan Third 0 siblings, 0 replies; 11+ messages in thread From: Alan Third @ 2021-11-20 19:51 UTC (permalink / raw) To: Stefan Monnier Cc: emacs-devel, David Edmondson, Stefan Kangas, Daniel Martín On Sat, Nov 20, 2021 at 08:06:20AM -0500, Stefan Monnier wrote: > Stefan Kangas [2021-11-20 04:55:17] wrote: > > > Stefan Monnier <monnier@iro.umontreal.ca> writes: > > > >> Any chance we could change doc-view so it works without `gs` (nor > >> `mupdf`) using one of the tools pre-installed in macOS? > > > > It seems like we could, from searching the web there's apparently a tool > > called "sips" that is pre-installed on macOS. I just checked my machine > > and I have it there. > > > > AFAICT, you can't convert only one page with it, only the full page. > > But it seems to be a hard requirement of a > > `doc-view-pdf->png-converter-function' that we can specify a page number > > to it, so I'm not sure how tricky it is to fit into what we have now. > > > > Maybe someone more familiar with doc-view could take a look. > > Apparently it might also be possible to do it via AppleScript > (according to http://preserve.mactech.com/articles/mactech/Vol.21/21.03/BasicImageManipulation/index.html) NSImage supports loading of PDF files natively. In fact, as I understand it the entire NEXTstep API is built on some sort of PDF technology. (Or is it PostScript? It only supports EPS natively, not standard PostScript...) I've yet to work out how to teach Emacs to open files using the native support. It can obviously do it because it manages it for PNG, JPEG, etc., I just need to work it out for HEIC and PDF. -- Alan Third ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] nextstep: Emacs can be used to edit PDF files 2021-11-19 0:15 ` Daniel Martín 2021-11-19 3:22 ` Stefan Monnier @ 2021-11-23 10:09 ` David Edmondson 2021-11-23 17:35 ` Tomas Hlavaty 1 sibling, 1 reply; 11+ messages in thread From: David Edmondson @ 2021-11-23 10:09 UTC (permalink / raw) To: Daniel Martín; +Cc: emacs-devel On Friday, 2021-11-19 at 01:15:11 +01, Daniel Martín wrote: > David Edmondson <dme@dme.org> writes: > >> Add editor role for PDF files, allowing them to be opened in Emacs via >> the Finder. >> --- >> nextstep/templates/Info.plist.in | 12 ++++++++++++ >> 1 file changed, 12 insertions(+) >> >> diff --git a/nextstep/templates/Info.plist.in b/nextstep/templates/Info.plist.in >> index f9f0ec0857..bd86a75e79 100644 >> --- a/nextstep/templates/Info.plist.in >> +++ b/nextstep/templates/Info.plist.in >> @@ -488,6 +488,18 @@ along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. >> <key>CFBundleTypeRole</key> >> <string>Editor</string> >> </dict> >> + <dict> >> + <key>CFBundleTypeExtensions</key> >> + <array> >> + <string>pdf</string> >> + </array> >> + <key>CFBundleTypeIconFile</key> >> + <string>document.icns</string> >> + <key>CFBundleTypeName</key> >> + <string>PDF document</string> >> + <key>CFBundleTypeRole</key> >> + <string>Editor</string> >> + </dict> >> <dict> >> <key>CFBundleTypeExtensions</key> >> <array> > > Thanks for the patch, but by default Emacs opens PDF files in > fundamental-mode, which IMO is not very convenient for reading PDFs. I don't see this as a reason not to include the patch. Users are not forced to use Emacs to open PDFs, so this is only something that will happen with explicit configuration or selection in any case. I would also argue that fundamental mode is not a terrible place to edit PDF documents. It's not a very good viewer, but then... > It's true that there's also doc-view-mode, but that requires some extra > configuration. ...doc-view-mode is a *terrible* PDF viewer for larger (1000+ page) documents, and it is the default if ghostscript is found. > If someone has configured Emacs to be a good PDF viewer, they can always > force the Open With dialog to open PDFs with Emacs. If one wishes to open all PDF documents with Emacs then this is a good solution. If, as in my case, someone wishes to open some PDF documents using Emacs, the existing "Open with..." is very cumbersome to use, as it requires navigating the filesystem to find the Emacs application every time. The current Info.plist.in includes a clause that attempts to make Emacs available as an editor for *all* file types on macOS, but Apple appear to have discontinued support for this, which is unfortunate. dme. -- There's someone in my head but it's not me. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] nextstep: Emacs can be used to edit PDF files 2021-11-23 10:09 ` David Edmondson @ 2021-11-23 17:35 ` Tomas Hlavaty 2021-11-24 21:10 ` James Cloos 0 siblings, 1 reply; 11+ messages in thread From: Tomas Hlavaty @ 2021-11-23 17:35 UTC (permalink / raw) To: David Edmondson, Daniel Martín; +Cc: emacs-devel On Tue 23 Nov 2021 at 10:09, David Edmondson <dme@dme.org> wrote: > I would also argue that fundamental mode is not a terrible place to edit > PDF documents. fundamental-mode _is_ a terrible place to edit PDF documents. PDF documents are binary files with hardcoded file positions inside. ^ permalink raw reply [flat|nested] 11+ messages in thread
* Re: [PATCH] nextstep: Emacs can be used to edit PDF files 2021-11-23 17:35 ` Tomas Hlavaty @ 2021-11-24 21:10 ` James Cloos 0 siblings, 0 replies; 11+ messages in thread From: James Cloos @ 2021-11-24 21:10 UTC (permalink / raw) To: emacs-devel; +Cc: Daniel Martín, Tomas Hlavaty, David Edmondson ideally emacs would have a pdf mode with a set of sub-modes. one would give a gui view and anable adding/removung/editing text on each page another would be a text-only mode, which would work in all types of terminals, and also would facilitate editing as above; in this mode each pdf object would be treated similarly to how config mode treats each option and the third would look like fundamental mode, but like the first two would adjust the offsets whever any edits are made the latter two modes would need to support switching an object or astream between compressed and uncopressed, including the various possibilities for compression. with those three capabilities emacs would be an ideal option for editing any pdf. perhaps even the. -JimC -- James Cloos <cloos@jhcloos.com> OpenPGP: 0x997A9F17ED7DAEA6 ^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2021-11-24 21:10 UTC | newest] Thread overview: 11+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2021-11-10 8:38 [PATCH] nextstep: Emacs can be used to edit PDF files David Edmondson 2021-11-19 0:15 ` Daniel Martín 2021-11-19 3:22 ` Stefan Monnier 2021-11-19 3:42 ` Stefan Kangas 2021-11-19 18:03 ` Stefan Monnier 2021-11-20 3:55 ` Stefan Kangas 2021-11-20 13:06 ` Stefan Monnier 2021-11-20 19:51 ` Alan Third 2021-11-23 10:09 ` David Edmondson 2021-11-23 17:35 ` Tomas Hlavaty 2021-11-24 21:10 ` James Cloos
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.