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/"))))
…
Constantine
  • 9,122
  • 1
  • 35
  • 50
Mattias Bengtsson
  • 1,300
  • 1
  • 11
  • 18

2 Answers2

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

Constantine
  • 9,122
  • 1
  • 35
  • 50
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

Mattias Bengtsson
  • 1,300
  • 1
  • 11
  • 18