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:22:05 +0100 Message-ID: References: <87v9b8mvpb.fsf@telefonica.net> <87r1lwmrgc.fsf@telefonica.net> <5588fb258084b189877d@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="19697"; 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:23:24 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 1l89Vc-00051b-M6 for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Feb 2021 23:23:24 +0100 Original-Received: from localhost ([::1]:50778 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l89Vb-0000MY-PA for ged-emacs-devel@m.gmane-mx.org; Fri, 05 Feb 2021 17:23:23 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:52030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l89US-0008M8-Qu for emacs-devel@gnu.org; Fri, 05 Feb 2021 17:22:12 -0500 Original-Received: from mout.gmx.net ([212.227.17.21]:41361) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l89UO-000347-N3 for emacs-devel@gnu.org; Fri, 05 Feb 2021 17:22:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1612563725; bh=SdXFwH+F/7sWpOEPTU2RB4nDZ2OjcxOz1WPeb+xls1E=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=IS5hirhGPqDeAcniaYE3Vfwfd2dpgXry/7kL1U7nlGjjOsG1TvWUyrCjcEs3/t/mf lgfl7QBUXnuIwyo/PwJBvvQjR70gRHFUrBmcOaj/vXpRaHf3XZXj6ZU3sIi+iNqknP oz67c/AwdW2qA+xjEBQUf4VSYqrFu/3U/gUTSpkY= 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:22:05 +0100 Importance: normal Sensitivity: Normal In-Reply-To: <5588fb258084b189877d@heytings.org> X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:cWrzO9YwKfhvun8HJDQpflbWY6B1gbTKadL4Rzpd5HzOiQhayMlsOhxn3pH1AekLWMu6H O693yagiT+aam12iKXrL6khUpYNhQax+xRQGwEEm9m8TYBHaBaY4434FUfhdF4AmQfAy6xLshNIw eqouZas0lAd2IVR6NW4ZvCf7yR4LOzbuf5FgecQUQ7cHyC0F7nRxATZaLWRnyWi4lXDDn1Oq21bP nIPzqLK+4amD4grztRatB5TpqlXw/MUcVRExxEY7nbYt78lYaXFmhElhbHMcHIWcwvV5shYGjHQT xE= X-UI-Out-Filterresults: notjunk:1;V03:K0:L4vP8HotzXc=:tAqdCZiZSdPKgZE0yv4E8x fImsZWBDe0kLFFZzWZ99K+aRUspxbsquoPiQ2NpSocjgZesbNoU38Ri3nfwe02j5oVe0X3z5r z+80DqIC+jEQAHZzm/sZ0pygkwnGyHNr7cYGXVqaKQUymp64P4tcVeLwI00rUEcP4jFYb38go e90SPF6MAL5W0tAF0BOVliAPPhgRUfUdJJ52T8zy4qFNLvAHDkvTwqG2kwK5vFSq07AHkae3g Ff8keUWUQdLTqpAXkzwha4Z49H2MVwZgt2fPdWBnUyMJqlJJaUsSViVGLS9xU38qUWLFKQAxb 7Ju201yvvCvms66ain32+eP38kJ3CAPjlBviimy6RrrRuFdkPlWIErfEsUVyv7BKayMUeyxbR OflGhDhk8KqN1zQtJg6KMqyfJnqgkhAOLrTkSA5gTs5IKHdc49zBWkKbC5RxiiTcOifAcMIXW LUzCYUgHukvBmhqpsv2eirgJonc/8aXkyn9vD5gscO9ayfWZfJSq3puODG7Pn5SmHhvcDlryA lCR0Vj3X5FVTMurpFQjdGDsPeCjZNagclj/7e97t19ewnFPkgXBevcaxFmK3eBX2J1xCz+7xd S37fUtnZMwVEc= Received-SPF: pass client-ip=212.227.17.21; 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_H2=-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:264021 Archived-At: > Sent: Saturday, February 06, 2021 at 10:09 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, \alpha+\bet= a,=20 > > \alpha/\beta, so that \alpha and \beta are prettified seperately? > > >=20 > That's not necessary=2E Just follow Stefan's advice: >=20 > (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-prettify-= symbols-compose-p) > (prettify-symbols-mode))) >=20 > This does what you want=2E That is not completely correct because for "\alpha-\beta", only \beta is p= rettified=2E However, \alpha, \alpha=2E \alpha() \alpha[] work well with \alpha being p= rettifyied even though the next character is a comma, period and parenthesis=2E To cater for prettifying tex, we could have another function where one can= construct the prettify=2E =20