From unknown Sun Jun 22 00:57:58 2025 X-Loop: help-debbugs@gnu.org Subject: bug#57866: [PATCH] Extend comint-osc-handlers to support OSC 2 Resent-From: Matthias Meulien Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 16 Sep 2022 18:00:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57866 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: 57866@debbugs.gnu.org X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.166335118124510 (code B ref -1); Fri, 16 Sep 2022 18:00:02 +0000 Received: (at submit) by debbugs.gnu.org; 16 Sep 2022 17:59:41 +0000 Received: from localhost ([127.0.0.1]:44277 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oZFcr-0006NG-5q for submit@debbugs.gnu.org; Fri, 16 Sep 2022 13:59:41 -0400 Received: from lists.gnu.org ([209.51.188.17]:55812) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oZFco-0006N7-NZ for submit@debbugs.gnu.org; Fri, 16 Sep 2022 13:59:40 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60458) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oZFco-0001up-I1 for bug-gnu-emacs@gnu.org; Fri, 16 Sep 2022 13:59:38 -0400 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:46593) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oZFcm-0008VQ-K9 for bug-gnu-emacs@gnu.org; Fri, 16 Sep 2022 13:59:38 -0400 Received: by mail-wm1-x32c.google.com with SMTP id n40-20020a05600c3ba800b003b49aefc35fso244428wms.5 for ; Fri, 16 Sep 2022 10:59:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:user-agent:message-id:date:subject:to:from:from:to:cc :subject:date; bh=qh8/uqR6qisDJzW32p3qy2IhMe1gxsYhCZWkc61jFSA=; b=K9zdsnK4tGNkqLu3H+OQ21CmSjqWIQkAg3zYhCsaAHXKrYlTVTeGUxcW4CtIE1EIeR Su14ALSTTyXl2u+MPOOUBpBBQiCnz2SwM3yI6USJ+kxObC2vHBNsxMXdaPEw6qLfD4Sb xbLLfvL4kEBoiS+uxa9xjPnE1UlMJVsqV1QrI/q0iXXXtzD6CVnABX1XR6foemlhQK3I LoZ0Vw4ZcU0/GPRXKyUNxqGdu7w8FeiKwrJgn7x2Q42QNIOmvAB4ikN6Co7xn5vYomY7 eKggi4KsJAZz38yTI8YINmb8j6W2Watus70Dmtce07v7GPYtl2K3w/JDogkLbZOI/GBL t3mg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:user-agent:message-id:date:subject:to:from :x-gm-message-state:from:to:cc:subject:date; bh=qh8/uqR6qisDJzW32p3qy2IhMe1gxsYhCZWkc61jFSA=; b=owGcAybr4EtWXt1OnAFyv/E8V7BbYSviIls4tFV6PSBS1KOzBD+aIhPv1nsJoDz++n Obc/i2P6nJ79ZnKYXjdIQqvJ7Zf9uvrAKtYK/yrJrNulsm1X7oTEV62j+QBBtoeAd/x9 TwHow+FBtZv6fQcHLDQmA6644Fgu6UlcukP65SQDgRQXmaTRHAezNPqgL7l5Wkr6Mxdo KZmvLQ+Cpnh4w6IOXGzr7L0JZosE8s65dTcFu+sz74Bf1Er11uXtJ88nim+hHZu1EWpk auG28hEiebE7oSHh+lRNv1KNHYf0HZKKCOLnNNClESYNGeGHleDjGT5baxQLME26CXw9 PmPA== X-Gm-Message-State: ACgBeo190lUsYg4dTHEv59oNEppm/fVzfcxuHrB1IY08138oxLib7tIV l7bMIWhOy4kkgfojc8ytdQp0pvOOUCQ= X-Google-Smtp-Source: AA6agR7nsIhhBhHHEt0jvFcZNRLMLGWGU0IuWIn7RjsWwpJVPK9liR9jOFTPoYIO8T5JSiJ+Ke6PNQ== X-Received: by 2002:a7b:cc85:0:b0:3b4:9fc7:cd4d with SMTP id p5-20020a7bcc85000000b003b49fc7cd4dmr10127573wma.68.1663351168133; Fri, 16 Sep 2022 10:59:28 -0700 (PDT) Received: from carbon.localdomain ([2a01:e0a:245:c850:98f5:429a:aa8e:95bb]) by smtp.gmail.com with ESMTPSA id d5-20020adffbc5000000b00228d6bc8450sm6218628wrs.108.2022.09.16.10.59.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 10:59:27 -0700 (PDT) From: Matthias Meulien Date: Fri, 16 Sep 2022 19:59:26 +0200 Message-ID: <877d2319q9.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::32c; envelope-from=orontee@gmail.com; helo=mail-wm1-x32c.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --=-=-= Content-Type: text/plain Tags: patch The attached patch adds support for OSC 2 escape sequences in comint buffers. To test one can update `frame-title-format' with something like: (setq frame-title-format '("%b" (:eval (when (and comint-osc-window-title (not (string-empty-p comint-osc-window-title))) (concat " - " comint-osc-window-title))) (:eval (if multiple-frames "" (concat " - GNU Emacs at " system-name))))) After M-x shell call a command (like flatpak-builder) that emits OSC 2 commands, the frame title is updated while the command runs. Note that one is expected to extend Bash prompt command to print an OSC 2 command to clear the title: set -x osc_clear() { printf "\e]2;\e\\" } PROMPT_COMMAND=${PROMPT_COMMAND:+$PROMPT_COMMAND; }osc_clear set +x Regards, 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' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Extend-comint-osc-handlers-to-support-OSC-2.patch >From 9ae3c83873169765721395966205f8cd10dcc333 Mon Sep 17 00:00:00 2001 From: Matthias Meulien Date: Thu, 15 Sep 2022 14:30:07 +0200 Subject: [PATCH] Extend comint-osc-handlers to support OSC 2 * lisp/comint.el (comint-osc-handlers): Add new comint-osc-window-title-handler. (comint-osc-window-title): Local variable to store window title. (comint-osc-window-title-handler): Set comint-osc-window-title according to OSC 2 command. --- lisp/comint.el | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/lisp/comint.el b/lisp/comint.el index 696dac3d12..9445482f1b 100644 --- a/lisp/comint.el +++ b/lisp/comint.el @@ -3914,7 +3914,8 @@ comint-redirect-results-list-from-process ;; to `comint-osc-handlers' allows a customized treatment of further ;; sequences. -(defvar-local comint-osc-handlers '(("7" . comint-osc-directory-tracker) +(defvar-local comint-osc-handlers '(("2" . comint-osc-window-title-handler) + ("7" . comint-osc-directory-tracker) ("8" . comint-osc-hyperlink-handler)) "Alist of handlers for OSC escape sequences. See `comint-osc-process-output' for details.") @@ -3955,6 +3956,18 @@ comint-osc-process-output (put-text-property pos0 bound 'invisible t) (setq comint-osc--marker (copy-marker pos0)))))))) +;; Window title handling (OSC 2) + +(defvar-local comint-osc-window-title nil) +(defun comint-osc-window-title-handler (_ text) + "Set value of `comint-osc-window-title' from an OSC 2 escape sequence. +The variable `comint-osc-window-title' can be reffered to in +`frame-title-format' to dynamically set the frame title. + +This function is intended to be included as an entry of +`comint-osc-handlers'." + (setq comint-osc-window-title text)) + ;; Current directory tracking (OSC 7) (declare-function url-host "url/url-parse.el") -- 2.30.2 --=-=-=-- From unknown Sun Jun 22 00:57:58 2025 X-Loop: help-debbugs@gnu.org Subject: bug#57866: [PATCH] Extend comint-osc-handlers to support OSC 2 Resent-From: Lars Ingebrigtsen Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Sep 2022 11:13:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 57866 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch To: Matthias Meulien Cc: 57866@debbugs.gnu.org Received: via spool by 57866-submit@debbugs.gnu.org id=B57866.16634995285785 (code B ref 57866); Sun, 18 Sep 2022 11:13:01 +0000 Received: (at 57866) by debbugs.gnu.org; 18 Sep 2022 11:12:08 +0000 Received: from localhost ([127.0.0.1]:48026 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oZsDY-0001VF-0J for submit@debbugs.gnu.org; Sun, 18 Sep 2022 07:12:08 -0400 Received: from quimby.gnus.org ([95.216.78.240]:38156) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oZsDV-0001UN-Pn for 57866@debbugs.gnu.org; Sun, 18 Sep 2022 07:12:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Content-Type:MIME-Version:Message-ID:Date:References: In-Reply-To:Subject:Cc:To:From:Sender:Reply-To:Content-Transfer-Encoding: Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=w8DE5PPSfGB8GETnOId1riClRPAID6o6OE9WPMVbqzo=; b=F9Z1zkk4YrGRuJhByeU2ZZZ4/a uyW4cd+Qx0zXDIfhrn+XrTX3x35L27CrAN3JrPeMiOE9JSXfDXlkxpVI3GeXsHjQ2Oud+8wm6b8hE kTZ/Pvkz8L+Qg5oS/zBMEPLZjrprbyJvFm3Ot/Je7lgL1dKFIGM2vQXOloVxHUC+YFVI=; Received: from [84.212.220.105] (helo=joga) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oZsDN-00076s-S6; Sun, 18 Sep 2022 13:11:59 +0200 From: Lars Ingebrigtsen In-Reply-To: <877d2319q9.fsf@gmail.com> (Matthias Meulien's message of "Fri, 16 Sep 2022 19:59:26 +0200") References: <877d2319q9.fsf@gmail.com> X-Now-Playing: Skeletal Family's _Make More Noise (4)_: "Burning Oil" Date: Sun, 18 Sep 2022 13:11:57 +0200 Message-ID: <87leqh2ayq.fsf@gnus.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: Matthias Meulien writes: > The attached patch adds support for OSC 2 escape sequences in comint buffers. This patch was obsoleted by the one in bug#57821, so I'm closing this bug report. Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Matthias Meulien writes: > The attached patch adds support for OSC 2 escape sequences in comint buffers. This patch was obsoleted by the one in bug#57821, so I'm closing this bug report. From debbugs-submit-bounces@debbugs.gnu.org Sun Sep 18 07:12:12 2022 Received: (at control) by debbugs.gnu.org; 18 Sep 2022 11:12:12 +0000 Received: from localhost ([127.0.0.1]:48029 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oZsDc-0001VV-8O for submit@debbugs.gnu.org; Sun, 18 Sep 2022 07:12:12 -0400 Received: from quimby.gnus.org ([95.216.78.240]:38172) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oZsDa-0001V4-7W for control@debbugs.gnu.org; Sun, 18 Sep 2022 07:12:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnus.org; s=20200322; h=Subject:From:To:Message-Id:Date:Sender:Reply-To:Cc: MIME-Version:Content-Type:Content-Transfer-Encoding:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:In-Reply-To:References:List-Id:List-Help:List-Unsubscribe: List-Subscribe:List-Post:List-Owner:List-Archive; bh=h3tN+8/HYync7hT8niKO+oeaGTZKHt1ZOh1RDYhBA4o=; b=d0GESrKGLvtlPc5+jd/Pb8LAlb tf9uLO3f5W7m1dkU92keJln2c/VYmx38qm4aAwHazYC3fKblnoG+/j3f7sOuI4AsK72uGjF1HHvAy ev/hjCpIj4ul+7wjZgTLXFQlX3ReI01ZC8BwQl4YEDXDlf35RYFoVCz9W9dkeCQT3KkE=; Received: from [84.212.220.105] (helo=joga) by quimby.gnus.org with esmtpsa (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oZsDS-000772-NY for control@debbugs.gnu.org; Sun, 18 Sep 2022 13:12:04 +0200 Date: Sun, 18 Sep 2022 13:12:02 +0200 Message-Id: <87k0612ayl.fsf@gnus.org> To: control@debbugs.gnu.org From: Lars Ingebrigtsen Subject: control message for bug #57866 X-Spam-Report: Spam detection software, running on the system "quimby.gnus.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see @@CONTACT_ADDRESS@@ for details. Content preview: close 57866 quit Content analysis details: (-2.9 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -1.0 ALL_TRUSTED Passed through trusted hosts only via SMTP -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) close 57866 quit