GNU bug report logs - #57821
29.0.50; ANSI sequence not filtered in compilation buffer

Previous Next

Package: emacs;

Reported by: Matthias Meulien <orontee <at> gmail.com>

Date: Thu, 15 Sep 2022 08:25:01 UTC

Severity: normal

Found in version 29.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 57821 in the body.
You can then email your comments to 57821 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Thu, 15 Sep 2022 08:25:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Matthias Meulien <orontee <at> gmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 15 Sep 2022 08:25:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Matthias Meulien <orontee <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: 29.0.50; ANSI sequence not filtered in compilation buffer
Date: Thu, 15 Sep 2022 10:24:15 +0200
[Message part 1 (text/plain, inline)]
Under the hypothesis of a host with Python installed with poetry,
pre-commit tooling and flatpak builder:

1. Start 'emacs -Q'

2. Clone the Git repository https://github.com/orontee/argos and install
   pre-commit hooks as described in the CONTRIBUTING guide

3. Visit a file in the directory containing the cloned repository

3. C-x p c poetry run pre-commit run -a RET

4. Rename buffer (C-x x u)

5. C-x p c flatpak-builder --user --install --force-clean builddir
   io.github.orontee.Argos.json

Observe that the first compilationbuffer doesn't show any ANSI sequences
but the second displays many ^G^[ char sequences:

[Capture d’écran du 2022-09-15 08-57-08.png (image/png, inline)]
[Message part 3 (text/plain, inline)]
With `ansi-color-compilation-filter' added to `compilation-filter-hook',
the situation is the same:

[Capture d’écran du 2022-09-15 08-52-35.png (image/png, inline)]
[Message part 5 (text/plain, inline)]
Again same situation when running both commands from a shell buffer.

But with `comint-osc-process-output' added to
`comint-output-filter-functions' then everything looks good.  It seems
that flatpak-builder outputs OSC sequences and ANSI sequences.

[Capture d’écran du 2022-09-15 10-23-38.png (image/png, inline)]
[Message part 7 (text/plain, inline)]
Is there a way to filter out (or render) OSC sequences from compilation
output buffers as is possible for comint output?



In GNU Emacs 29.0.50 (build 1, x86_64-pc-linux-gnu, cairo version
 1.16.0) of 2022-09-14 built on carbon
Repository revision: f0798ac13dcb4c01a883f165e03c3cd7f208667c
Repository branch: master
Windowing system distributor 'The X.Org Foundation', version 11.0.12011000
System Description: Debian GNU/Linux 11 (bullseye)

Configured using:
 'configure --with-native-compilation --with-x-toolkit=no'

Configured features:
ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG
JSON LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES
NATIVE_COMP NOTIFY INOTIFY OLDXMENU PDUMPER PNG RSVG SECCOMP SOUND
SQLITE3 THREADS TIFF WEBP X11 XDBE XIM XINPUT2 XPM ZLIB

Important settings:
  value of $LANG: fr_FR.UTF-8
  value of $XMODIFIERS: @im=ibus
  locale-coding-system: utf-8-unix

Major mode: Bookmark Menu

Minor modes in effect:
  shell-dirtrack-mode: t
  hl-line-mode: t
  header-line-indent-mode: t
  highlight-changes-visible-mode: t
  minions-mode: t
  global-company-mode: t
  company-mode: t
  desktop-save-mode: t
  pixel-scroll-precision-mode: t
  save-place-mode: t
  electric-pair-mode: t
  icomplete-mode: t
  global-so-long-mode: t
  global-auto-revert-mode: t
  auto-insert-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-layout-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tab-bar-mode: t
  file-name-shadow-mode: t
  context-menu-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  window-divider-mode: t
  buffer-read-only: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
/home/matthias/.config/emacs/elpa/dictionary-20201001.1727/dictionary hides /usr/local/share/emacs/29.0.50/lisp/net/dictionary

Features:
(shadow sort gnus-cite mail-extr emacsbug cl-print gnus-async qp gnus-ml
disp-table gnus-topic nndraft nnmh nnfolder utf-7 epa-file gnus-agent
gnus-srvr gnus-score score-mode nnvirtual gnus-msg gnus-cache generic po
pcmpl-unix sh-script executable git-link meson-mode smie shell pulse
files-x grep rng-xsd xsd-regexp rng-cmpct rng-nxml rng-valid nxml-mode
nxml-outln nxml-rap sgml-mode facemenu shortdoc help-fns radix-tree
hideshow cap-words superword subword js restclient ox-odt rng-loc
rng-uri rng-parse rng-match rng-dt rng-util rng-pttrn nxml-parse nxml-ns
nxml-enc xmltok nxml-util ox-latex ox-icalendar org-agenda ox-html table
ox-ascii ox-publish ox org-element avl-tree ol-eww ol-rmail ol-mhe
ol-irc ol-info ol-gnus nnselect gnus-art mm-uu mml2015 mm-view mml-smime
smime dig ol-docview doc-view jka-compr ol-bibtex ol-bbdb ol-w3m ol-doi
org-link-doi mm-archive mule-util gnutls network-stream url-cache
url-http url-auth url-gw nsm finder-inf misearch multi-isearch
emacs-news-mode image-dired image-dired-tags image-dired-external
image-dired-util wallpaper image-mode exif gnus-sum man eww xdg
url-queue shr pixel-fill kinsoku url-file svg dom mm-url hl-line dabbrev
log-edit add-log smerge-mode diff whitespace display-line-numbers
hilit-chg dired-aux flyspell goto-addr rst vc-hg vc-bzr vc-src vc-sccs
vc-svn vc-cvs vc-rcs log-view pcvs-util vc-dir vc go-mode ffap eglot
array jsonrpc ert ewoc debug backtrace flymake-proc flymake compile
imenu company-oddmuse company-keywords company-etags etags fileloop
generator xref company-gtags company-dabbrev-code company-dabbrev
company-files company-clang company-capf company-cmake company-semantic
company-template company-bbdb ob-python python project minions compat
company pcase carbon-custom cus-edit cus-load gnus-demon nntp gnus-group
gnus-undo gnus-start gnus-dbus dbus xml gnus-cloud nnimap nnmail
mail-source utf7 parse-time gnus-spec gnus-win nnoo gnus-int gnus-range
message sendmail yank-media puny rfc822 mml mml-sec epa derived epg
rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus nnheader
gnus-util mail-utils range mm-util mail-prsvr wid-edit gnus-dired
dired-x dired dired-loaddefs org-capture org-refile org ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-macro org-footnote org-src ob-comint
org-pcomplete pcomplete comint ansi-color org-list org-faces
org-entities org-version ob-emacs-lisp ob-core ob-eval org-table
oc-basic bibtex iso8601 ol org-keys oc org-compat org-macs org-loaddefs
format-spec find-func cal-menu calendar cal-loaddefs dictionary link
connection advice markdown-mode color thingatpt noutline outline
skeleton find-file vc-git diff-mode easy-mmode vc-dispatcher ispell
time-date comp comp-cstr warnings icons rx cl-extra help-mode desktop
frameset server bookmark text-property-search pp pixel-scroll cua-base
ring saveplace elec-pair icomplete so-long autorevert filenotify
autoinsert cc-mode cc-fonts cc-guess cc-menus cc-cmds cc-styles cc-align
cc-engine cc-vars cc-defs generic-x face-remap
graphviz-dot-mode-autoloads lsp-pyright-autoloads lsp-mode-autoloads
ht-autoloads f-autoloads lv-autoloads proof-site proof-autoloads
s-autoloads spinner-autoloads info yaml-autoloads package browse-url url
url-proxy url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util mailcap url-handlers url-parse
auth-source cl-seq eieio eieio-core cl-macs password-cache json subr-x
map byte-opt gv bytecomp byte-compile cconv url-vars cl-loaddefs cl-lib
rmc iso-transl tooltip eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/x-win x-win term/common-win x-dnd
tool-bar dnd fontset image regexp-opt fringe tabulated-list replace
newcomment text-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch easymenu timer select scroll-bar mouse jit-lock
font-lock syntax font-core term/tty-colors frame minibuffer nadvice seq
simple cl-generic indonesian philippine cham georgian utf-8-lang
misc-lang vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms
cp51932 hebrew greek romanian slovak czech european ethiopic indian
cyrillic chinese composite emoji-zwj charscript charprop case-table
epa-hook jka-cmpr-hook help abbrev obarray oclosure cl-preloaded button
loaddefs faces cus-face macroexp files window text-properties overlay
sha1 md5 base64 format env code-pages mule custom widget keymap
hashtable-print-readable backquote threads dbusbind inotify lcms2
dynamic-setting system-font-setting font-render-setting cairo xinput2 x
multi-tty make-network-process native-compile emacs)

Memory information:
((conses 16 949696 128038)
 (symbols 48 46759 4)
 (strings 32 251243 27013)
 (string-bytes 1 10003438)
 (vectors 16 97565)
 (vector-slots 8 2088345 194542)
 (floats 8 651 694)
 (intervals 56 24377 3352)
 (buffers 1000 98))

-- 
Matthias

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Thu, 15 Sep 2022 11:14:01 GMT) Full text and rfc822 format available.

