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: Re: When is a syntax-propertize-function called when parse-sexp-lookup-properties is t for a current buffer? Date: Tue, 5 Oct 2021 16:17:07 -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="2694"; mail-complaints-to="usenet@ciao.gmane.io" Cc: help-gnu-emacs To: Stefan Monnier Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue Oct 05 22:18:18 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 1mXqtE-0000TA-BX for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 05 Oct 2021 22:18:16 +0200 Original-Received: from localhost ([::1]:39842 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXqtC-0002aD-Ur for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 05 Oct 2021 16:18:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXqsM-0002a4-0F for help-gnu-emacs@gnu.org; Tue, 05 Oct 2021 16:17:22 -0400 Original-Received: from mail-ed1-x52e.google.com ([2a00:1450:4864:20::52e]:44766) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mXqsK-0005qc-76 for help-gnu-emacs@gnu.org; Tue, 05 Oct 2021 16:17:21 -0400 Original-Received: by mail-ed1-x52e.google.com with SMTP id v18so1139213edc.11 for ; Tue, 05 Oct 2021 13:17:19 -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 :cc; bh=nIWoo26dDaLtenMNMGaZQPutR009TX+9+NezqDcsyB8=; b=BGgKYS9Ds1sx39iH7PotE6q+Jj4/FnHlJlo8u5tIQE7jw4zGv/vN0cJycJx6nCRM1P Wj8rDGnzRiP79ZXHUIcTjJnXb8jzqrJ3hCyMMecnYVLt1d6cMU40eRPUx4kPbBapqNJO 8uk/UIas71LJDPuRpB7Z38lI99zGryVk+EKKtOqP7U5DaR3FT1WC8OjCD84vi6/QOmNs O3GwaCUv/lPWtA/ApmWPQZN+FuZT3sK15Zbr2vyycGCvV9AYtsDvE1VFDASir3njJSWj q0+Xh0vyDnzx45vgiJQmocrTf5mJxJE8NIC90cT6Vb6dvlD2U3akYkD0QpJx78SeSJ42 Y50Q== 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:cc; bh=nIWoo26dDaLtenMNMGaZQPutR009TX+9+NezqDcsyB8=; b=z9zlBh2KuL8OYCwBL2MgKwZe46rmsf2nJnLNitQg0YJx4d6BnIDG1Kj2rBpUFqvDJY onhQrhZsF3niP7Ox016Ov9kejus9FlCeKatK8tWPISkD51X3SOZK/gwLngRtkxURBY/J XkXL0OeLn7cQWYIUXs9m//KpEGsk0maK/cP+eYUVI+zDeLY/ueXqNsoSHsCC8PYRaIrI 6WliLhZ5AaqakMIDm3kEiC2oL0Sg1ye8KF8hSDEGbUOZ1eb1wdHlXIqZtbNpdRgNiK/6 xpPEo/J0tT08LvPAe0x3Jhk4+xA46sVl5vW+7v1O3XITlUgJEAauSYC6RAezdx/agk+C ZwBQ== X-Gm-Message-State: AOAM531B+nc16YXIsXTwZChSK9KxumMEjCH2esdr+LCVqjQuLVl8+jdr nNrQDmbOMcJJAedI4p5Ryh8YgxotdmW5YweBiVY= X-Google-Smtp-Source: ABdhPJy5eLsiZsqV8iEThQNI7+wqVbOA7pxuBwF+HCpHxbTHSYjhzr3YEbbIge/aocsMX9+YX9tGNdlSdyDIuafi3w8= X-Received: by 2002:a05:6402:42cd:: with SMTP id i13mr9221192edc.396.1633465038539; Tue, 05 Oct 2021 13:17:18 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::52e; envelope-from=prouleau001@gmail.com; helo=mail-ed1-x52e.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:133589 Archived-At: 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... (Sorry for double posting, I did not send to the list the first time around) -- /Pierre