From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.ciao.gmane.io!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.help Subject: Re: Migrating from font-lock-syntactic-keywords to syntax-propertize-function Date: Tue, 12 May 2020 16:44:10 +0300 Message-ID: References: <87sgg51msg.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="ciao.gmane.io:159.69.161.202"; logging-data="44283"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0 To: Tassilo Horn , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Tue May 12 15:44:45 2020 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 1jYVDA-000BJn-35 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 12 May 2020 15:44:44 +0200 Original-Received: from localhost ([::1]:33088 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1jYVD9-0005uv-36 for geh-help-gnu-emacs@m.gmane-mx.org; Tue, 12 May 2020 09:44:43 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:50058) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1jYVCi-0005uc-1M for help-gnu-emacs@gnu.org; Tue, 12 May 2020 09:44:16 -0400 Original-Received: from mail-wm1-x334.google.com ([2a00:1450:4864:20::334]:40380) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1jYVCg-0001bu-V8; Tue, 12 May 2020 09:44:15 -0400 Original-Received: by mail-wm1-x334.google.com with SMTP id u16so23345542wmc.5; Tue, 12 May 2020 06:44:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=aTsBvxNKunHwfQi7rUC0Inbk5kRgvsuGU9ffrmqAzcI=; b=pel2q/lJqevinuhjJ5Dfz+OVdSxuS22BDCdoYYQ93gVAae2jBtWbJxNFAxDc/hruKf /ucfZ/p59rApxhfaAgRFVtMrA9PFm5R2XoDV5x4mSK1E2pNlPv1uzxnz+hhe8cTYkA6J fqYZiPz3tX4jJUnDh6fghCmgInJqELaqhDRQof3eazT1M52xiKiNe5BHLgTtp8D5q5lP x5dkwgTi6k+QwlPpE22UL/owt3SR5nOqWs2qR6OP8LniAUx6vr2mNtNJEAhqj8HmKJYq UBeTE2eCWHsZQ3ACu9g16tVyR8kMPgMSSednDCvYHKwHWvNyAQH2vVixkj56yUxEFqGL nKwg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:message-id :date:user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=aTsBvxNKunHwfQi7rUC0Inbk5kRgvsuGU9ffrmqAzcI=; b=XIXpXMAOgyrmqbdSO/C4R4uzcs7ZKqSd5aLSBqel8IDsu/DShwDHYuWlUiwKuN44l0 vxLO+sm79vIv2PDbuA2zet19ep+AG4FieuDhdzdWXfE3HFRlhWFP/vnsm9w5VlY4KLpf kV0VEbiIgJgT1Y/SniRxKQ74KJTYyxEbqYeueSySKLwgnNJNwNpSF6o7Cpo7wSjj9UCt ae7IFY17yx/o7EplxU6879/Pe5z3g3qYtnQQBuc7lTK7xZLhhqMcv1dNVJ1CrI2TeiPS eoVjDG1L21jp+5JX0U6un8CFAUggWf1DZO2OX29BTFiJoBfaaqWXEnni8lZDiWwzDsAD nOPg== X-Gm-Message-State: AOAM530BaCTJKkqG8/ZG/EINrtqIiIzZ5r3W3z+2s07RTZ+W0q0HFuYb d3MvgYRFq8V1VlJPy65E+xvJ/mVo X-Google-Smtp-Source: ABdhPJxKeFQUrablUMXA4Lyvlea1TT3fzqbLSOyuM1vC5xqHwk7ulBfv10qGhgAM/27ywSZfzwb2Tw== X-Received: by 2002:a05:600c:21d3:: with SMTP id x19mr2067191wmj.113.1589291052838; Tue, 12 May 2020 06:44:12 -0700 (PDT) Original-Received: from [192.168.0.3] ([66.205.73.129]) by smtp.googlemail.com with ESMTPSA id x5sm24065767wro.12.2020.05.12.06.44.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 12 May 2020 06:44:12 -0700 (PDT) In-Reply-To: <87sgg51msg.fsf@gnu.org> Content-Language: en-US Received-SPF: pass client-ip=2a00:1450:4864:20::334; envelope-from=raaahh@gmail.com; helo=mail-wm1-x334.google.com X-detected-operating-system: by eggs.gnu.org: No matching host in p0f cache. That's all we know. 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_EF=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001 autolearn=_AUTOLEARN X-Spam_action: no action 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:123078 Archived-At: On 12.05.2020 13:15, Tassilo Horn wrote: > (setq-local syntax-propertize-function > (my-make-syntax-propertize-function)) This will be (setq-local syntax-propertize-function #'my-make-syntax-propertize-function) > 2. Some of my syntax rules are not static, so I cannot provide a fixed > set of rules to `syntax-propertize-rules'. Is there anything better > than using `eval' like > > (defun my-make-syntax-propertize-function () > (eval > `(syntax-propertize-rules > ,@(mapcar > #'my-convert-legacy-syntactic-keywords > (my-compute-syntactic-keywords))))) > > or should I prefer writing a manual `syntax-propertize-function'? syntax-propertize-rules can have elisp code inside, just like font-lock-keywords. See js-syntax-propertize as one example.