From: Matthias Meulien <orontee@gmail.com>
To: Lars Ingebrigtsen <larsi@gnus.org>
Cc: 57821@debbugs.gnu.org
Subject: bug#57821: 29.0.50; ANSI sequence not filtered in compilation buffer
Date: Fri, 16 Sep 2022 22:59:21 +0200 [thread overview]
Message-ID: <87y1ujyr12.fsf@gmail.com> (raw)
In-Reply-To: <877d23a7mh.fsf@gnus.org> (Lars Ingebrigtsen's message of "Fri, 16 Sep 2022 13:20:06 +0200")
Lars Ingebrigtsen <larsi@gnus.org> writes:
> Matthias Meulien <orontee@gmail.com> writes:
>
>> The OSC sequences sent by flatpak-builder are meant to update the window
>> title (See https://terminalguide.namepad.de/seq/osc-2/). I plan to
>> provide an osc-compilation-filter (modelled on
>> ansi-color-compilation-filter) to be added to compilation-filter-hook.
>>
>> One possible mode is to filter out all osc sequences. An other mode
>> would be to call per command handlers as done by
>> comint-osc-process-output.
>>
>> Any thought?
>
> The default could be to filter out all unknown OSC sequences?
Yes. The following already achieves this:
(defconst osc-control-seq-regexp
;; See ECMA 48, section 8.3.89 "OSC - OPERATING SYSTEM COMMAND".
"\e\\][\x08-\x0D]*[\x20-\x7E]*\\(\a\\|\e\\\\\\)"
"Regexp matching an OSC control sequence.")
(defun osc-filter-region (begin end)
"Filter out all OSC control sequences from region BEGIN to END."
(save-excursion
(goto-char begin)
;; Delete escape sequences.
(while (re-search-forward osc-control-seq-regexp end t)
(delete-region (match-beginning 0) (match-end 0)))))
(defun osc-compilation-filter ()
(let ((inhibit-read-only t))
(osc-filter-region compilation-filter-start (point))))
(add-hook 'compilation-filter-hook #'osc-compilation-filter)
I'll try to implement the `osc-compilation-filter' this week-end. What
would be the right place for this, progmodes/compile.el? A new osc.el
file?
Side notes:
1. I just learnt about the optional COMINT argument of `compile': It
solves the original problem of filtering OSC sequences from compilation
output buffers; One has to add `comint-osc-process-output' to
`comint-output-filter-functions' and then must call `compile' with
universal argument...
2. With the patch attached to bug#57866 installed, OSC 2 sequences are
collected from comint buffers and the frame title can be updated.
--
Matthias
next prev parent reply other threads:[~2022-09-16 20:59 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-15 8:24 bug#57821: 29.0.50; ANSI sequence not filtered in compilation buffer Matthias Meulien
2022-09-15 11:13 ` Matthias Meulien
2022-09-16 11:20 ` Lars Ingebrigtsen
2022-09-16 20:59 ` Matthias Meulien [this message]
2022-09-17 17:21 ` Matthias Meulien
2022-09-18 10:33 ` Lars Ingebrigtsen
2022-09-18 12:45 ` Matthias Meulien
2022-09-18 12:52 ` Lars Ingebrigtsen
2022-09-18 13:42 ` Matthias Meulien
2022-09-18 13:46 ` Lars Ingebrigtsen
2022-09-18 15:19 ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-18 15:45 ` Matthias Meulien
2022-09-18 16:27 ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-09-19 8:17 ` Lars Ingebrigtsen
2022-09-19 8:38 ` Matthias Meulien
2022-09-19 18:12 ` Matthias Meulien
2022-09-19 18:47 ` Lars Ingebrigtsen
2022-09-18 19:03 ` Jose A Ortega Ruiz
2022-09-18 19:11 ` Eli Zaretskii
2022-09-18 20:56 ` Matthias Meulien
2022-09-18 15:19 ` Basil L. Contovounesios via Bug reports for GNU Emacs, the Swiss army knife of text editors
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87y1ujyr12.fsf@gmail.com \
--to=orontee@gmail.com \
--cc=57821@debbugs.gnu.org \
--cc=larsi@gnus.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).