From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eshel Yaron via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#74091: 31.0.50; string-pixel-width in mode line disables region Date: Wed, 30 Oct 2024 16:26:38 +0100 Message-ID: References: <86y1254owq.fsf@gnu.org> Reply-To: Eshel Yaron Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37763"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 74091@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 30 16:27:28 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1t6AbX-0009bn-Og for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 30 Oct 2024 16:27:27 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1t6AbC-0006QB-MM; Wed, 30 Oct 2024 11:27:06 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1t6Ab9-0006Py-Lf for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2024 11:27:04 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1t6Ab8-0002QQ-6k for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2024 11:27:02 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:References:In-Reply-To:From:To:Subject; bh=Y55IEB8kogz4eYLIbqXCm6a7uRh8bu2+asfNVE/z5Pk=; b=fB9NuexvbZafgJ/XN9NyuwoJ35TUkh54F+8trx2a4DXnMPAhMAabPvBOdzLgc3X+3ZG7aQ7+5twOHf44ckxiTLwga/zPq/xZIUwByjyzhTNth+QoABabROz4Ci61QXPuai7yOmDL3gEqar/wLcos9tMLL9ST49s/6n/cFAurN3+ZffafX7C51XCNoXcZYJI6CrWTh4o4yXEC/PoSMKSULu7wgkqQdhWRMUqw15q3mB8+8fDVE/7dfRkwju837v8x6RrBEAbgWUVm5HnqC3gFq6tukZzyTt7PLJDVRSU4iNhD+eKReoVv1IvqHmnjs1iTLpcnn14bS66ox8r2NZNjUA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1t6Ab7-0005tg-Nt for bug-gnu-emacs@gnu.org; Wed, 30 Oct 2024 11:27:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eshel Yaron Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 30 Oct 2024 15:27:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74091 X-GNU-PR-Package: emacs Original-Received: via spool by 74091-submit@debbugs.gnu.org id=B74091.173030200422655 (code B ref 74091); Wed, 30 Oct 2024 15:27:01 +0000 Original-Received: (at 74091) by debbugs.gnu.org; 30 Oct 2024 15:26:44 +0000 Original-Received: from localhost ([127.0.0.1]:35659 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6Aaq-0005tL-4e for submit@debbugs.gnu.org; Wed, 30 Oct 2024 11:26:44 -0400 Original-Received: from mail.eshelyaron.com ([107.175.124.16]:53128 helo=eshelyaron.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1t6Aan-0005tE-Hv for 74091@debbugs.gnu.org; Wed, 30 Oct 2024 11:26:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=eshelyaron.com; s=mail; t=1730302001; bh=QM63yKUKR6FVmkA6IQ/KTCG7itf8/cqWHLtcq6XAAeM=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=G1GLvisLLo93w7fNGm0P1dFociCAL9DKFuWT4f1GEH25aIR72g4oAq2wgVWKJJJ8u 1r0NpXTMsHqEbYzwSGNVbbirIDC4agF/S+r+jGY6r7Y4CRU4EBlJFMhY+5wpOzJQRM gn+sbCpW/GvxsoJIvsu3ipENzYTD+T9OGRCY2cZy9vRl0c7rR6dv76f4j0u1v9lopo OxeFd7g+aU+HKQ96fUmt84nYj+Agb7JRPmL+UU73wKOcNNCflyvkFdwUbpEtpZbk2m fpUnnf3sNiyVuQyAsfcNMrD1K0eCKncgpcS60TK+aFUjapdrT+YW9ZjseWyfMJQKKS 0+FbEVKD4We5g== In-Reply-To: <86y1254owq.fsf@gnu.org> (Eli Zaretskii's message of "Wed, 30 Oct 2024 16:59:49 +0200") X-Hashcash: 1:20:241030:eliz@gnu.org::3mo8tRZk75AhQVgb:1XKP X-Hashcash: 1:20:241030:74091@debbugs.gnu.org::O1FrrTNAxUk+ReEq:0vcC X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:294564 Archived-At: Hi Eli, Eli Zaretskii writes: >> Date: Tue, 29 Oct 2024 18:27:05 +0100 >> From: Eshel Yaron via "Bug reports for GNU Emacs, >> the Swiss army knife of text editors" >> >> >> >> The new implementation of string-pixel-width has some unexpected effect >> when it is called from mode-line-format, as happens for example when >> mode-line-format-right-align occurs in mode-line-format: >> >> 1. emacs -Q >> 2. (setq-default mode-line-format >> '("" (:eval (progn (string-pixel-width "foo") nil)))) >> 3. C-x C-f /path/to/emacs/lisp/subr.el >> 4. C-SPC >> 5. C-n >> >> At this point the region is expected to be active since we activated it >> in step 4. But in step 5 the mode line is updated, which calls >> string-pixel-width, which in turn unexpectedly disables the region. > > Thanks, should be fixed now. Great! That seems to work. >> I'm not really sure why this happens... > > It happens because string-pixel-width modifies a buffer, and that sets > deactivate-mark, which then causes the region to be deactivated when > a command finishes. Hmm but string-pixel-width used to modify a buffer also in the old implementation, and that never caused this issue... And in both the old implementation and in the new one, the modification is in a different buffer, is that expected to disable the mark in the original buffer? > When you inject string-pixel-width into mode-line-format, you > indirectly cause it to be called from C-n and the like, because those > evaluate the mode-line format. So doing that is quite a risky thing, > in general. Well, that's how Emacs implements mode-line-format-right-align :) Thanks for the quick response, Eshel