silgon
silgon

Reputation: 7211

Variable definition for Invisible Text

I'm reading about Invisible Text in the Elisp manual. It defines the variable my-symbol to add or not add ... in place of the hidden text.

 ;; If you want to display an ellipsis:
 (add-to-invisibility-spec '(my-symbol . t))
 ;; If you don't want ellipsis:
 (add-to-invisibility-spec 'my-symbol)

However, I don't get it. How is it that you don't use (setq my-symbol "..."). What is the difference in syntax between (setq my-symbol "...") and '(my-symbol . t).

This might be a silly question but I'm not an expert or anything in Lisp and I'm playing around with Emacs configurations.

Upvotes: 1

Views: 92

Answers (1)

Drew
Drew

Reputation: 30701

If you were to do (setq my-symbol "...") that would just set the value of variable my-symbol to that string.

What the Elisp manual is describing is the form of a specification, that is, a Lisp data structure (in this case a list) that causes certain parts of the buffer text to be invisible. It causes that behavior because such a spec is handled by Emacs automatically.

As @jenesaisquoi said in a comment, it is the C code of Emacs that does that automatic handling of the buffer invisibility spec. To use the spec, refer to the Elisp manual, node Invisible Text.

Upvotes: 1

Related Questions