Skip to content

Conversation

@rmkaplan
Copy link
Contributor

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.

@pamoroso
Copy link
Member

I tested on Linux Mint 22.1 Cinnamon and I still get the same error when printing from both TEdit and COPYFILE.

@rmkaplan
Copy link
Contributor Author

rmkaplan commented Sep 12, 2025 via email

@rmkaplan
Copy link
Contributor Author

rmkaplan commented Sep 12, 2025 via email

@pamoroso
Copy link
Member

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>

@rmkaplan
Copy link
Contributor Author

rmkaplan commented Sep 12, 2025 via email

@pamoroso
Copy link
Member

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

@rmkaplan
Copy link
Contributor Author

rmkaplan commented Sep 12, 2025 via email

@pamoroso
Copy link
Member

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

@rmkaplan
Copy link
Contributor Author

rmkaplan commented Sep 12, 2025 via email

@pamoroso
Copy link
Member

What value should I set DEFAULTPRINTINGHOST to? "{LPT}"?

@rmkaplan
Copy link
Contributor Author

rmkaplan commented Sep 12, 2025 via email

@pamoroso
Copy link
Member

I set DEFAULTPRINTINGHOST to the empty string but I still get the no default destination error.

@rmkaplan
Copy link
Contributor Author

rmkaplan commented Sep 13, 2025 via email

@rmkaplan
Copy link
Contributor Author

rmkaplan commented Sep 13, 2025 via email

@pamoroso
Copy link
Member

Here is the information for completeness.

DEFAULTPRINTINGHOST = NIL: Meta-P > Send to a printer provides only the option Other....

DEFAULTPRINTINGHOST = "": Meta-P > Send to a printer provides the options (Default printer) and Other....

@nbriggs
Copy link
Contributor

nbriggs commented Sep 13, 2025

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

@masinter masinter marked this pull request as draft October 20, 2025 17:10
@pamoroso
Copy link
Member

pamoroso commented Dec 5, 2025

I updated to commit 5dc4ca2 and the issues described earlier still persist.

@rmkaplan
Copy link
Contributor Author

rmkaplan commented Dec 5, 2025

@pamoroso, issues still concerning the DEFAULTPRINTINGHOST ?

@pamoroso
Copy link
Member

pamoroso commented Dec 5, 2025

The issues concern the errors I get when printing. (COPYFILE 'FOO.TEDIT '{LPT}) yields this error in the prompt window:

Sending output to Unix printerT...lpr: Error - The printer or class does not exist
done

From TEdit, Meta-P > Send to a printer > Other... (only option) > {LPT} yields this break window with the error:

TYPE-MISMATCH
In CL::%%NOT-NONCOMPLEX-NUMBER-ERROR:
{IMAGEOBJ}#131,71762 is not a NUMBER.
lpterr

The backtrace:

TEdit/6(debug)BTV
CL::%%NOT-NONCOMPLEX-NUMBER-ERROR
\SLOWLRSH8
   STREAM 
#<Output Stream on {UNIX}<tmp>medleyprint.17949204671/
161,103600>
   CHARCODE {IMAGEOBJ}#131,71762
\MCCSOUTCHAR
   STREAM 
#<Output Stream on {UNIX}<tmp>medleyprint.17949204671/
161,103600>
   CODE {IMAGEOBJ}#131,71762
   A0134 \MCCSOUTCHAR
\OUTCHAR
   CNT 1265
