this post was submitted on 30 Nov 2023
2 points (100.0% liked)

Emacs

311 readers
1 users here now

A community for the timeless and infinitely powerful editor. Want to see what Emacs is capable of?!

Get Emacs

Rules

  1. Posts should be emacs related
  2. Be kind please
  3. Yes, we already know: Google results for "emacs" and "vi" link to each other. We good.

Emacs Resources

Emacs Tutorials

Useful Emacs configuration files and distributions

Quick pain-saver tip

founded 1 year ago
MODERATORS
 

Hello emacs and Lisp enthusiasts,

I remember seeing an article that talked about the superfluity of parenthesis in Lisp code, and how non-Lisp programmers were overwhelmed by them, but Lisp programmers had trained their eyes to look at indentation structure and didn't see the parenthesis, and it showed an image of Lisp code without and with the parenthesis faded. I don't have a link to the article, but even as a slightly seasoned Lisper I thought the fainter parenthesis improved readability.

So I'm wondering if/how it's possible to achieve this effect in emacs. Is there already a minor-mode for it? Would it involve a font-lock/face for parenthesis? I've tried to navigate the syntax highlighting code before and was a bit turned off by the apparent complexity, so any form of introduction would be greatly appreciated.

top 6 comments
sorted by: hot top controversial new old
[–] MitchellMarquez42@alien.top 2 points 11 months ago (2 children)

I use the rainbow-delimiters package, which gives you up to 9 faces to set parentheses

[–] centzon400@alien.top 2 points 11 months ago (1 children)

9?

Holy cow. It may have been RMS who said if you are even "four-deep" it's time to refactor.

[–] amanneedsamaid@sopuli.xyz 1 points 11 months ago

No clue about RMS, but I know for a fact Torvalds said that.

[–] JDRiverRun@alien.top 1 points 11 months ago

I also use rainbow-delimiters, but they are a bit too bright in my dark theme, so I:

(use-package rainbow-delimiters
  :config
  ;; Darken them a bit
  (cl-loop for f in (face-list)
	   if (and (string-prefix-p "rainbow-delimiters" (symbol-name f)) 
		   (face-foreground f)) do
	   (set-face-foreground f (color-darken-name (face-foreground f) 15))))

See also color-lighten-name to go the other way.

[–] Aggravating-Step2751@alien.top 1 points 11 months ago
[–] fuzzbomb23@alien.top 1 points 11 months ago

See the paren-face package. The diagram you mention sounds like the one in the repository README. (I think the diagram has been used in longer article too, but I'm not sure where it originated.)