feature request: enable certain libraries/adding greek letters (ideally numberable)
nhmacuk opened this issue · 5 comments
Do you know if it is possible to enable Greek letters in your mode? It seems that they are included in the font ( https://v-fonts.com/fonts/fira-code ), but I haven't found out yet how to enable them. Greek letters to which I could append numbers to use as variables (e.g. alpha1 showing as α1) would help to make my scripts a lot more legible. I would like to replace pretty-mode and others with a mode like yours.
While I do think it would be possible to achieve this, it seems like a pretty specific use case to only support lowercase Greek letter names followed by numbers - what about the letter names not followed by a number? Followed by more letters? Starting with a capital?
The purpose of fira-code-mode
is to enable Fira Code's builtin programming ligatures within Emacs (for those without the config to draw Fira Code's builtin ligatures using Emacs 27/Harfbuzz). Since Fira Code does not include ligatures for transforming "alpha" into "α", etc., I think a feature like this is out of scope for fira-code-mode
. And since many modern fonts include the Greek alphabet, this feature would also not be specific to Fira Code.
This does sound like a great opportunity for a new Emacs package, though! It probably wouldn't be hard to use font locking to achieve the functionality you want, whether or not you decide to use Fira Code, fira-code-mode
, pretty-mode
or anything else.
You could maybe use a font lock keyword similar to '(("\\(alpha\\)[0-9]+" 1 '(face nil display "α")))
and then borrow code from:
fira-code-mode/fira-code-mode.el
Lines 110 to 121 in a61d7fc
and you'd be well on your way to achieving what you want.
Depends on what you mean by "irrelevant" - sure, Harfbuzz will soon be the Right Way™ to do text shaping, and at that point it will be less hacky and probably more efficient to use it. But that doesn't mean that any other packages will stop working!
I recently updated to Emacs 27, but I still use fira-code-mode
since I haven't taken the time to look into doing anything else, and the old ways still work.
Especially my code suggestion of using font locking is sure to work basically forever - font locking is at the heart of all kinds of builtin features.
I am using Emacs bleeding edge, and still haven't configured it to use HarfBuzz. It would be truly awesome if this package could detect HarfBuzz and use its compose-gstring-for-graphic
etc. in newer Emacs rather than the old method, and fallback otherwise. My version below:
"GNU Emacs 28.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.20, cairo version 1.16.0)\n of 2020-05-17, unofficial emacs-snapshot build: http://emacs.secretsauce.net"
It would be truly awesome if this package could detect HarfBuzz and use its
compose-gstring-for-graphic
etc. in newer Emacs rather than the old method, and fallback otherwise.
I totally agree! Have you been able to find any entries in the Emacs manual (or other documentation) for using these functions? I see some of the vars and functions in composite.el have docstrings, but they're pretty low-level, I would feel much more comfy with a "Getting Started" overview of character composition first. I tried searching the Emacs manual, but couldn't find anything.