7

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/"))))
…
11

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 ...).

  • Thanks a lot! That really rubbed my OCD the right way. :D – Mattias Bengtsson Nov 18 '14 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, privacy policy and cookie policy

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