Message #8 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Matthias Meulien <orontee <at> gmail.com>
To: 57821 <at> debbugs.gnu.org
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Thu, 15 Sep 2022 13:13:49 +0200
Matthias Meulien <orontee <at> gmail.com> writes:

> (...) But with `comint-osc-process-output' added to
> `comint-output-filter-functions' then everything looks good.  It seems
> that flatpak-builder outputs OSC sequences and ANSI sequences.

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?

-- 
Matthias




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Fri, 16 Sep 2022 11:21:02 GMT) Full text and rfc822 format available.

Message #11 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Matthias Meulien <orontee <at> gmail.com>
Cc: 57821 <at> debbugs.gnu.org
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Fri, 16 Sep 2022 13:20:06 +0200
Matthias Meulien <orontee <at> 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?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Fri, 16 Sep 2022 21:00:01 GMT) Full text and rfc822 format available.

Message #14 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Matthias Meulien <orontee <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 57821 <at> debbugs.gnu.org
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Fri, 16 Sep 2022 22:59:21 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Matthias Meulien <orontee <at> 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




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Sat, 17 Sep 2022 17:22:02 GMT) Full text and rfc822 format available.

Message #17 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Matthias Meulien <orontee <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 57821 <at> debbugs.gnu.org
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Sat, 17 Sep 2022 19:21:10 +0200
[Message part 1 (text/plain, inline)]
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Matthias Meulien <orontee <at> 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?

