From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Guillaume Brunerie Newsgroups: gmane.emacs.bugs Subject: bug#74415: 29.4; mouse-start-end does not respect syntax-table text properties Date: Mon, 18 Nov 2024 11:12:49 +0100 Message-ID: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4204"; mail-complaints-to="usenet@ciao.gmane.io" To: 74415@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Mon Nov 18 11:25:40 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 1tCywt-0000w6-IN for geb-bug-gnu-emacs@m.gmane-mx.org; Mon, 18 Nov 2024 11:25:39 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tCywL-000108-GI; Mon, 18 Nov 2024 05:25:05 -0500 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 1tCywJ-0000zf-P4 for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2024 05:25:03 -0500 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 1tCywJ-0000tB-GQ for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2024 05:25:03 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=Date:From:MIME-Version:To:Subject; bh=nXkGaefjmJ1WIs7oEnnHXQ4Dkl6bPSzyGvZrjKT9qfI=; b=jeIogcLunQgNemQRHdhjyOm6V6HelZbYUMSUnTLE6s5OyryE/3KbeA/aS7oy7Z8VQ7G6+I0K6p1J+vLhn+6T70edojqkjkevPrcd2cFYdA5oBlj4a0b2bNkKpeSLdMbNSwVsOYyhI9ZA/VLdWYkTxAlaVWi+r7qP11YOKODptHpxhlPAay6CllHlb07OR7bmoOrjXO3wMWTEYy1aRl0jHPEzrO+isp3UV6e1HI/DKR9gUYXO3Wh/odEuf09EWM0sWNHoDucWyf1dfmhYTD2DGItBmyNuLW7MEFAvmO3vrJbuZnS2S1rXIF3TxBGVGvQkJzuFCFdLw/F8wE1Lr/N6iw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tCywI-0001rX-CK for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2024 05:25:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Guillaume Brunerie Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Mon, 18 Nov 2024 10:25:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74415 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.17319254797114 (code B ref -1); Mon, 18 Nov 2024 10:25:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 18 Nov 2024 10:24:39 +0000 Original-Received: from localhost ([127.0.0.1]:60085 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCyvu-0001qY-Qx for submit@debbugs.gnu.org; Mon, 18 Nov 2024 05:24:39 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:48166) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tCyki-0001KG-F6 for submit@debbugs.gnu.org; Mon, 18 Nov 2024 05:13:05 -0500 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 1tCyki-00055a-9O for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2024 05:13:04 -0500 Original-Received: from mail-qt1-x831.google.com ([2607:f8b0:4864:20::831]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tCykg-00080m-KI for bug-gnu-emacs@gnu.org; Mon, 18 Nov 2024 05:13:04 -0500 Original-Received: by mail-qt1-x831.google.com with SMTP id d75a77b69052e-460b2e4c50fso28154211cf.0 for ; Mon, 18 Nov 2024 02:13:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1731924781; x=1732529581; darn=gnu.org; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=nXkGaefjmJ1WIs7oEnnHXQ4Dkl6bPSzyGvZrjKT9qfI=; b=lM4h+2rxCDnFMchl53/8uQdTFQvvGo+lOWFsjObFJ9flgpjwYJ3yJKlFpyBp7hta/C OGaOWz912+b5tywh5NDgIEQVbhqjTQgwrxP3ksTqBbiVtGH8cVlypwd2Dpb9kNG6PUY5 82/a9xrIt9qdIP30Jbnm+ohjahfEk8KGMIMrrpGXOSbj7XVfEwsDUpLufSuhksjRlGh1 dEXbEFZs31qtCiWg9VLa0wPw0YEdUaxIQCVh+9xG0NkV585xLwIYZAkdJfjoAm/Np7Yx 99VZuzAB4iRxQRTLqLsPMczKzd4WAIPTSsS4tfE8P6rcFJMbXr6i68Lz7warzLu/Fl+p fIrg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1731924781; x=1732529581; h=content-transfer-encoding:to:subject:message-id:date:from :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=nXkGaefjmJ1WIs7oEnnHXQ4Dkl6bPSzyGvZrjKT9qfI=; b=NQQIXoDHhXwsi4G3MZHpgRI2TAlL4OmdcMZEvcIonICncG2eCL7cchBfzema2QeT7x 8K04J96fbpRuDfnQDQOvLdJy7MtmWE8efJBLtOHSI4axYjp86FFsFiUVP7c4pCPdl2LU eJ2Otl60wbSaJ+t9X3XhftSWatWM/GF17DyOBNIfmTcui97lrkYRuhV8IVmnuvaRpJmz 6zSsWdAcSunN7uOl1e5FJWWN7e5F/VEYecyFZv1PkhuIHMV0hQs9ZCmnozSL0/ONbvuR P7ASjKDw01z4IVyghIRHit5HRsBW8m2+EfBPiuApizwAlVCsKQl51uMLBgZay09bV/Xl gBXA== X-Gm-Message-State: AOJu0Ywutvsm7v9WZlMZnjs2TTwL5ocR73fw5ZcYlT5GtlhyMdIbYOno V7x8oF2itiU5BlbV833DSM0o50YMUDaFrREP4+67s+l/BJqVZ4xkVj0Uh6/NzRaIJFM0GVozZW1 9iGc3I90D8vryWPADe4XvTmO6Uy1guQo= X-Google-Smtp-Source: AGHT+IHTDnNhJJ7eBart7L8al7rEChg3Lpp4e522nGez5g7jF/EzViJm9KXW6GyxPX6hmHe263ZhYzopkA7ZDa6X3do= X-Received: by 2002:a05:622a:8e:b0:461:3653:54f with SMTP id d75a77b69052e-46363df2604mr178482971cf.11.1731924780705; Mon, 18 Nov 2024 02:13:00 -0800 (PST) Received-SPF: pass client-ip=2607:f8b0:4864:20::831; envelope-from=guillaume.brunerie@gmail.com; helo=mail-qt1-x831.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-Mailman-Approved-At: Mon, 18 Nov 2024 05:24:32 -0500 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:295587 Archived-At: Hello, The `mouse-start-end` function (used in particular when double clicking on = an opening parenthesis to select the region from that opening parenthesis to t= he matching closing parenthesis) does not respect syntax-table text properties= to determine if the character at point is an opening parenthesis. Looking at t= he code, it is at line 1941 in lisp/mouse.el (and there are more instances fur= ther down in the same file) (https://github.com/emacs-mirror/emacs/blob/eee0ed8442aa78320a3e578ab290df1= 45fb49624/lisp/mouse.el#L1941): ((and (=3D mode 1) (=3D start end) (char-after start) (=3D (char-syntax (char-after start)) ?\()) Note that the documentation of `char-syntax` says: > If you=E2=80=99re trying to determine the syntax of characters in the buf= fer, this is > probably the wrong function to use, because it can=E2=80=99t take =E2=80= =98syntax-table=E2=80=99 text > properties into account. Consider using =E2=80=98syntax-after=E2=80=99 in= stead. The line just below does use `syntax-after`, but it looks like something th= at was added later to work around a related bug. I think this function should = be refactored to only use `syntax-after` instead of `char-syntax`. For context, I'm writing my own Typescript major mode where the < and > sym= bols are sometimes balanced delimiters, sometimes not (determined via Tree-sitte= r). I could get most things working using syntax-table text properties, like forward-sexp and show-paren-mode, but not double-click selection due to thi= s issue. Related: https://lists.gnu.org/archive/html/bug-gnu-emacs/2016-02/msg00988.= html In that issue, the opposite problem occurred, double clicking on an unmatch= ed open parenthesis did not take into account the "punctuation" text property.= But the fix only fixed one half of the issue (when a text property makes a parenthesis into not a parenthesis) and I am facing the other half (a text property makes a punctuation character into a parenthesis). Best, Guillaume