Skip to content

Printing problem with Custom Version 9.0.472 (174) on MacOS Ventura 13.0.1 #1347

Closed

Description

@MichaelHendry

Steps to reproduce

Open a text file in MacVim
Print the file (using command-P or File->Print)

MacVim reports "Print job sent" and opens the Preview App, but the file is not opened in Preview. Clicking on the Preview icon in the Dock brings up an open file window.

Expected behaviour

Up until the most recent Ventura update, the file would be opened in Preview. and could be printed with Command-P.

I suspect this may be the result of a tightening of security features in Mac OS, which may be preventing the creation of an intermediate file, or preventing its being opened by Preview.

Version of Vim and architecture

Version 9.0.472 (174)

Environment

MacOS Ventura 13.0.1 Intel Processor on iMac Retina 5K 27 Inch 2020

How MacVim was installed

MacVim updated via MacVim->Check for updates

Logs and stack traces

No response

Vim configuration where issue is reproducable

No response

Issue has been tested with given configuration

  • by running MacVim.app from GUI macOS interface
  • by running vim/gvim/etc installed by MacVim
  • by running other versions of vim (e.g. /usr/bin/vim)

Issue has been tested with no configuration

  • by running mvim --clean (or gvim, supplied by MacVim distribution)
  • by running vim --clean (in terminal, supplied by MacVim distribution)
  • by running vim --clean (in terminal, other suppliers, e.g. /usr/bin/vim)

Other conditions

  • The both Homebrew packages "vim" and "macvim" are installed