Here are three patchs that:
- Extract current support of OSC escape sequences from comint.el
- Handle OSC command to set window title
- Provide an OSC escape sequences filter for compilation buffer

[0001-Extract-support-of-OSC-escape-sequences-from-comint.patch (text/x-diff, attachment)]
[0002-Handle-OSC-command-to-set-window-title.patch (text/x-diff, attachment)]
[0003-OSC-escape-sequences-filter-for-compilation-buffer.patch (text/x-diff, attachment)]
[Message part 5 (text/plain, inline)]
The second patch obsolete the one provided in bug#57866.

Matthias

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Sun, 18 Sep 2022 10:34:02 GMT) Full text and rfc822 format available.

Message #20 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Matthias Meulien <orontee <at> gmail.com>
Cc: 57821 <at> debbugs.gnu.org
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Sun, 18 Sep 2022 12:33:48 +0200
Matthias Meulien <orontee <at> gmail.com> writes:

> Here are three patchs that:
> - Extract current support of OSC escape sequences from comint.el
> - Handle OSC command to set window title
> - Provide an OSC escape sequences filter for compilation buffer

Thanks; looks good to me except for the commit messages:

> * lisp/osc.el (osc-control-seq-regexp):
> (osc-filter-region):
> (osc-for-compilation-buffer):
> (osc-compilation-filter):

You're supposed to type in after the colon what the change for the
relevant item does.  :-)





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Sun, 18 Sep 2022 12:46:02 GMT) Full text and rfc822 format available.

Message #23 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Matthias Meulien <orontee <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 57821 <at> debbugs.gnu.org
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Sun, 18 Sep 2022 14:45:05 +0200
[Message part 1 (text/plain, inline)]
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> You're supposed to type in after the colon what the change for the
> relevant item does.  :-)

😁 Sure.  Here are updated patches.  I also fixed the aliases: One was
missing (comint-osc-handlers) and one name was wrong
(comint-osc-hyperlink).

Note that I've not written any News entry.  Should I? For each patch?

