From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pierre Rouleau Newsgroups: gmane.emacs.help Subject: Fwd: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer? Date: Tue, 5 Oct 2021 16:05:03 -0400 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25285"; mail-complaints-to="usenet@ciao.gmane.io" To: help-gnu-emacs , Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 05 22:06:19 2021 Return-path: Envelope-to: geh-help-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 1mXqhe-0006LO-Um for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 05 Oct 2021 22:06:18 +0200 Original-Received: from localhost ([::1]:57936 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXqhd-0003RT-GB for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 05 Oct 2021 16:06:17 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52076) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXqgf-0003RK-KP for help-gnu-emacs@gnu.org; Tue, 05 Oct 2021 16:05:17 -0400 Original-Received: from mail-ed1-x535.google.com ([2a00:1450:4864:20::535]:38518) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mXqge-0008MU-2h for help-gnu-emacs@gnu.org; Tue, 05 Oct 2021 16:05:17 -0400 Original-Received: by mail-ed1-x535.google.com with SMTP id dj4so1145115edb.5 for ; Tue, 05 Oct 2021 13:05:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=65kc4H0KO1yLr/jmxtKE/3mE0B8edsGWzAHbPACZ19I=; b=BjwrKc3/Q1v3FpHSVEW0Nb+A7dpYqaSGvv8QFU4EVTqsmph/Zzd+ffigN7HHCt1PdJ R1496Rh6tIE/KWjjlXGzpTklAZgY4bdRnr+em5x3YPh/DAU6sCb8/88iUjdqGA4xSbe8 SHeccUsqVz9iq9RYp9r1SUNZeH4MYZrFPz1i6vleBEMzPD+nI5vP8EkPDN7d1rnZxiwL 9AWixkAGDKf4/GD/cwyM0YQDgUdtP0CoFDxqriZSlX4LkhTClKaepJbf2WF9kZGdot6z k88E/qy8PkzKSYJ8ywvc0eoaHFScMuiO/aQtEY7lCyYar/JiPGcRcwpbHWyYZSa7an73 86Qg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=65kc4H0KO1yLr/jmxtKE/3mE0B8edsGWzAHbPACZ19I=; b=BEc500+5A5hRacmOgxfRs2jr54ZSqhnK3c0tMJtY0s78jcN+hn5f5xbf3pRlkBlEeI nPbEhwaLpvA8s6O5N1QVPYLK6OhysVKgnr9aJ6qJLptJWdYQLKUf/MCvwUfeXV2x8ncw ZbxlbKYJuRuZNwsGMv7l60m5IK55rWaL5WWHfX4/Rx0ZBCSC4s3Y9sx7kCxjUgBjVcXa fnCFWpPUACQ3GzETmnooxvd6SYI3yS2UBlTbQXi6bX0YnyyxauiI/9wh7ctbBXiodZmI Ol0eBkLvp8wQgkKtrneYJXRTvPhH/PllRnr2wl68HhiF5roJoTdwNl3/6ZT779pUoSaV JfuQ== X-Gm-Message-State: AOAM532sC8N3vsDjXmZtu0US3MTM35rbCp1Q5JTM0h1eDfeSzsWq1Xed nr3ddgtj4Wn+wDFPb9E7Le8QhqpQACB4JXAM6m4pVav/ X-Google-Smtp-Source: ABdhPJy0XAW2b+csxcp9tw7xPSRXzKAd1WjkozztYpkyqGTC5whIJ3tUDEnN7EMaXWsnJJfBXEJVAQsr1x3jvN5dyVk= X-Received: by 2002:a50:be8a:: with SMTP id b10mr3538209edk.235.1633464314232; Tue, 05 Oct 2021 13:05:14 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::535; envelope-from=prouleau001@gmail.com; helo=mail-ed1-x535.google.com X-Spam_score_int: -17 X-Spam_score: -1.8 X-Spam_bar: - X-Spam_report: (-1.8 / 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_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=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-Content-Filtered-By: Mailman/MimeDel 2.1.23 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:133588 Archived-At: (forgot to copy the list) On Tue, Oct 5, 2021 at 3:42 PM Stefan Monnier wrote: > OK, thanks, that makes sense (I just wanted to make sure the problem > wasn't some silly misunderstanding). > No problem. > > The code you show seems fine to me except for the `2` which should be > a `1` (there is only one subgroup in your second regexp). > > Ahh, a silly typo, when I copied from the wrong place. I have the right '1' in place in erlang.el but it still does not behave as I would have expected. > To debug these things, you can try: > > - `C-u C-x =` on the char(s) where you expect a syntax-table text property, > to check whether it's present or not. > This is had done to check the syntax and wrote something to list all text properties of the character at point because what-cursor-position does not show them all. > - Call `syntax-propertize` by hand in case of doubt. > - Trace your rules function. E.g. use > > (defun my-syntax-propertize (beg end) > (funcall > (syntax-propertize-rules > ("\\(<\\)<" (1 "(>")) > (">\\(>\\)" (1 ")<"))) > beg end)) > > [...] > > (setq-local syntax-propertize-function > #'my-syntax-propertize) > and then `M-x trace-function RET my-syntax-propertize RET`. > > Thanks! That's what I was looking for! I'll read more on that topic. Now I did experimentation with that and got the following trace **when I complete a closing >> only**: 1 -> (my-syntax-propertize 980 1555) 1 <- my-syntax-propertize: nil ====================================================================== 1 -> (my-syntax-propertize 980 1556) 1 <- my-syntax-propertize: nil ====================================================================== 1 -> (my-syntax-propertize 1043 1616) 1 <- my-syntax-propertize: nil ====================================================================== 1 -> (my-syntax-propertize 1043 1617) 1 <- my-syntax-propertize: nil But I still can't use forward-sexp and backward-sexp to navigate from one end of << to its matching >> or vice versa... -- /Pierre