COPYCHARS
SI::*UNWIND-PROTECT*
SI::*UNWIND-PROTECT*
   HOST LPT
   FILE #<IO Tedit Stream/161,17100>
   PRINTOPTIONS (HEADING 
{DSK}<home>paolo>il>BITMAPFNS.TEDIT;1 HEADING 
{DSK}<home>paolo>il>BITMAPFNS.TEDIT;1 %#COPIES 1 
DOCUMENTNAME #<IO Tedit Stream/161,17100>)
   SI::*CATCH-RETURN-TO* NIL
   PRINTER LPT
   COPIES 1
   NAME "Medley Output"
   NSIDES NIL
   TYPE PDF
   SI::*CATCH-RETURN-PC* 489
   A0242 (
#<Output Stream on {UNIX}<tmp>medleyprint.17949204671/
161,103600> "/tmp/medleyprint.17949204671")
   tmpstream 
#<Output Stream on {UNIX}<tmp>medleyprint.17949204671/
161,103600>
   tmpname "/tmp/medleyprint.17949204671"
   out 
#<Output Stream on {UNIX}<tmp>medleyprint.17949204671/
161,103600>
   A0244 T
UnixPrint
   HOST LPT
   FILE #<IO Tedit Stream/161,17100>
   PRINTOPTIONS (HEADING 
{DSK}<home>paolo>il>BITMAPFNS.TEDIT;1 HEADING 
{DSK}<home>paolo>il>BITMAPFNS.TEDIT;1 %#COPIES 1 
DOCUMENTNAME #<IO Tedit Stream/161,17100>)
POSTSCRIPTSEND
   SI::*CLEANUP-FORMS* SI::RESETUNWIND
   IMAGETYPE TEDIT
   PRINTERTYPE PDF
   SENDFN POSTSCRIPTSEND
   HEADING {DSK}<home>paolo>il>BITMAPFNS.TEDIT;1
   PRINTER LPT
   CONVERTED NIL
SI::*UNWIND-PROTECT*
   FILE #<IO Tedit Stream/161,17100>
   HOST {LPT}
   PRINTOPTIONS (HEADING 
{DSK}<home>paolo>il>BITMAPFNS.TEDIT;1)
   LISPXHIST NIL
   SI::*RESETFORMS* NIL
   RESETSTATE NIL
SEND.FILE.TO.PRINTER
   TSTREAM #<IO Tedit Stream/161,17100>
   W {WINDOW}#121,45000
   FILE&TYPE NIL
\TEDIT.PRINT.MENU
   TSTREAM #<IO Tedit Stream/161,17100>
   CHARCODE 336
   TEXTOBJ {TEXTOBJ}#121,37600
   FN \TEDIT.PRINT.MENU
\TEDIT.COMMAND.FUNCTION?
   SI::*DUMMY-FOR-CATCH* T
   SI::*CATCH-RETURN-FROM* (&)
   CHARCODE 336
   TCH NIL
   FN NIL
\TEDIT.COMMAND.LOOPA0001A0002
   SI::*CLEANUP-FORMS* SI::RESETUNWIND
   SI::NLSETQ-VALUE NIL
   *PROCEED-CASES* (&)
   SI::*NLSETQFLAG* NIL
SI::*UNWIND-PROTECT*
   TSTREAM #<IO Tedit Stream/161,17100>
   TEXTOBJ {TEXTOBJ}#121,37600
   LISPXHIST NIL
   SI::*RESETFORMS* ((&))
   RESETSTATE NIL
\TEDIT.COMMAND.LOOP
   TSTREAM #<IO Tedit Stream/161,17100>
   WINDOW {WINDOW}#121,45000
   UNSPAWNED NIL
   TEXTOBJ {TEXTOBJ}#121,37600
\TEDIT1
   *FORM* (\TEDIT1 (QUOTE #<IO Tedit Stream/161,17100>) 
{WINDOW}#121,45000 NIL)
   *ARGVAL* NIL
   *TAIL* NIL
   *FN* \TEDIT1
\EVALFORM
   %#FORM# (\TEDIT1 (QUOTE #<IO Tedit Stream/161,17100>)
 {WINDOW}#121,45000 NIL)
   *CURRENT-PROCESS* #<Process TEdit/173,115000>
   HELPFLAG BREAK!
   \CURRENTDISPLAYLINE 0
   \#DISPLAYLINES 13
   \LINEBUF.OFD #<IO Linebuffer Stream/161,44300>
   *READTABLE* #<ReadTable INTERLISP/173,151714>
   \PRIMTERMTABLE {TERMTABLEP}#173,144740
   \PRIMTERMSA {CHARTABLE}#173,145000
   TtyDisplayStream #<Output Display Stream/161,103700>
   SI::*RESETFORMS* NIL
   \INTERRUPTABLE T
   \TTYWINDOW NIL
   READBUF NIL
   \TERM.OFD #<Output Display Stream/161,44100>
   *STANDARD-OUTPUT* #<Output Display Stream/161,44100>
   *STANDARD-INPUT* #<IO Linebuffer Stream/161,44300>
\MAKE.PROCESS0
T

@pamoroso
Copy link
Member

pamoroso commented Dec 5, 2025

I forgot to mention DEFAULTPRINTINGHOST is NIL by default on my setup.

@rmkaplan
Copy link
Contributor Author

rmkaplan commented Dec 6, 2025

A number of changes:

  • DEFAULTPRINTINGHOST = NIL is like "", means use the system default printer.
  • Tried to fix some basic confusions in the original design, where there was an ambiguity in how to interpret a DEFAULTPRINTINGHOST of the form (printertype printername).
  • Note that it has never been possible to (COPYFILE textstream '{LPT}). Venue erred in different ways, but the problem is that this would treat the textstream as a sequence of characters, ignoring formatting, and tripping over image objects and maybe some other things. The conversion of a tedit stream for printing only to a file that the stream has been written onto. The COPYFILE executes in advance of the conversion, so has already done the damage.

@rmkaplan
Copy link
Contributor Author

rmkaplan commented Jan 19, 2026 via email

@pamoroso
Copy link
Member

Yes, it didn't come back to the Exec, probably hanging somewhere inside the printing code.

@rmkaplan
Copy link
Contributor Author

@nbriggs noted that (COPYFILE 'FOO.PDF '{LPT}VIEWER) was calling Textedit instead of Preview to view the file.

Hopefully, this fixes that issue. More file-name screwing around.

@rmkaplan
Copy link
Contributor Author

@pamoroso , on the issue that it doesn't seem to come back to the exec, can you (TRACE ShellCommand) to see whether it actually returns?

No need to have special entries for POSTSCRIPT.TEXT and PDF.TEXT,
@pamoroso
Copy link
Member

I updated to commit 31c4695 and tested with ShellCommand traced and the same printer naming constraints.

The print job completed successfully and the COPYFILE call still didn't come back to the Exec, but it turns out all I needed to do to get back the prompt was to press ENTER. I got the same issue with the PUTPROP call as you can see in the dribble. This is weird as I immediately get back the prompt when evaluating any other expression at the Exec.

4_ (PUTPROP 'BROTHER¬HL¬L2340D¬SERIES@BRW1008B16CDCAC.LOCAL 'PRINTERTYPE
'UNIX)
UNIX
5_ 

5_ (TRACE ShellCommand)
(ShellCommand)
6_ (COPYFILE "{UNIX}/tmp/BITMAPFNS.TEDIT"
"{LPT}Brother¬HL¬L2340D¬Series@BRW1008B16CDCAC.Local")
{UNIX}<tmp>medley-1798876826-787-lpt.
7_ 

7_ 
shellcommand

@rmkaplan
Copy link
Contributor Author

rmkaplan commented Jan 20, 2026 via email

@pamoroso
Copy link
Member

I generated the transcript with DRIBBLE and pasted the resulting file in the GitHub comment. The printer name includes those logical not ¬ symbols but I have no idea how they get there. To enter the printer name at the Medley Exec I do this:

  1. copy to the clipboard the printer name from the printer settings tool on Linux
  2. paste the printer name into a Linux editor where I complete the Lisp form by manually typing the rest
  3. copy the completed expression from the Linux editor
  4. paste the expression at the Medley Exec

In step 2 I also tried manually deleting the underbars from the printer name and typing them again.

Here is a dribble listing the PUTPROP expression fully typed by hand in Medley, including the printer name:

4_ (PUTPROP 'BROTHER_HL_L2340D_SERIES@BRW100B16CDCAC.LOCAL 'PRINTERTYPE
'UNIX)
UNIX
dribble

@rmkaplan
Copy link
Contributor Author

rmkaplan commented Jan 20, 2026 via email

@pamoroso
Copy link
Member

Yes, the symbols look like underscores in both the printer settings and in the Linux editor.

Here's a test. I copied the printer name from this Linux tool via right-click on the printer > Rename > Ctrl-C:

printers

Then I pasted with Ctrl-V into LibreOffice Writer as I don't have Office:

libreoffice-writer

From LibreOffice Writer I copied with Ctrl-C the first underbar and pasted it into a CHARCODE call at a Medley Exec:

charcode1

I also pasted a logical not symbol copied from one of my above comments:

charcode2

However, the logical not symbols show up only on GitHub and they appear nowehere on Medley in my printer tests.

@rmkaplan
Copy link
Contributor Author

rmkaplan commented Jan 20, 2026 via email

@pamoroso
Copy link
Member

I sent you the printer name pasted into an email.

@rmkaplan
Copy link
Contributor Author

Paolo and I did some more experiments, confirming that the character-code problem comes from the fact that the dribble file is MCCS by default. If the copy into a github comment is done from a Linux opening of that file, you will see bad characters. If the clipboard copy is done from a Tedit of the dribble file, it will be correct.

@nbriggs
Copy link
Contributor

nbriggs commented Jan 20, 2026

Not just dribble files -- should files opened on the {UNIX} device be UTF-8 by default, while files opened on the {DSK} device remain MCCS?
I think we should open a separate issue for this.

@hjellinek
Copy link
Contributor

Not just dribble files -- should files opened on the {UNIX} device be UTF-8 by default, while files opened on the {DSK} device remain MCCS? I think we should open a separate issue for this.

That's an intriguing question that does deserve its own issue, or discussion.

The primary point of dribble files in the modern Medley era is to capture output for external consumption, don't you think? That argues for using a non-MCCS format, and UTF-8 is the obvious choice.

@rmkaplan
Copy link
Contributor Author

rmkaplan commented Jan 20, 2026 via email

@pamoroso
Copy link
Member

I don't think there's a way in GitHub to extract a sequence of comments into a separate issue. But a new issue can link to the first relevant comment of the encoding discussion which may be this one:

#2290 (comment)

or this:

#2290 (comment)

@pamoroso
Copy link
Member

I updated to commit 778f652, still looking good. Are there Bravo files I can test?

@rmkaplan
Copy link
Contributor Author

Minor update to UNIXPRINT so that the printername UNIX maps to the default printer of type UNIX. (Otherwise, PRINTERTYPES would have had the entry (NIL UNIX) instead of (UNIX UNIX), which seems uninformative)

@pamoroso
Copy link
Member

I tested commit d7691be and the change works as expected.

Copy link
Member

@pamoroso pamoroso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good after a lot of testing.

@rmkaplan rmkaplan merged commit 65df2ba into master Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants