8

Is it possible to teach customize to save its variables using single quote ' instead of quote?

Example:

…
'(package-archives '(("gnu"   . "http://elpa.gnu.org/packages/")
                     ("melpa" . "http://melpa.org/packages/")))
…

instead of:

…
'(package-archives (quote (("gnu"   . "http://elpa.gnu.org/packages/")
                           ("melpa" . "http://melpa.org/packages/"))))
…

2 Answers 2

12

Whether Lisp objects are printed using ' and #' is controlled by print-quoted.

See section Output Variables of the Emacs Lisp manual.

So,

(advice-add 'custom-save-all :around
            (lambda (orig)
              (let ((print-quoted t))
                (funcall orig))))

tells customize to use ' instead of (quote ...) and #' instead of (function ...).

1
  • Thanks a lot! That really rubbed my OCD the right way. :D Nov 18, 2014 at 2:44
1

If you need compatibility with Emacs older than 24.4 this will do as well:

(defadvice custom-save-all (around custom-save-all-around)
  "Use abbreviated quotes for customize."
  (let ((print-quoted t))
    ad-do-it))

Reference

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.