-
-
Notifications
You must be signed in to change notification settings - Fork 29
Hardcopy to printer #2290
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Hardcopy to printer #2290
Conversation
|
I tested on Linux Mint 22.1 Cinnamon and I still get the same error when printing from both TEdit and |
|
If you break ShellCommand and try
(COPYFILE 'GREP.TEDIT '{LPT})
do you still see a -P parameter in the CMD string ?
(When you pop out of the break, you will probably get an error on CLOSEF because the file is already closed. That's a different issue I will fix in COPYFILE.
… On Sep 12, 2025, at 1:36 AM, Paolo Amoroso ***@***.***> wrote:
pamoroso
left a comment
(Interlisp/medley#2290)
<#2290 (comment)>
I tested on Linux Mint 22.1 Cinnamon and I still get the same error when printing from both TEdit and COPYFILE.
—
Reply to this email directly, view it on GitHub <#2290 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AQSTUJKE363DHUO3X7V34HT3SKA2RAVCNFSM6AAAAACGJWQPUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEOBUGMYTIMRVGQ>.
You are receiving this because you authored the thread.
|
|
And, if you
(COPYFILE 'GREP.TEDIT '{LPT}foo)
you should see a -Pfoo parameter
… On Sep 12, 2025, at 8:17 AM, Ron Kaplan ***@***.***> wrote:
If you break ShellCommand and try
(COPYFILE 'GREP.TEDIT '{LPT})
do you still see a -P parameter in the CMD string ?
(When you pop out of the break, you will probably get an error on CLOSEF because the file is already closed. That's a different issue I will fix in COPYFILE.
> On Sep 12, 2025, at 1:36 AM, Paolo Amoroso ***@***.***> wrote:
>
>
> pamoroso
> left a comment
> (Interlisp/medley#2290)
> <#2290 (comment)>
> I tested on Linux Mint 22.1 Cinnamon and I still get the same error when printing from both TEdit and COPYFILE.
>
> —
> Reply to this email directly, view it on GitHub <#2290 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AQSTUJKE363DHUO3X7V34HT3SKA2RAVCNFSM6AAAAACGJWQPUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEOBUGMYTIMRVGQ>.
> You are receiving this because you authored the thread.
>
|
|
With the call |
|
Sorry, that's the first command, to convert the PS to PDF. Say OK to that, look at the command for the second call to ShellCommand, that should show the bogus printer.
… On Sep 12, 2025, at 9:01 AM, Paolo Amoroso ***@***.***> wrote:
pamoroso
left a comment
(Interlisp/medley#2290)
<#2290 (comment)>
With the call (COPYFILE 'BITMAPFNS.TEDIT '{LPT}foo) I get this command string:
7_: ?=
Cmd = "command -v ps2pdf"
&OPTIONAL
Output = #<IO Nodircore Stream/127,131000>
—
Reply to this email directly, view it on GitHub <#2290 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AQSTUJI5IBXFIRGDAWWW2U33SLU47AVCNFSM6AAAAACGJWQPUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEOBVHA2DQNBTGM>.
You are receiving this because you authored the thread.
|
|
Here's the command string for the second call: |
|
That looks reasonable. If you say OK, it should fail with a failure message about foo.
But if you copy it to {LPT} without the foo, it should print.
… On Sep 12, 2025, at 1:28 PM, Paolo Amoroso ***@***.***> wrote:
pamoroso
left a comment
(Interlisp/medley#2290)
<#2290 (comment)>
Here's the command string for the second call:
7_: ?=
Cmd = "lpr -Pfoo -JMedley\ Output -r -s /tmp/medleyprint.17876778821"
&OPTIONAL
Output = {WINDOW}#156,167570
—
Reply to this email directly, view it on GitHub <#2290 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AQSTUJM2524O6IX3UDLUJGT3SMUFPAVCNFSM6AAAAACGJWQPUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEOBWG4ZTOMJVHE>.
You are receiving this because you authored the thread.
|
|
Calling This is the backtrace: |
|
Ahh, I have DEFAULTPRINTINGHOST set to the empty string "" in my init. Try setting it before you do the COPYFILE.
Maybe that setting should be in the system greet file. (Or maybe the code should interpret NIL as whatever lpr can find)
… On Sep 12, 2025, at 1:41 PM, Paolo Amoroso ***@***.***> wrote:
pamoroso
left a comment
(Interlisp/medley#2290)
<#2290 (comment)>
Calling (COPYFILE 'BITMAPFNS.TEDIT '{LPT}) yields the error:
DEFAULTPRINTINGHOST and HOST are NIL; don't know where to print
{LPT1}.;1
Stream not open: {LPT1}.;1
This is the backtrace:
14_: BTV
MESS1
"DEFAULTPRINTINGHOST and HOST arg are NIL; don't know where to print "
MESS2 {LPT}.;1
NOBREAK NIL
ERROR
SI::*CLEANUP-FORMS* SI::RESETUNWIND
FULLFILE {LPT}.;1
STRM #<Input Stream on {LPT}.;1/146,37000>
FILETYPE TEDIT
PRINTERTYPE NIL
PFILE #<Input Stream on {LPT}.;1/146,37000>
SI::*UNWIND-PROTECT*
FILE #<Input Stream on {LPT}.;1/146,37000>
HOST NIL
PRINTOPTIONS (DELETE T HEADING T)
LISPXHIST ((&) (12 "" . "_ ") "<not yet evaluated>"
*HISTORY* (REDO 6) NIL)
SI::*RESETFORMS* ((& NIL))
RESETSTATE NIL
SEND.FILE.TO.PRINTER
STREAM #<Input Stream on {LPT}.;1/146,37000>
SDEV #<FDev LPT/172,15000>
PRINTOPTIONS NIL
PRINTERDEVICE.CLOSEFN
\CLOSEFILE
CLOSEF
SI::*CLEANUP-FORMS* SI::RESETUNWIND
SI::*UNWIND-PROTECT*
FROMFILE BITMAPFNS.TEDIT
TOFILE {LPT}
LISPXHIST ((&) (12 "" . "_ ") "<not yet evaluated>"
*HISTORY* (REDO 6) NIL)
SI::*RESETFORMS* ((&
#<Input Stream on {LPT}.;1/146,37000>) (&
#<Closed Stream on {DSK}<home>paolo>medley>medley>lispusers>BITMAPFNS.TEDIT;1/146,37200>))
RESETSTATE NIL
COPYFILE
*FORM* (COPYFILE (QUOTE BITMAPFNS.TEDIT) (QUOTE {LPT}
))
*ARGVAL* NIL
*TAIL* NIL
*FN* COPYFILE
\EVALFORM
FAULTEVAL
*FORM* (UNDOABLY (COPYFILE & &))
\EVALFORM
\INTERNAL NIL
EVAL
EVAL-INPUT
RETRYFLAG NIL
HELPCLOCK 10338
DO-EVENT
SI::*DUMMY-FOR-CATCH* T
SI::*CATCH-RETURN-FROM* (&)
LISPXHIST ((&) (12 "" . "_ ") "<not yet evaluated>"
*HISTORY* (REDO 6) NIL)
HELPCLOCK 0
XCL::EXECA0001A0002
*CURRENT-EVENT* ((&) (12 "" . "_ ")
"<not yet evaluated>" *HISTORY* (REDO 6) NIL)
SI::NLSETQ-VALUE NIL
*PROCEED-CASES* (&)
SI::*NLSETQFLAG* NIL
XCL::EXECA0001
\PROGV
XCL::TOP-LEVEL-P T
XCL::WINDOW {WINDOW}#156,167664
XCL::TITLE-SUPPLIED NIL
XCL::TITLE NIL
*THIS-EXEC-COMMANDS* (#<Hash-Table @ 166,33666>)
XCL::ENVIRONMENT NIL
XCL::PROMPT NIL
XCL::FN EVAL-INPUT
XCL::PROFILE INTERLISP
*EXEC-ID* ""
XCL::PROFILE-CACHE (XCL::*PROFILE-NAME* "IL"
XCL:*EVAL-FUNCTION* EVAL *PACKAGE* #<Package INTERLISP>
*READTABLE* #<ReadTable INTERLISP/174,54714>
XCL:*EXEC-PROMPT* "_ " --)
EXEC
\PROC.REPEATEDLYEVALQT
*FORM* (\PROC.REPEATEDLYEVALQT)
*ARGVAL* NIL
*TAIL* NIL
*FN* \PROC.REPEATEDLYEVALQT
\EVALFORM
%#FORM# (\PROC.REPEATEDLYEVALQT)
*CURRENT-PROCESS* #<Process EXEC/174,11204>
HELPFLAG BREAK!
\CURRENTDISPLAYLINE 0
\#DISPLAYLINES 20
\LINEBUF.OFD #<IO Linebuffer Stream/167,125600>
*READTABLE* #<ReadTable INTERLISP/174,54714>
\PRIMTERMTABLE {TERMTABLEP}#174,47740
\PRIMTERMSA {CHARTABLE}#174,50000
TtyDisplayStream #<Output Display Stream/174,55000>
SI::*RESETFORMS* NIL
\INTERRUPTABLE T
\TTYWINDOW NIL
READBUF NIL
\TERM.OFD #<Output Display Stream/167,123600>
*STANDARD-OUTPUT* #<Output Display Stream/167,123600>
*STANDARD-INPUT* #<IO Linebuffer Stream/167,125600>
\MAKE.PROCESS0
T
—
Reply to this email directly, view it on GitHub <#2290 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AQSTUJLVC27EYZPESG667N33SMVYHAVCNFSM6AAAAACGJWQPUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEOBWG43DKNZRHE>.
You are receiving this because you authored the thread.
|
|
What value should I set |
|
Set it to the empty string
… On Sep 12, 2025, at 2:40 PM, Paolo Amoroso ***@***.***> wrote:
pamoroso
left a comment
(Interlisp/medley#2290)
<#2290 (comment)>
What value should I set DEFAULTPRINTINGHOST to? "{LPT}"?
—
Reply to this email directly, view it on GitHub <#2290 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AQSTUJJVXTW7YJECBOXAT3D3SM4TDAVCNFSM6AAAAACGJWQPUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEOBWHEZDKNZRGY>.
You are receiving this because you authored the thread.
|
|
I set |
|
Hmm, try something else to see how broken it is.
With DEFAULTPRINTINGHOST set to NIL, click meta-P in when the mouse is in a Tedit window, choose send to printer. It should only give the "Other" option to choose.
If you then set it to "", it should also give a Default-printer option to choose in addition to the Other.
… On Sep 13, 2025, at 1:43 AM, Paolo Amoroso ***@***.***> wrote:
pamoroso
left a comment
(Interlisp/medley#2290)
<#2290 (comment)>
I set DEFAULTPRINTINGHOST to the empty string but I still get the no default destination error.
—
Reply to this email directly, view it on GitHub <#2290 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AQSTUJLJ3VG2TWDR2ZSF52T3SPKM3AVCNFSM6AAAAACGJWQPUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEOBXHAYTIMRZGI>.
You are receiving this because you authored the thread.
|
|
This was a problem reported earlier, separate from the DEFAULTPRINTINGHOST issue.
This is a symptom of what now appears to be a mistake I made when I slapped in the hack of created PDF streams by first making a postscript file but with a tricky close-function that gives the completed PS file to the shell, runs the local ps-to-pdf converter, and then renames the shell's output PDF file back to the specified name of the Lisp PDF file.
This works well when the pdf file on the Lisp side is really a named file. But doesn't work when the destination file is an unnamed stream on the Lisp side (e.g. a NODIRCORE, or equivalently a file on the {SCRATCH} device (which I just discovered)). There is nothing to rename back to. Copying to LPT uses such a scratch file and so does SEND.FILE.TO.PRINTER.
The better approach is to create the PDF file/stream with the postscript imageops, so that it acts like postscript with respect to all of the image operations but retains its own identity. At the close, run the ps-to-pdf on it (first copying it over to /tmp if it doesn't already reside in the Unix file system), and then COPYBYTES the generated pdf file back into the Lisp stream. I.e. use COPYBYTES at the stream level instead of RENAMEFILE at the name level.
… On Sep 12, 2025, at 9:01 AM, Paolo Amoroso ***@***.***> wrote:
pamoroso
left a comment
(Interlisp/medley#2290)
<#2290 (comment)>
With the call (COPYFILE 'BITMAPFNS.TEDIT '{LPT}foo) I get this command string:
7_: ?=
Cmd = "command -v ps2pdf"
&OPTIONAL
Output = #<IO Nodircore Stream/127,131000>
—
Reply to this email directly, view it on GitHub <#2290 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AQSTUJI5IBXFIRGDAWWW2U33SLU47AVCNFSM6AAAAACGJWQPUCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTEOBVHA2DQNBTGM>.
You are receiving this because you authored the thread.
|
|
Here is the information for completeness.
|
|
DEFAULTPRINTINGHOST can be a list of printer names, there is a list of printer types and properties, the unixprint code should be registering a name or names that can be used with the lpr -P option for named printers, or with the empty string it should leave off the -P to get the system default Unix printer. If things aren’t getting registered properly then things won’t work smoothly |
|
I updated to commit 5dc4ca2 and the issues described earlier still persist. |
|
@pamoroso, issues still concerning the DEFAULTPRINTINGHOST ? |
|
I forgot to mention |
|
A number of changes:
|
|
With commit cfee491 and The command So it's likely a Linux configuration issue more than a Medley one. |
|
I set the right printer entry as default (don't ask why CUPS duplicates it...) and I was finally able to print to the default printer from TEdit, with both the default printer option and |
|
For whatever reason, I don't see all those PDFCONVERT calls to ShellCommand when I break it. To be more specific, unbreakthose and then |
|
What does From the FreeBSD lpr man page: |
|
Here's the BSD documentation for |
|
On my Linux box |
|
That's the default behavior for all environements, what you get if you don't do any local tailoring. |
|
Yes. If you want to use |
|
According to the documentation my |
|
If that's the only thing you want to change, then yes, that'll do it. Since Linux is using CUPS for printing, I think you can either set a default printer with the PRINTER environment variable in your shell's rc file, or use |
…INTINGHOST is NIL Restores the Other - abort behavior.
|
I only set I prefer not to use other tools as for reasons I still don't understand CUPS create a duplicate entry for my printer. I've checked that the default printer works with Medley and |
|
Is it ever harmful to have -s as a default switch? Is it ever helpful? |
|
I updated to commit 496b88a. When printing from TEdit with
The backtrace: However, the issue may be related more to my setup than Medley. I need to do some troubleshooting. Passing |
|
Stepping back a little: Online users won't want any of the printer integrations being offered, because there is no connectdion to the user's local printer. The best we can do is to make a kind of "printer" that actually opens the result of "printing" as HTML or PNG or SVG and open it up in the browser being used to connect to online. I think this is likely to be true for uers who don't have or rarely use the printer to generate "hard" copy on paper. In fact, I would argue that the trend to not actually print anything would be the common situation for modern users. I also think that integrating with the clipboard would be appropriate -- the menu that currently is labeled "Hardcopy" should copy to the clipboard (instead of. ro in addition to) printing per se. |
It looks as though most (all?) lpr implementations ignore it if they're not going to support it, so at least not harmful. If they implement it (as some appear to do) then it saves copying the print file one more time, so marginally helpful. |
|
SEND.FILE.TO.PRINTER wasn't recognizing the value :DEFAULT from the menus that now distinguishes NIL (abort) from the default. Try it again. |
|
Commit 8b58ef9 resolved the issue and now I can print with no errors. |







This addresses the issues described in #2289 .
-- The \CORE.DIRECTORYNAMEP in COREIO uses FILENAMEFIELD to extract the directory field for comparison
-- COPYCHARS in FILEIO assumes that ANY EOL convention on the source file matches whatever is specified for the destination, so COPYCHARS reverts to COPYBYTES. (ANY as the default on input was something that was introduced after another discussion some time ago #345 ).
-- HARDCOPY has had a lot of cleanup, including removing redundancy and unused code, eliminating special case for PRESS and INTERPRESS. The hardcopydisplaystream still needs a lot of clean up--not sure that it ever worked. Not sure it was ever documented.
I have tested COPYFILE to {LPT} of both Tedit files and PDF files, and also doing the Hardcopy to a printer directly from Tedit.