[0001-Extract-support-of-OSC-escape-sequences-from-comint.patch (text/x-diff, attachment)]
[0002-Handle-OSC-command-to-set-window-title.patch (text/x-diff, attachment)]
[0003-OSC-escape-sequences-filter-for-compilation-buffer.patch (text/x-diff, attachment)]
[Message part 5 (text/plain, inline)]



-- 
Matthias

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Sun, 18 Sep 2022 12:53:02 GMT) Full text and rfc822 format available.

Message #26 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Matthias Meulien <orontee <at> gmail.com>
Cc: 57821 <at> debbugs.gnu.org
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Sun, 18 Sep 2022 14:52:03 +0200
Matthias Meulien <orontee <at> gmail.com> writes:

> 😁 Sure.  Here are updated patches.  I also fixed the aliases: One was
> missing (comint-osc-handlers) and one name was wrong
> (comint-osc-hyperlink).

Thanks; pushed to Emacs 29.

> Note that I've not written any News entry.  Should I? For each patch?

I think one NEWS entry would be enough...




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Sun, 18 Sep 2022 13:43:02 GMT) Full text and rfc822 format available.

Message #29 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Matthias Meulien <orontee <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 57821 <at> debbugs.gnu.org
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Sun, 18 Sep 2022 15:42:35 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Matthias Meulien <orontee <at> gmail.com> writes:
>
>> 😁 Sure.  Here are updated patches.  I also fixed the aliases: One was
>> missing (comint-osc-handlers) and one name was wrong
>> (comint-osc-hyperlink).
>
> Thanks; pushed to Emacs 29.

Sorry for the warning... I forgot to check `make' output...

>> Note that I've not written any News entry.  Should I? For each patch?
>
> I think one NEWS entry would be enough...

Here it is:

diff --git a/etc/NEWS b/etc/NEWS
index ae3f84c1b9..a8101da229 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2440,6 +2440,18 @@ The old name is still available as an obsolete function alias.
 
 * New Modes and Packages in Emacs 29.1
 
+*** New package 'osc'.
+Support for OSC ("Operating System Command") espace sequences has been
+extracted from 'comint.el' in order to provide interpretation of OSC
+escape sequences in compilation buffers.
+
+Adding the new function 'osc-compilation-filter' to
+'compilation-filter-hook' enables interpretation of OSC ("Operating
+System Command") escape sequences in compilation buffers. By default,
+all sequences are filtered out.
+
+A handler for OSC 2, the command to set a window title, is provided.
+
 +++
 ** New commands 'image-crop' and 'image-elide'.
 These commands allow interactively cropping/eliding the image at
 
-- 
Matthias




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Sun, 18 Sep 2022 13:47:02 GMT) Full text and rfc822 format available.

Message #32 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Matthias Meulien <orontee <at> gmail.com>
Cc: 57821 <at> debbugs.gnu.org
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Sun, 18 Sep 2022 15:46:31 +0200
Matthias Meulien <orontee <at> gmail.com> writes:

>> I think one NEWS entry would be enough...
>
> Here it is:

Thanks; pushed to Emacs 29.




bug marked as fixed in version 29.1, send any further explanations to 57821 <at> debbugs.gnu.org and Matthias Meulien <orontee <at> gmail.com> Request was from Lars Ingebrigtsen <larsi <at> gnus.org> to control <at> debbugs.gnu.org. (Sun, 18 Sep 2022 13:47:03 GMT) Full text and rfc822 format available.

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Sun, 18 Sep 2022 15:20:01 GMT) Full text and rfc822 format available.

Message #37 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Matthias Meulien <orontee <at> gmail.com>
Cc: 57821 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Sun, 18 Sep 2022 18:19:15 +0300
Matthias Meulien [2022-09-18 14:45 +0200] wrote:

> I also fixed the aliases: One was missing (comint-osc-handlers) and
> one name was wrong (comint-osc-hyperlink).

[...]

> +;; Aliases defined for reverse compatibility
> +(defalias 'comint-osc-handlers 'osc-handlers)
> +(defalias 'comint-osc-hyperlink-map 'osc-hyperlink-map)

These are variables, so should use defvaralias instead.

> +(defalias 'comint-osc-hyperlink 'osc-hyperlink)

This is a button type, so I guess the closest thing is making one the
:supertype of the other?

Thanks,

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Sun, 18 Sep 2022 15:20:02 GMT) Full text and rfc822 format available.

Message #40 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Matthias Meulien <orontee <at> gmail.com>
Cc: 57821 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Sun, 18 Sep 2022 18:19:36 +0300
Matthias Meulien [2022-09-18 15:42 +0200] wrote:

> +*** New package 'osc'.
> +Support for OSC ("Operating System Command") espace sequences has been
> +extracted from 'comint.el' in order to provide interpretation of OSC
> +escape sequences in compilation buffers.
> +
> +Adding the new function 'osc-compilation-filter' to
> +'compilation-filter-hook' enables interpretation of OSC ("Operating
> +System Command") escape sequences in compilation buffers. By default,
                                                           ^^
Two spaces after a full stop, here and in the other patches.

> +all sequences are filtered out.
> +
> +A handler for OSC 2, the command to set a window title, is provided.

Also OSC 7 and 8, no?

BTW, the commentary in comint.el doesn't mention OSC 2.

Thanks,

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Sun, 18 Sep 2022 15:46:02 GMT) Full text and rfc822 format available.

Message #43 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Matthias Meulien <orontee <at> gmail.com>
To: "Basil L. Contovounesios" <contovob <at> tcd.ie>
Cc: 57821 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Sun, 18 Sep 2022 17:45:45 +0200
"Basil L. Contovounesios" <contovob <at> tcd.ie> writes:

> Matthias Meulien [2022-09-18 15:42 +0200] wrote:
>
>> +*** New package 'osc'.
>> +Support for OSC ("Operating System Command") espace sequences has been
>> +extracted from 'comint.el' in order to provide interpretation of OSC
>> +escape sequences in compilation buffers.
>> +
>> +Adding the new function 'osc-compilation-filter' to
>> +'compilation-filter-hook' enables interpretation of OSC ("Operating
>> +System Command") escape sequences in compilation buffers. By default,
>                                                            ^^
> Two spaces after a full stop, here and in the other patches.

Thanks for your careful reading!  I failed to found places with this
problem in the other patches...

>> +all sequences are filtered out.
>> +
>> +A handler for OSC 2, the command to set a window title, is provided.
>
> Also OSC 7 and 8, no?

Sure, I thought it's a new handler was implicit in the NEWS file; Other
handlers were already mentionned in NEWS.28. But let's try to be more
precise.

>
> BTW, the commentary in comint.el doesn't mention OSC 2.

+1

Here is a patch improving the news entry and fixing the defalias for
variables you mentionned in your other message.  I didn't tried to solve
the alias for the button; I'll have to learn more about aliases first, I
thought that just "maintaining" the symbol would be ok.

diff --git a/etc/NEWS b/etc/NEWS
index 88d00d9474..5fe96b0e0c 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2441,11 +2441,12 @@ extracted from 'comint.el' in order to provide interpretation of OSC
 escape sequences in compilation buffers.
 
 Adding the new function 'osc-compilation-filter' to
-'compilation-filter-hook' enables interpretation of OSC ("Operating
-System Command") escape sequences in compilation buffers. By default,
-all sequences are filtered out.
+'compilation-filter-hook' enables interpretation of OSC escape
+sequences in compilation buffers.  By default, all sequences are
+filtered out.
 
-A handler for OSC 2, the command to set a window title, is provided.
+The list of handlers (covering OSC 7 and 8) has been extended with a
+handler for OSC 2, the command to set a window title.
 
 +++
 *** New user option 'project-vc-include-untracked'.
diff --git a/lisp/comint.el b/lisp/comint.el
index afaa27c2c0..202cf6eab5 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -3910,17 +3910,17 @@ comint-redirect-results-list-from-process
 ;;============================================================================
 ;; Adding `comint-osc-process-output' to
 ;; `comint-output-filter-functions' enables the interpretation of OSC
-;; escape sequences.  By default, OSC 7 and 8 (for current directory
-;; and hyperlinks respectively) are acted upon.  Adding more entries
-;; to `comint-osc-handlers' allows a customized treatment of further
-;; sequences.
+;; escape sequences.  By default, OSC 2, 7 and 8 (for window title,
+;; current directory and hyperlinks respectively) are acted upon.
+;; Adding more entries to `comint-osc-handlers' allows a customized
+;; treatment of further sequences.
 
 ;; Aliases defined for reverse compatibility
-(defalias 'comint-osc-handlers 'osc-handlers)
+(defvaralias 'comint-osc-handlers 'osc-handlers)
 (defalias 'comint-osc-directory-tracker 'osc-directory-tracker)
 (defalias 'comint-osc-hyperlink-handler 'osc-hyperlink-handler)
 (defalias 'comint-osc-hyperlink 'osc-hyperlink)
-(defalias 'comint-osc-hyperlink-map 'osc-hyperlink-map)
+(defvaralias 'comint-osc-hyperlink-map 'osc-hyperlink-map)
 
 (defun comint-osc-process-output (_)
   "Interpret OSC escape sequences in comint output.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Sun, 18 Sep 2022 16:28:01 GMT) Full text and rfc822 format available.

Message #46 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: "Basil L. Contovounesios" <contovob <at> tcd.ie>
To: Matthias Meulien <orontee <at> gmail.com>
Cc: 57821 <at> debbugs.gnu.org, Lars Ingebrigtsen <larsi <at> gnus.org>
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Sun, 18 Sep 2022 19:27:12 +0300
Matthias Meulien [2022-09-18 17:45 +0200] wrote:

> "Basil L. Contovounesios" <contovob <at> tcd.ie> writes:
>
>> Two spaces after a full stop, here and in the other patches.
>
> Thanks for your careful reading!  I failed to found places with this
> problem in the other patches...

In the Commentary section of osc.el:

  ;; Interpretation of OSC (Operating System Commands) escape
  ;; sequences. Handlers for OSC 2, 7 and 8 (for window title, current
              ^^
  ;; directory and hyperlinks respectively) are provided.

  ;; The function `osc-compilation-filter' can be added to
  ;; `compilation-filter-hook' to collect OSC sequences in compilation
  ;; buffers. The variable `osc-for-compilation-buffer' tells what to do
            ^^
  ;; with collected sequences.

>>> +all sequences are filtered out.
>>> +
>>> +A handler for OSC 2, the command to set a window title, is provided.
>>
>> Also OSC 7 and 8, no?
>
> Sure, I thought it's a new handler was implicit in the NEWS file;

Saying "new package 'osc'" followed by "a handler for OSC 2 is provided"
sounds like that is the only handler provided by the new 'osc' package,
or at least like the entry is talking about what is true rather than
what is new.

> handlers were already mentionned in NEWS.28. But let's try to be more
> precise.

The new text LGTM.

> Here is a patch improving the news entry and fixing the defalias for
> variables you mentionned in your other message.  I didn't tried to solve
> the alias for the button; I'll have to learn more about aliases first, I
> thought that just "maintaining" the symbol would be ok.

Symbols have three distinct slots in which values can be stored: the
value slot, the function slot, and the property list slot.

defalias changes the function slot, so it's only appropriate for symbols
which are meant to be called as functions.

defvaralias changes the value slot, so it's only appropriate for symbols
which are meant to be used as variables.

Button types are just symbols that record certain information in their
property list, like which function to call when clicked, which face to
be fontified with, etc.

So in this case it's the button type's plist that needs to be
aliased/cloned.  AFAIK there is no built-in incantation for this, so I
guess you need to resort to either:
(a) manually calling symbol-plist + setplist;
(b) defining one button type as the supertype of the other; or
(c) not bothering with the compatibility alias at all.

Thanks,

-- 
Basil




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Sun, 18 Sep 2022 19:05:02 GMT) Full text and rfc822 format available.

Message #49 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Jose A Ortega Ruiz <jao <at> gnu.org>
To: Matthias Meulien <orontee <at> gmail.com>, Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: 57821 <at> debbugs.gnu.org
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Sun, 18 Sep 2022 20:03:56 +0100
On Sun, Sep 18 2022, Matthias Meulien wrote:

