#Emacs' undo-tree.el repository has got only 21 stars. Such a masterpiece, 21 only. Can't understand.
@arialdo vundo is better
@arialdo: i use this customization:
(setopt vundo-glyph-alist vundo-unicode-symbols)
(setq instead of setopt would probably work too)
@mekeor Beautiful. I found that option in the documentation. I did not know about setopt, and now I feel the urge to understand the difference between setopt and setq.
@arialdo @mekeor User options are a higher abstraction than variables. They can have custom setters and getters that execute actions when modified, which setq
would ignore. Examples of user options with side effects are minor modes, which when enabled using setopt
(setopt electric-pair-mode t)
will call the function initialising the minor mode.
It is also possible to have a user option that doesn't have any associated variable, where setting a user option just runs code (e.g. it could modify some more complex state). In these cases, it would be wrong to use setq
.
Also neat: setopt
does (weak) type checking to warn you if the value you are assigning doesn't match the type of the user option.
@arialdo when you define a variable in emacs-lisp, you can associate a setter function with it. the setter function is intended to run whenever a new value is assigned to the variable. in the customize interface, this happens automatically. in elisp code, setq won't trigger the setter function. you need to use setopt instead.
personally, i use setopt for all user options because i don't want to lookup if the option has a setter function in order to find out if i could use the more simple setq instead; and because i don't wanna risk that an existant setter function would not be triggered.
@arialdo sorry, didn't see @pkal's response beforehand :)