From 2c66f5d19633aaed36d7da8722dd06a2cc108132 Mon Sep 17 00:00:00 2001 From: "Richard M. Stallman" Date: Thu, 10 Apr 1997 05:58:24 +0000 Subject: [PATCH] (eval-defun): For defcustom, always set the value. --- lisp/emacs-lisp/lisp-mode.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index ebdee0673ee..be328b30329 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -329,9 +329,14 @@ With argument, insert value in current buffer after the defun." (end-of-defun) (beginning-of-defun) (read (current-buffer))))) - (if (and (eq (car form) 'defvar) - (cdr-safe (cdr-safe form))) - (setq form (cons 'defconst (cdr form)))) + (cond ((and (eq (car form) 'defvar) + (cdr-safe (cdr-safe form))) + ;; Force variable to be bound. + (setq form (cons 'defconst (cdr form)))) + ((and (eq (car form) 'defcustom) + (default-boundp (nth 1 form))) + ;; Force variable to be bound. + (set-default (nth 1 form) (eval (nth 2 form))))) (prin1 (eval form)))) (defun lisp-comment-indent () -- 2.11.4.GIT