medley icon indicating copy to clipboard operation
medley copied to clipboard

Selection includes an image object, typing meta-F causes a break under SEL.AS.STRING

Open masinter opened this issue 1 year ago • 5 comments

  • open a TEDIT window on a document with image objects (I did MAN SETTEMPLATE
  • select some text with an image object in it (one of the cross-reference IMPTR tags)
  • type meta-F
  • Result: ILLEGAL-ARG {IMAGEOBJ} under TEDIT.SEL.AS.STRING (see attached backtrace) SELECT-ERROR.TXT

masinter avatar Jul 17 '24 14:07 masinter

Yes, that’s always been there.

In my current (unpushed) code, TEDIT.SEL.AS.STRING has an extra optional argument CODEFOROBJECT, and it will stash that in the string for every image object.

I suppose it could take a value (T ?) that means skip it.

But either way, is the result meaningful? The conceptual problem is, you asked for a Lisp string, strings only contain characters.

I put the call that tries to get a string out of the document for use in Find and Subsitute under an NLSETQ, at least the caller can decide what to do. In this case, ignore.

Is there a better within-Tedit solution?

On Jul 17, 2024, at 7:12 AM, Larry Masinter @.***> wrote:

open a TEDIT window on a document with image objects (I did MAN SETTEMPLATE select some text with an image object in it (one of the cross-reference IMPTR tags) type meta-F Result: ILLEGAL-ARG {IMAGEOBJ} under TEDIT.SEL.AS.STRING (see attached backtrace) SELECT-ERROR.TXT https://github.com/user-attachments/files/16266768/SELECT-ERROR.TXT — Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/1787, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJLDZSUOQPW7PSUD4Y3ZMZ3V3AVCNFSM6AAAAABLAXKYA2VHI2DSMVQWIX3LMV43ASLTON2WKOZSGQYTGNZTGU2TCNQ. You are receiving this because you are subscribed to this thread.

rmkaplan avatar Jul 17 '24 16:07 rmkaplan

I think the error stuff in common lisp is pretty good. Signal an error, and then let whoever calls TEDIT.SEL.AS.STRING catch the error if it cares. I think you can make the caller decide.

IF you want to be more complicated, then have every different image object use a different character code. Then when you are writing to an image stream, reverse the change and display the image object.

masinter avatar Jul 17 '24 19:07 masinter

How do commonlisp errors interact with NLSETQ and RESETLST, which are more likely wrappers from Interlisp code?

On Jul 17, 2024, at 12:38 PM, Larry Masinter @.***> wrote:

I think the error stuff in common lisp is pretty good. Signal an error, and then let whoever calls TEDIT.SEL.AS.STRING catch the error if it cares. I think you can make the caller decide.

IF you want to be more complicated, then have every different image object use a different character code. Then when you are writing to an image stream, reverse the change and display the image object.

— Reply to this email directly, view it on GitHub https://github.com/Interlisp/medley/issues/1787#issuecomment-2234095521, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQSTUJPMXFZQKFTCCKAXITTZM3B2PAVCNFSM6AAAAABLAXKYA2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDEMZUGA4TKNJSGE. You are receiving this because you commented.

rmkaplan avatar Jul 17 '24 23:07 rmkaplan

Could TEDIT.SEL.AS.STRING return two values? The first is the string with non-chars removed. The second, if necessary, is a list of string segments with the IMAGEOBJ (or any non-character object) items interleaved. It can be NIL if the single string value is complete, or a list with the single string value as its element. This would prevent dealing with the error system. Maybe indicate if 2 values or error by a parameter.

Just a thought. Worth less than 2¢.

MattHeffron avatar Jul 18 '24 00:07 MattHeffron

How do commonlisp errors interact with NLSETQ and RESETLST, which are more likely wrappers from Interlisp code?

https://files.interlisp.org/medley/docs/ReleaseNote/SEC3-IRMFEATURES-II.TEDIT.pdf#page=4 (page 4 in the PDF)

Interlisp errors now use the new XCL error system. Most of the functions still exist for compatibility with existing Interlisp code, but the underlying machinery is different. There are some incompatible differences, however, especially with respect to error numbers.

masinter avatar Jul 18 '24 15:07 masinter