4 ms·
Doesn't Emacs have syntax highlighting for all of these cases? It even has a tree-sitter integration which highlights even more accurately than good-ol-regexes.
by emporas 3y ago
Doesn't Emacs have syntax highlighting for all of these cases? It even has a tree-sitter integration which highlights even more accurately than good-ol-regexes.
Something i wanna try at some point, is to make all faces in a file equal to the background, except for comments, so as to read only the comments of a file. Or read only comments and function definitions. Or only function definitions and variables.
- arialdomartini 3y agoWould you be so kind to share the result? I’m very interested in this experiment.
- emporas 3y agoThat might not be difficult to do it yourself. Modus themes for example have code mappings, with a different coloration for code literals. In that file [1] for example, bg-main has the hex value of #000000, total black. If you want some part of the code to disappear, make it the same value. You could make builtins or constants #000000, and they will not be visible in the source file. You can create different themes, like a comment theme, in which every part of the code is invisible (i.e. hex value black) except for the part you want visible, comments in that case. Then when you want everything visible again, you toggle the loaded theme. I don't know if i will create such themes myself, my github account is on github/pramatias. I may upload something in the future, or may not. [1]https://gitlab.com/protesilaos/modus-themes/-/blob/main/modus-vivendi-tritanopia-theme.el?ref_type=heads#L249 https://gitlab.com/protesilaos/modus-themes/-/blob/main/modu...
- gipp 3y agoThere are VSCode themes that have much of this as well, if your LSP supports semantic highlighting
- mst 3y agoI've seen themes that grey out comments and every time I see one I think "shouldn't a theme that greys out everything except comments be more useful?" So, yes, definitely sounds worth a try to me. Be fun to figure out how to do it if nothing else :D
- emporas 3y agoWith comments, it depends on the case. When reviewing code, or on an architectural refactoring with no new code being inserted, comments being more visible is certainly desirable. In a normal setting of writing code, comments should fade out. You can have the best of both worlds, by switching themes with appropriate coloration whenever you like. In emacs there are a ton of themes, each with it's own emphasis on coloration, but you can also make your own easily, or tune an existing one. I have commented already on how to tune one, using modus themes, on the same thread.
- mst 3y ago> In a normal setting of writing code, comments should fade out. Not convinced by 'should' because it seems like it would make it easier to not notice a comment that needs updating and humans in general (myself definitely included) are bad enough at that already. (Note that that doesn't mean I'm arguing that it's a -wrong- choice, just yet another trade-off to be considered)