From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: pietru@caramail.com Newsgroups: gmane.emacs.devel Subject: Re: prettify-symbols-mode to handle "\alpha-\beta" ... Date: Fri, 5 Feb 2021 23:56:31 +0100 Message-ID: References: <87v9b8mvpb.fsf@telefonica.net> <87r1lwmrgc.fsf@telefonica.net> <5588fb258084b189877d@heytings.org> <5588fb25804d75ad55f8@heytings.org> 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="12171"; mail-complaints-to="usenet@ciao.gmane.io" Cc: emacs-devel@gnu.org To: Gregory Heytings Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Fri Feb 05 23:57:23 2021 Return-path: Envelope-to: ged-emacs-devel@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 1l8A2U-00033W-TK for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Feb 2021 23:57:22 +0100 Original-Received: from localhost ([::1]:40264 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l8A2T-0001iG-UU for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Feb 2021 17:57:21 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:58862) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l8A1j-0000ZG-QO for emacs-devel@gnu.org; Fri, 05 Feb 2021 17:56:35 -0500 Original-Received: from mout.gmx.net ([212.227.15.15]:55089) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l8A1h-0002wL-Uc for emacs-devel@gnu.org; Fri, 05 Feb 2021 17:56:35 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1612565791; bh=JUJEQ02C4gGA1Gy6UzOZccMIPpSGw0rdEZCCWZA7/28=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=X5rK7Et1+eWsiTWqG1CipEElHkzC/94dyreb1LaMRcGip6Pj9NRF93fPEBUTUz0F4 3+d1jM7fY0teT5LW+2TFR1AwDqtHmPv6idlmjresR5z57VCsDmvg9YUCtULmZ1PfaL pj/CskHbN8WSnHYb1esMhI2PKFv3XN1SVfjHI+pc= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Original-Received: from [213.165.168.94] ([213.165.168.94]) by web-mail.gmx.net (3c-app-mailcom-bs10.server.lan [172.19.170.178]) (via HTTP); Fri, 5 Feb 2021 23:56:31 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <5588fb25804d75ad55f8@heytings.org> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:yvVGSi1+ne6hrcLAqh1SPSSgAd+SPzqSX6U/2KX5bPWJRK8bRLc7yCUm0bLVudwaGfoWG zwYfZwShxLPtMsD/4z9wpfE+MqiMBdamk8rGjrbk3FpvkWmIcmaB3lh4oL93hvbylOWOHeaIc5c4 7AHHqh4D4bt4CWKlH5r9IPTTwYdNEstjoI4Wj3wuXD5qL5cuT8hNzckWGk0OM3OFSe1Ibvs8fePe y9a9lZt+Zl1EejfofwLEIVltYOcATDDo7OWaOYAClHZqVoMnExrrwud+frmWKBC6IJkgwg5fi3Nj 6A= X-UI-Out-Filterresults: notjunk:1;V03:K0:pkbHuY2vzB8=:khS8pmlka923ErZXY8mFbC wG/cKq7SS1yrkzwc8R9LPunb8dw2NyRi4MlYaoy3AwuOfcDNLflp+8h8jqIHpEEeJSPKGL/QJ lmp9Y3yCZBnaWBugae1Oboha0nav4y9dYDJinR9U/R8eRDEnP4kDhYCreadinm22MSSDqW0Ho jOh9ApEL7DqWFmaorjOCyvKpp1R3AOFY/Kzjsn9xSz1hvfVAWY8z9XiR1in9iwS0Wx87UdQ/2 1PdrXSd7d0s2PbHBMCymtnZiFcHRA0uE5/WBNhjSnOQsz7RFks+da3HB96FCFTXEeEKHouWrA t5Vfo67W5sIxW+KRhylCNr6p2d4duKjJNNIQtuCQd89hXZfYfL5Q5mNPR9w4xMcTtSwld33Pf Y/+ae7nytfoEYabhG/BR0XOi2caG32s88GOW0gbRuHUsyskhWfE9lGWqX3HBBsUOqHg4ZDKun KgqRrcohxH2PpxjhY8IiyuOURezsDxFgZLFqHkZI7rQRJuUNyj93AMVdt188U8XQL2javmgNv hnSHHDoATk/5fLfxjgCseh79vqJVzdm81ushoSH7/jxOJARljIL6+eOSN6jFMrSeP1OR9n0P5 0ofi2hyxrbnGA= Received-SPF: pass client-ip=212.227.15.15; envelope-from=pietru@caramail.com; helo=mout.gmx.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:264025 Archived-At: > Sent: Saturday, February 06, 2021 at 10:45 AM > From: "Gregory Heytings" > To: pietru@caramail=2Ecom > Cc: emacs-devel@gnu=2Eorg > Subject: Re: prettify-symbols-mode to handle "\alpha-\beta" =2E=2E=2E > >=20 > >>> Would allowing a regexp solve the expression \alpha-\beta,=20 > >>> \alpha+\beta, \alpha/\beta, so that \alpha and \beta are prettified= =20 > >>> seperately? > >> > >> That's not necessary=2E Just follow Stefan's advice: > >> > >> (defun texinfo-prettify-symbols-compose-p (start end _match) > >> ;; We know the matches all start with a backslash and end with > >> ;; a word-element=2E > >> (not (or (memq (char-before start) '(?\\)) > >> (memq (char-syntax (or (char-after end) ?\s)) '(?w)) > >> (nth 8 (syntax-ppss))))) > >> (add-hook 'texinfo-mode-hook > >> (lambda () > >> (push '("\\alpha" =2E ?=CE=B1) prettify-symbols-alist) > >> (push '("\\beta" =2E ?=CE=B2) prettify-symbols-alist) > >> (setq prettify-symbols-compose-predicate 'texinfo-pretti= fy-symbols-compose-p) > >> (prettify-symbols-mode))) > >> > >> This does what you want=2E > > > > That is not completely correct because for "\alpha-\beta", only \beta = is=20 > > prettified=2E > > >=20 > No, \alpha-\beta is prettified correctly=2E Tested with Emacs 25, 26, 2= 7=20 > and 28=2E Have tried it in a texinfo document using @tex $\alpha -\beta \gamma \alpha - \beta \gamma \alpha, \alpha=2E \alpha- \alp= ha() \alpha[]$ @end tex