abo-abo / oremacs

My Emacs config
https://oremacs.com/
296 stars 33 forks source link

RE: csetq - what about customize-set-variable? #24

Closed dieggsy closed 6 years ago

dieggsy commented 6 years ago

Responding to the first section here: https://oremacs.com/2015/01/17/setting-up-ediff/

Have you tried customize-set-variable? Seems to be the closest thing to

a setq that is aware of the custom-set property of a variable.

abo-abo commented 6 years ago

I like the name csetq better. It's almost a setq, but with a c:)

dieggsy commented 6 years ago

Right, but customize-set-variable is an existing function - you could make csetq a wrapper around it

abo-abo commented 6 years ago

Thanks, I have to think about it.

The article is from 2015. So that means either customize-set-variable didn't exist, or it did exist and I copy pasted the (funcall (or (get variable 'custom-set) 'set-default) variable value) line exactly from there (very likely). That means I decided back then specifically not to reuse customize-set-variable. Probably because of some undesired side effect, maybe performance impact.

dieggsy commented 6 years ago

@abo-abo ah, makes sense. I think you're right - when using the custom interface, it may save vars that you set with custom-set-variable elsemere in the custom-file. This is undesirable as it causes duplicate custom variable entries. I'll close :)