Activity

  1. ychin commented on Nov 29, 2022

    @ychin
    Member

    I can reproduce. Looking into it. Meanwhile you can manually use the :hardcopy Vim command to work around it.

  2. added this to the Release 175 milestone on Nov 29, 2022
  3. MichaelHendry commented on Nov 30, 2022

    @MichaelHendry
    Author

    Thanks, ychin.

    I'll stop the (now proved futile) sequence of uninstallation, re-installation, rebooting etc!

    I'd tried the :hardcopy command, but got the same result as Cmd-P.

    Michael

  4. ychin commented on Nov 30, 2022

    @ychin
    Member

    For hardcopy you should be able to save it out to a dedicated file (or you can just modify printexpr). Then you can manually open that in Preview.

  5. MichaelHendry commented on Nov 30, 2022

    @MichaelHendry
    Author

    The problem seems to be that Preview no longer opens .ps files - they're ghosted when I try a File-Open in Preview.

    I've worked around the problem using the following:

    :hardcopy > 0.ps | !ps2pdf 0.ps && open -a preview 0.pdf

    0.pdf is then opened in Preview and can be printed in the usual way.

  6. MichaelHendry commented on Nov 30, 2022

    @MichaelHendry
    Author

    PS It turns out that the above only works for vim, run from the command line, and saves 0.ps etc in the current working directory, before opening the .PDF in Preview. I don't know what directory MacVim sends its output to.

  7. MichaelHendry commented on Nov 30, 2022

    @MichaelHendry
    Author

    Preview on Ventura no longer supports .PS files, see:

    https://support.apple.com/en-us/HT213250

    "...The Preview app included with your Mac supports PostScript (.ps) and Encapsulated PostScript (.eps) files in macOS Monterey or earlier. Starting with macOS Ventura, Preview no longer supports these files. Other apps that can view or convert .ps and .eps files are available from the App Store and elsewhere..."

  8. ychin commented on Dec 1, 2022

    @ychin
    Member

    Oh crap yeah you are right, now I vaguely remember reading about the drop of PostScript support and was thinking "who still uses PostScript" lol. Famous last words…

    I guess we could either bundle ps2pdf or find another alternative. I will need to think about it a little.

  9. modified the milestones: Release 175, Release 176 on Feb 3, 2023
  10. added a commit that references this issue on Feb 7, 2023
  11. ychin commented on Mar 15, 2023

    @ychin
    Member

    Btw, @MichaelHendry , I'm wondering if you have tried the :TOhtml command before and see if that solves your issue? It's another way to tackle the issue but it generates an HTML page that you can then print in a browser. I'm just trying to gather how important it is to fix this issue.

    Also, if you want a shorter term fix, I believe you can set printexpr to be system(['lpr'] + (empty(&printdevice)?[]:['-P', &printdevice]) + [v:fname_in]). delete(v:fname_in)+ v:shell_error. Only issue with using lpr is that it directly sends the doc to the printer, without a way to preview it which is kind of sucky.

  12. added 2 commits that reference this issue on Mar 15, 2023
    fb4cf0c
    dc05ef3
  13. 1 remaining item

  14. added 5 commits that reference this issue on Mar 15, 2023
    62b7eca
    842cd7e
    b5e4bde
    377323c
    e3a5374
  15. jubilatious1 commented on Apr 6, 2023

    @jubilatious1
  16. jubilatious1 commented on Apr 6, 2023

    @jubilatious1

    hardcopy > 0.ps | !ps2pdf 0.ps && open -a preview 0.pdf

    This works in MacOS Ventura 13.3 with MacVim: Vim 9.0.1276 (MacVim r176).

    @MichaelHendry

  17. added a commit that references this issue on Apr 8, 2023
    f2059d7
  18. MichaelHendry commented on Nov 2, 2023

    @MichaelHendry
    Author

    Now that I've upgraded to Sonoma, I'm having a problem with printing from Adobe Acrobat, which fails to print with the following explanation::

    Stopped. Michael Hendry, "Filter" failed. 0 pages, 1 copy

    The hardcopy method above works, but I'd prefer not to have to remember these magic spells.

    My .gvimrc file now reads as follows:

    set tabstop=4
    set shiftwidth=4
    "se printexpr=system('ps2pdf\ '.v:fname_in.'\ '.v:fname_in.'.pdf\ &&\ open\ '.v:fname_in.'.pdf')\ +\ v:shell_error
    se printexpr=system('ps2pdf\ '.v:fname_in.'\ '.v:fname_in.'.pdf\ &&\ open\ -a\ Preview\ '.v:fname_in.'.pdf')\ +\ v:shell_error

    Having completed this comment, I realise that the problem probably lies with Acrobat, not MacVim, but it may help another Mac User who has recently upgraded to Sonoma.

    which works around the problem by directing the output specifically to Preview instead of the default application for .PDF files.

  19. ychin commented on Nov 2, 2023

    @ychin
    Member

    Huh, I didn't consider the possibility that someone may have assigned another application to open PDFs by default. Let me play around with Acrobat a little first before I decide how to resolve this. I wonder if the issue is since we delete the PDF after a timeout.

  20. ychin commented on Nov 9, 2023

    @ychin
    Member

    Actually @MichaelHendry , why do you still have an explicit printexpr set? You know that this was fixed a while ago (r177) in July right? It will automatically use Preview to open it. You should just remove the line that sets printexpr in your vimrc.

  21. MichaelHendry commented on Nov 11, 2023

    @MichaelHendry
    Author

    You're absolutely right - I don't need the printexpr line for MacVim.

    I've been grappling with the use of a non-graphical version of vim which is called by "LifeLines" - a curses-based genealogy program which calls an external editor to edit information in its GEDCOM database. I can't use MacVim for this because Mac OS doesn't use the same calling convention for "open file X in application Y".

    I can work around this by copying-and-pasting into an opened copy of MacVim.

  22. ychin commented on Dec 8, 2023

    @ychin
    Member

    Ok, actually… Sonoma broke printing, again, sigh. The fix we did last time used pstopdf which was an Apple bundled tool, but macOS 14 Sonoma has completely removed Postscript support so that tool got nuked as well. Currently investigating options, but maybe I'll just force users to install ps2pdf instead. Printing is a niche enough thing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions