Subject: Re: bug#78263: [PATCH 1/3] Ignore OSC sequences in term instead of printing them

From: Stéphane Zermatten <[email-masked]>
Date: Wed, 4 Jun 2025 21:04:58 +0300

> On 3 Jun 2025, at 14:09, Eli Zaretskii <[email-masked]> wrote:
> 
>> From: Stéphane Zermatten <[email-masked]>
>> Date: Mon, 2 Jun 2025 20:01:32 +0300
>> Cc: Eli Zaretskii <[email-masked]>,
>> Per Bothner <[email-masked]>,
>> [email-masked]
>> 
>> I updated the change, see the new version attached.
> 
> I have a few minor comments below.
> 
>> No news from the copyright assignment front yet.
> 
> It will take around two weeks.
> 
>> Handlers can be registered to term-osc-handler, which by defaults,
>> supports OSC 0, 2, 7 and 8, using handlers defined in ansi-osc. Unknown
>> OSC sequences are properly ignored.
>> 
>> * lisp/term.el:
>>  (term-emulate-terminal): handle OSC sequences
>>  term-osc-handler: new custom option
>>  term-control-seq-regexp: extended regexp
>>  term--osc-max-byte: new private constant
>> * lisp/ansi-osc.el:
>>  ansi-osc-handler: handle OSC 0 (like OSC 2)
> 
> Please reformat the log message according to our conventions: function
> and variable names in parentheses, 2 spaces between sentences, etc.
> For the details see CONTRIBUTE and also consult the many examples of
> log messages in Git.

Done (Correctly, this time, hopefully)

> 
>> +(defcustom term-osc-handlers nil
>> +  "Terminal-specific OSC sequence handler function alist.
>> +
>> +OSC (Operating System Command) is a category of ANSI escape sequence
>> +used in terminal application to introduce custom commands. Terminals
>> +ignore unknown OSC sequences by default. Handlers can be registered here
>> +to add support for new OSC sequences to `term'.
> 
> Two spaces between sentences, here and elsewhere.

Done 

> 
>> +Functions in this alist are passed matching valid OSC sequences as
>> +they're sent to the terminal.
>> +
>> +Valid OSC sequences are of the form
>> +  ESC ] code ; text BEL
>> +  ESC ] code ; text ESC \
>> +
>> +Each entry has the form (CODE . FUNCTION), where CODE is the string that
>> +appears before the semicolon.
>> +
>> +FUNCTION is called with two arguments CODE and TEXT with the term buffer
>> +active and its point and state active at the time the OSC sequence
>> +appeared in the stream.
> 
> This should clarify what is TEXT in this context.

A rephrased it a bit. Hopefully it is clearer.

> Thanks.