From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Christopher Dimech Newsgroups: gmane.emacs.devel Subject: Re: prettify-symbols-mode to handle "\alpha-\beta" ... Date: Thu, 4 Feb 2021 05:21:14 +0100 Message-ID: References: <87v9b8mvpb.fsf@telefonica.net> <87r1lwmrgc.fsf@telefonica.net> 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="27819"; mail-complaints-to="usenet@ciao.gmane.io" Cc: =?UTF-8?Q?=C3=93scar_Fuentes?= , emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Thu Feb 04 05:21:59 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 1l7W9W-00077C-TD for ged-emacs-devel@m.gmane-mx.org; Thu, 04 Feb 2021 05:21:58 +0100 Original-Received: from localhost ([::1]:59488 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1l7W9V-0004qk-W2 for ged-emacs-devel@m.gmane-mx.org; Wed, 03 Feb 2021 23:21:58 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:42828) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7W8w-00048r-1P for emacs-devel@gnu.org; Wed, 03 Feb 2021 23:21:22 -0500 Original-Received: from mout.gmx.net ([212.227.15.18]:53755) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1l7W8t-000885-Rm for emacs-devel@gnu.org; Wed, 03 Feb 2021 23:21:21 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1612412474; bh=tiF9KO1b9uwFf47Rh/S39++UtmkGowEsBRaS9pWtDm0=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=VjKylD4eNc1oAFw7fUECvfh9GxV7Lp/CJ3oGGSKCqKEejc0BOofEqvNQThzGbWiUH GoZDDRzkhzE2IvslLEbSn1aSZXljFHDhJ0KJaxabj7ZpVtsGVRlC7yQRn+c2MmsSHq CaULw0MtxJsTUXw8Z2Hs8LZi/fZIsTf3KLlGzTz4= 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-bs11.server.lan [172.19.170.179]) (via HTTP); Thu, 4 Feb 2021 05:21:14 +0100 Importance: normal Sensitivity: Normal In-Reply-To: X-UI-Message-Type: mail X-Priority: 3 X-Provags-ID: V03:K1:lKPt+vyg197ETsZlfw9q7r2s8RtcTcOmaao7MR8vQeWGUY+kfhIq2xJ/gIf6r9z6qOrWX ZLwJlr+54kDKLqD1yE4yLCm7zR1DXNrn8Wbd65yesqUvosXv8ZbU/IM0Tz6FaH9GWhvkkJy9tzLq GFFX3OANchASZ5HbodAHR8tt8VcgFQgxPR8U3+lqG66HZCwo+pVQs2tOUWkPzaKi+1ZQTQ4hV+eU hAe7bgP056mvHzBGn2LCgdjeeeNbCZpWL2joLWQstVEt3GG+EhdijZ7oYiXHG2HTaANDCY1W7aMt Tc= X-UI-Out-Filterresults: notjunk:1;V03:K0:jveqgx4inUY=:C/6HRVvq8Qjt+ahW34ulWD 7Lh9rNIbqCpwWPwwYsmPbBHuASZlLT6GUWEP+pxu/7fQILAik89aHZL8wnwooz9mxCUUkocNc tB38pPSqROC7lJfTIkChBEzKXQJhmtZ8cV01CbWbduYsI2QJKg/H+0X+z2wPXRAVRxNhTm/LF s697JzH8e0an7OvcnkshlO3wUuQHHiEhG+s0jf19GParfmH+hd/ec1bJroNaTIs2RrUMLB5wK 8IUVVtwCfFykCHNrmr4LQlVdbnVIJjVJExuX0VJ/T40QOvT7d+I8nNA58b1EMAJ6s1q44GW4t 77ENT8s/9/kReWlwXd8cqjoy734yroogw0DyIW6ty0UCHLkvhSIw0/8E93F5Is7jg1yOna7hx fy8UdRreA++qIfthYj8zn2sDnclldhI/Z3ddj/lIJMEG0WLd7pL8++6vZxECXLgRTQsXCekFP lMFML+sDsdeFCHFZUJ2pMYkOqwXF4hkjhaLdrgRbW/MVueipyB0BmGy5pO1jfuoO5f5vGSpeb B8fuJmai9f5Z/K2/w1Tu6L0YGZA9B8UwPjWxxK95wdWfVXZCErEVwDUidnhgu3DKbA8QGCnon 0qQUyaIwZBUj0= Received-SPF: pass client-ip=212.227.15.18; envelope-from=dimech@gmx.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:263841 Archived-At: We should find the best way to do this rather than a hack that is likely to be rejected by emacs-devel=2E pretty-symbols=20 is a good candidate for this because it is intended for use with general programming modes=2E Texinfo has today evolved like a programming language with its support for plain-tex and commands for mathjax=2E =20 Whilst texinfo=2Eel takes care of texinfo commands, it completely disregards the use of tex constructs and the focus on displaying mathematical expressions within texinfo=2E =20 --------------------- Christopher Dimech General Administrator - Naiad Informatics - GNU Project (Geocomputation) - Geophysical Simulation - Geological Subsurface Mapping - Disaster Preparedness and Mitigation - Natural Resource Exploration and Production - Free Software Advocacy > Sent: Thursday, February 04, 2021 at 4:04 PM > From: "Stefan Monnier" > To: "=C3=93scar Fuentes" > Cc: emacs-devel@gnu=2Eorg > Subject: Re: prettify-symbols-mode to handle "\alpha-\beta" =2E=2E=2E > > > Supporting what you want would require either changing what texinfo > > considers a symbol or changing prettify-symbols-mode to work on > > something else instead of symbols=2E >=20 > The second can be done without changing the code of > `prettify-symbols-mode`: you want to change > `prettify-symbols-compose-predicate` which contains the function that de= cides > whether a given occurrence should be prettified or not=2E >=20 > E=2Eg=2E the default is the function `prettify-symbols-default-compose-p= ` > defined as follows: >=20 > (defun prettify-symbols-default-compose-p (start end _match) > "Return true iff the symbol MATCH should be composed=2E > The symbol starts at position START and ends at position END=2E > This is the default for `prettify-symbols-compose-predicate' > which is suitable for most programming languages such as C or Lisp= =2E" > ;; Check that the chars should really be composed into a symbol=2E > (let* ((syntaxes-beg (if (memq (char-syntax (char-after start)) '(= ?w ?_)) > '(?w ?_) '(?=2E ?\\))) > (syntaxes-end (if (memq (char-syntax (char-before end)) '(?= w ?_)) > '(?w ?_) '(?=2E ?\\)))) > (not (or (memq (char-syntax (or (char-before start) ?\s)) syntax= es-beg) > (memq (char-syntax (or (char-after end) ?\s)) syntaxes-= end) > (nth 8 (syntax-ppss)))))) >=20 > You'd presumably want to then define your own such function which does > pretty much the same except that it doesn't accept the syntax `_`: >=20 > (defun texinf-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))))) >=20 >=20 > -- Stefan >=20 >=20 >