reddit / emacs

[ANN] info-variable-pitch: View Info with proportional fonts while keeping (most of) what needs to be monospace in mono

flyin1501 · 2022-06-17 17:18
flyin1501 · 2022-06-17 17:20
Repository: https://github.com/kisaragi-hiu/info-variable-pitch This is like [org-variable-pitch](https://github.com/cadadr/elisp/blob/stable/org-variable-pitch.el) but for Info. Install (assuming [straight.el](https://github.com/radian-software/straight.el)): (straight-use-package '(info-variable-pitch :type git :host github :repo "kisaragi-hiu/info-variable-pitch")) (add-hook 'Info-mode-hook #'info-variable-pitch-mode) (Theme: doom-one-light; serif font is Equity, mono font is Iosevka)
TotNotTac · 2022-06-17 18:00
Excuse me good sir, could you tell me the name of the theme? I've been searching for a good light theme and this is exactly what I've been looking for.
Logyross · 2022-06-17 18:02
Looks like modus operandi but I'm not sure.
TotNotTac · 2022-06-17 18:10
Thanks that looks like it could be it
Ghosty141 · 2022-06-17 18:12
What font are you using for variable pitch in the image?
flyin1501 · 2022-06-17 20:31
doom-one-light, a classic.
flyin1501 · 2022-06-17 20:43
That's [Equity](https://practicaltypography.com/equity.html). I bought it a year ago and have been using it as my main serif font. (It looks pretty good, but it's probably not worth paying for unless you really love how it looks, which I do.)
a-c-d-w · 2022-06-17 20:53
This is all I've ever wanted in my whole life <3 thank you SO MUCH :D :D
BettaGeorge · 2022-06-17 21:16
I'm confused. What is the use case for this? As in, when do I ever want something in non-monospaced? Not trying to troll, just curious.
FLMKane · 2022-06-17 21:30
No. Monospaced masterace ftw
chrchr · 2022-06-17 21:45
People usually find variable space text easier to read, though source code is usually rendered in monospace so that the formatting is consistent. This package renders the descriptions and other prose in Info in variable pitch. Many people will find it more legible, but your mileage may vary.
BettaGeorge · 2022-06-17 22:57
Ah, thank you. I mainly code, so monospaced reads fine to me. I forgot that there are other people as well \^\^
georgehank2nd · 2022-06-18 00:28
Master Ace?
FLMKane · 2022-06-18 01:17
Oops
m4dc4p · 2022-06-18 02:09
This is brilliant! Beautiful.
_chebro · 2022-06-18 06:25
could you specify which variant of iosevka that is?
flyin1501 · 2022-06-18 07:06
The default, I guess. I installed it with the [ttc-iosevka Arch Linux package](https://archlinux.org/packages/community/any/ttc-iosevka/).
ramin-honary-xc · 2022-06-18 14:19
Thanks, I was wondering if there might be a way to do this! I guess it requires a bit of black magic to actually have fixed-with fonts for code and variable-width fonts for the prose in the Info-doc pages.
_viz_ · 2022-06-18 15:10
There was discussion about potentially displaying the HTML files produced by texinfo instead. This would allow more correct fontification rather relying on sheer luck. The problem with the *.info files is that they lack a lot of info (hehe) about the markup originally used. Yuan Fu has a POC in his lunarymacs repo.
casouri · 2022-06-18 20:38
This is very nice. Variable-pitch is just sooo much easier to read! I tried similar things in the past and finally gave up to the edge cases here and there. Seeing this inspired me to give it another try :-) Maybe instead of fixing all the edge cases (which is impossible), we can provide a convenient manual markup feature that lets one manually correct the font for a piece of text with a few clicks and have it persist across sessions.
flyin1501 · 2022-06-19 00:20
The edge cases are truly painful to deal with :( it feels like those code blocks are actually manually indented. It might actually be worth it if different rules are applied for different pages, which would be kind of like the manual correction you said, except available out of the box. (imho as a reader I'd find it to be more hassle to mark text to display as mono if pages are updated often and have to be marked again; and if they aren't updated often, the package can probably just include those "mark"s out of the box.) btw, I love your valign-mode, thank you for making it! Org tables were never useful to me until I started using that package.
Schievel1 · 2022-06-19 06:24
Pretty awesome. Does this work only in elisp files or also in other source code for the commentary?
flyin1501 · 2022-06-19 09:58
In theory it should work in all Info pages (`M-x info`), but I haven't tested it beyond some pages in the top few manuals on my system (Org, Racket Mode, Elisp) so expect the occasional prose line being treated as code. (It is a local minor mode for Info and will not work for source code.)
Schievel1 · 2022-06-19 11:39
Could we make that work for source code? I mean, I am and idiot in elisp, so I can’t do it, but couldn’t we just say change the font for everything behind a // to the end of the line? Plus everything between /* and */? Wait a sec, can you change the font of comments like you change the color of comments maybe?
flyin1501 · 2022-06-19 14:43
If you want it to apply to entire comments, yeah: (set-face-attribute 'font-lock-comment-face nil :family "Sans") It gets more complicated if you want to keep the comment markers in monospace, or if you don't want it to apply to docstrings. It's beyond the scope of this project.
Schievel1 · 2022-06-19 17:39
Thanks, I will try this out
quote-only-eeee · 2022-06-20 01:03
Does it support reflow for non-code text, so that the text width can be bigger/smaller than the default? That's the biggest problem that info has IMO! This package seems like it could solve that.
casouri · 2022-06-20 03:10
For the elisp manual, pre-marking would be great: they only change when a new Emacs version comes out. And the elisp manual is the only one that I regularly read anyway. Glad you like valign ;-)
casouri · 2022-06-20 03:17
You can find my attempt here, I used some ad-hoc parsing instead of regexp, and I didn't use font-lock. [https://github.com/casouri/lunarymacs/blob/master/site-lisp/info-pretty.el](https://github.com/casouri/lunarymacs/blob/master/site-lisp/info-pretty.el)
a-c-d-w · 2022-06-20 16:25
I did this actually! And yeah, it's about that simple. If you want to change the font of the markers, I think the face is `font-lock-comment-delimiter-face`. I also have it `:inherit variable-pitch` instead of setting the family, but same idea.