> Lars Ingebrigtsen <larsi <at> gnus.org> writes:
>
>> Matthias Meulien <orontee <at> gmail.com> writes:
>>
>>> 😁 Sure.  Here are updated patches.  I also fixed the aliases: One was
>>> missing (comint-osc-handlers) and one name was wrong
>>> (comint-osc-hyperlink).
>>
>> Thanks; pushed to Emacs 29.
>
> Sorry for the warning... I forgot to check `make' output...
>
>>> Note that I've not written any News entry.  Should I? For each patch?
>>
>> I think one NEWS entry would be enough...
>
> Here it is:
>
> diff --git a/etc/NEWS b/etc/NEWS
> index ae3f84c1b9..a8101da229 100644
> --- a/etc/NEWS
> +++ b/etc/NEWS
> @@ -2440,6 +2440,18 @@ The old name is still available as an obsolete function alias.
>  
>  * New Modes and Packages in Emacs 29.1
>  
> +*** New package 'osc'.
> +Support for OSC ("Operating System Command") espace sequences has been

espace? :)

cheers,
jao
-- 
"In the beginning the Universe was created. This has made a lot of people
very angry and been widely regarded as a bad move."
 - Douglas Adams




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Sun, 18 Sep 2022 19:12:02 GMT) Full text and rfc822 format available.

Message #52 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Jose A Ortega Ruiz <jao <at> gnu.org>
Cc: 57821 <at> debbugs.gnu.org, larsi <at> gnus.org, orontee <at> gmail.com
Subject: Re: bug#57821: 29.0.50;
 ANSI sequence not filtered in compilation buffer
Date: Sun, 18 Sep 2022 22:11:17 +0300
> Cc: 57821 <at> debbugs.gnu.org
> From: Jose A Ortega Ruiz <jao <at> gnu.org>
> Date: Sun, 18 Sep 2022 20:03:56 +0100
> 
> > +*** New package 'osc'.
> > +Support for OSC ("Operating System Command") espace sequences has been
> 
> espace? :)

It should be epacse.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Sun, 18 Sep 2022 20:57:02 GMT) Full text and rfc822 format available.

Message #55 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Matthias Meulien <orontee <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 57821 <at> debbugs.gnu.org, larsi <at> gnus.org, Jose A Ortega Ruiz <jao <at> gnu.org>
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Sun, 18 Sep 2022 22:56:11 +0200
Eli Zaretskii <eliz <at> gnu.org> writes:

>> Cc: 57821 <at> debbugs.gnu.org
>> From: Jose A Ortega Ruiz <jao <at> gnu.org>
>> Date: Sun, 18 Sep 2022 20:03:56 +0100
>> 
>> > +*** New package 'osc'.
>> > +Support for OSC ("Operating System Command") espace sequences has been
>> 
>> espace? :)
>
> It should be epacse.

Thank you for your careful reading.
-- 
Matthias




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Mon, 19 Sep 2022 08:18:02 GMT) Full text and rfc822 format available.

Message #58 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Matthias Meulien <orontee <at> gmail.com>
Cc: "Basil L. Contovounesios" <contovob <at> tcd.ie>, 57821 <at> debbugs.gnu.org
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Mon, 19 Sep 2022 10:17:38 +0200
Matthias Meulien <orontee <at> gmail.com> writes:

> Here is a patch improving the news entry and fixing the defalias for
> variables you mentionned in your other message.

I see that Eli has rewritten parts of the documentation here...  Can you
have a read of the current trunk and see whether there's anything more
to do here?




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Mon, 19 Sep 2022 08:39:02 GMT) Full text and rfc822 format available.

Message #61 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Matthias Meulien <orontee <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: "Basil L. Contovounesios" <contovob <at> tcd.ie>, 57821 <at> debbugs.gnu.org
Subject: Re: bug#57821: 29.0.50;
 ANSI sequence not filtered in compilation buffer
Date: Mon, 19 Sep 2022 10:38:39 +0200
[Message part 1 (text/plain, inline)]
Sure, I'll do that before end of day.

Matthias

Le lun. 19 sept. 2022, 10:17, Lars Ingebrigtsen <larsi <at> gnus.org> a écrit :

> Matthias Meulien <orontee <at> gmail.com> writes:
>
> > Here is a patch improving the news entry and fixing the defalias for
> > variables you mentionned in your other message.
>
> I see that Eli has rewritten parts of the documentation here...  Can you
> have a read of the current trunk and see whether there's anything more
> to do here?
>
[Message part 2 (text/html, inline)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Mon, 19 Sep 2022 18:13:02 GMT) Full text and rfc822 format available.

Message #64 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Matthias Meulien <orontee <at> gmail.com>
To: Lars Ingebrigtsen <larsi <at> gnus.org>
Cc: "Basil L. Contovounesios" <contovob <at> tcd.ie>, 57821 <at> debbugs.gnu.org
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Mon, 19 Sep 2022 20:12:32 +0200
Lars Ingebrigtsen <larsi <at> gnus.org> writes:

> Matthias Meulien <orontee <at> gmail.com> writes:
>
>> Here is a patch improving the news entry and fixing the defalias for
>> variables you mentionned in your other message.
>
> I see that Eli has rewritten parts of the documentation here...  Can you
> have a read of the current trunk and see whether there's anything more
> to do here?

Here are the fixes left after Eli's work.  To my knowledge the only
known problem still to address is the renaming of the button type
comint-osc-hyperlink to osc-hyperlink; I've not found time to study
Basil advice.

diff --git a/etc/NEWS b/etc/NEWS
index 723bdd7c75..ee333a84e4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -2450,7 +2450,9 @@ Adding the new function 'osc-compilation-filter' to
 sequences in compilation buffers.  By default, all sequences are
 filtered out.
 
-A handler for OSC 2, the command to set a window title, is provided.
+The list of handlers (already covering OSC 7 and 8) has been extended
+with a handler for OSC 2, the command to set a window title.
+
 
 +++
 *** New user option 'project-vc-include-untracked'.
diff --git a/lisp/comint.el b/lisp/comint.el
index afaa27c2c0..b2a04ea55a 100644
--- a/lisp/comint.el
+++ b/lisp/comint.el
@@ -3916,11 +3916,11 @@ comint-redirect-results-list-from-process
 ;; sequences.
 
 ;; Aliases defined for reverse compatibility
-(defalias 'comint-osc-handlers 'osc-handlers)
+(defvaralias 'comint-osc-handlers 'osc-handlers)
 (defalias 'comint-osc-directory-tracker 'osc-directory-tracker)
 (defalias 'comint-osc-hyperlink-handler 'osc-hyperlink-handler)
 (defalias 'comint-osc-hyperlink 'osc-hyperlink)
-(defalias 'comint-osc-hyperlink-map 'osc-hyperlink-map)
+(defvaralias 'comint-osc-hyperlink-map 'osc-hyperlink-map)
 
 (defun comint-osc-process-output (_)
   "Interpret OSC escape sequences in comint output.
diff --git a/lisp/osc.el b/lisp/osc.el
index 8f4cd630ba..14f7fe6a4f 100644
--- a/lisp/osc.el
+++ b/lisp/osc.el
@@ -22,14 +22,14 @@
 
 ;;; Commentary:
 
-;; Interpretation of OSC (Operating System Commands) escape
-;; sequences. Handlers for OSC 2, 7 and 8 (for window title, current
-;; directory and hyperlinks respectively) are provided.
+;; Interpretation of OSC (Operating System Commands) escape sequences.
+;; Handlers for OSC 2, 7 and 8 (for window title, current directory
+;; and hyperlinks respectively) are provided.
 
 ;; The function `osc-compilation-filter' can be added to
 ;; `compilation-filter-hook' to collect OSC sequences in compilation
-;; buffers. The variable `osc-for-compilation-buffer' tells what to do
-;; with collected sequences.
+;; buffers.  The variable `osc-for-compilation-buffer' tells what to
+;; do with collected sequences.
 
 ;;; Code:
 
-- 
Matthias




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#57821; Package emacs. (Mon, 19 Sep 2022 18:48:01 GMT) Full text and rfc822 format available.

Message #67 received at 57821 <at> debbugs.gnu.org (full text, mbox):

From: Lars Ingebrigtsen <larsi <at> gnus.org>
To: Matthias Meulien <orontee <at> gmail.com>
Cc: "Basil L. Contovounesios" <contovob <at> tcd.ie>, 57821 <at> debbugs.gnu.org
Subject: Re: bug#57821: 29.0.50; ANSI sequence not filtered in compilation
 buffer
Date: Mon, 19 Sep 2022 20:47:12 +0200
Matthias Meulien <orontee <at> gmail.com> writes:

> Here are the fixes left after Eli's work.  To my knowledge the only
> known problem still to address is the renaming of the button type
> comint-osc-hyperlink to osc-hyperlink; I've not found time to study
> Basil advice.

Thanks; pushed to Emacs 29.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Tue, 18 Oct 2022 11:24:06 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 183 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.