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 09:48:22 -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="7474"; 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 15:56:33 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 1mXkvl-0001e4-W6 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 05 Oct 2021 15:56:29 +0200 Original-Received: from localhost ([::1]:46808 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mXkvj-0005hb-UW for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 05 Oct 2021 09:56:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:41906) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mXkpc-0007bG-Vd for help-gnu-emacs@gnu.org; Tue, 05 Oct 2021 09:50:09 -0400 Original-Received: from mail-ed1-x532.google.com ([2a00:1450:4864:20::532]:33703) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1mXkpa-0002aY-Hy for help-gnu-emacs@gnu.org; Tue, 05 Oct 2021 09:50:08 -0400 Original-Received: by mail-ed1-x532.google.com with SMTP id p13so50926062edw.0 for ; Tue, 05 Oct 2021 06:50:06 -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=iQqGo/nCzJlQTcVxHKsXdhsCfAeJW5blxArnL8ezEFY=; b=YmmlvyplFEeFI1/3LoMOEJ+1NEOOaJKOY9rBzRbE4VyVuGzk8LjVqX05RBHuBVA/S8 B+VxtU+hPUqOAT8b0bf/ahxrPfhfRmZ7ZuEEhkA05jwPRpLEJcfaTVLcbh+sE/RAD+N8 pw++R+xQe2jP6m7DWDpeGpNhu5aXkGUSnQmep4yLfaMDKBbgR0LVn3Ll1lbIsa6/Gb1W otbOHIVfZvoPqnDJstHHRJDfCOVc/cuaoyLu7WHdXikokSwhsQErMqT+Qf+7mhrNdkWV 5tafmTM7F4daobP2lIp8Sja4lQI14Udpd3nEikiTvZQdZigqYbY1324KHlf6N0L6ONXL uyjw== 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=iQqGo/nCzJlQTcVxHKsXdhsCfAeJW5blxArnL8ezEFY=; b=M/+l6lmPUrz4U5DT7/Di/mWnbS0SYJngo1Gw6x8zJAzykrnxJS9ZG66IM0iURJQ+kT pqvCJfUuSEE6rOdvbJ2sW/cRQU+otIDkCBN+kfgmX3WA/cP49K6xsq6owWTbdZqbHMdJ qL6LONy+zYbHMkfm85X7HDLSY6WOi0q0G0PrzOGtVSyOjgb3rCuFmctqi1Jak+mdIKnN n2hGS+UvCgO3pJv1Lwbc/xUvjk7YFpZmKIYy92/TRMcba5gWLS6wInU9rdw/llOyCnAY Zxiw1Em2zFNaxfRcDAcOHk9mVrkUGNovs8TroQ8PmN5SnWw8TmwkBVHIwaMRhDRetxd7 Fnag== X-Gm-Message-State: AOAM532SdnGTkLCnw7fczQuOnJmUyPVdBfXxoRHL4q0qjLe4+ike5cYH vYEQruLCuQGJhSlauMgZvii3Z7WcC87rLcPNiVbPj7KpZCI= X-Google-Smtp-Source: ABdhPJz15a4TzOSN/+/CcMlTI5S/oRPwMygv7UE3uikBaE7+TJDnMgzC91eoyg/BDgdJH9pJHwKva5amINj1K694uTo= X-Received: by 2002:a05:6402:19ad:: with SMTP id o13mr26912378edz.109.1633441713249; Tue, 05 Oct 2021 06:48:33 -0700 (PDT) In-Reply-To: Received-SPF: pass client-ip=2a00:1450:4864:20::532; envelope-from=prouleau001@gmail.com; helo=mail-ed1-x532.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:133576 Archived-At: On Tue, Oct 5, 2021 at 8:56 AM Stefan Monnier via Users list for the GNU Emacs text editor wrote: > > What I'd like to understand is what calls the generated function, > providing > > it the 2 arguments (start & end) and when should it be called. > > > Are these calls protected against error so I can't see them if they > occur? > > No, although some of them can occur in contexts where the error might be > silenced or at least not displayed in a prominent way. > > Why do you ask? > Are you having an actual problem, or are you asking out of curiosity? > > Both actually. I am trying to add binary pair matching in erlang-mode, something that works only just after the << >> pair has just been typed by the user, but later, the matching stops working as the syntax-table attribute seems to disappear from the character. I'm trying to make the syntax properties to 'stick' so I can use forward-sexp, backward-sexp to navigate over Erlang code code that uses these. Like the following Erlang code: Values = << <<(X+1)/integer>> || <> <= <<3,7,5,4,7>> >>. I tried to add the following after the syntax table is built by the erlang mode function: (defconst erlang-mode-syntax-propertize-function (syntax-propertize-rules ("\\(<\\)<" (1 "(>")) (">\\(>\\)" (2 ")<"))) "Syntax properties to activate << >> pairing.") (setq-local parse-sexp-lookup-properties t) (setq-local syntax-propertize-function erlang-mode-syntax-propertize-function) But that does not seem to work. So I am trying to understand why it does not work. I saw the caution note at the end of the syntax-propertize-function in section 34.5 Syntax Properties that states: "Caution: When this variable is non-nil, Emacs removes syntax-table text properties arbitrarily and relies on syntax-propertize-function to reapply them. Thus if this facility is used at all, the function must apply all syntax-table text properties used by the major mode." Since the erlang-mode modifies the text attribute of the << >> characters when the user types them I was trying to see what I'm either not doing or doing wrong. So I wanted to see where the code was used because it seems that my addition is just ignored or something in erlang.el prevents it from working and/or my 'nirvana level' understanding of that mechanism is obviously not high enough :-) -- /Pierre