- (insert (pp-to-string spec))))
-
-(put 'gnus-search-or-regist-spec 'lisp-indent-function 1)
-(defmacro gnus-search-or-regist-spec (mspec &rest body)
- (let ((specs (nth 0 mspec)) (type (nth 1 mspec)) (format (nth 2 mspec))
- (spec (nth 3 mspec)) (entry (nth 4 mspec)) (elem (nth 5 mspec)))
- `(let* ((,entry (assq ,type ,specs))
- (,elem (assoc ,format (cdr ,entry))))
- (or (cdr ,elem)
- (when (progn ,@body)
- (if ,entry
- (if ,elem
- (setcdr ,elem ,spec)
- (setcdr ,entry (cons (cons ,format ,spec) (cdr ,entry))))
- (push (list ,type (cons ,format ,spec)) ,specs))
- (gnus-product-variable-touch (quote ,specs)))
- ,spec))))
+ (insert (gnus-pp-to-string spec))))
+
+(eval-when-compile (defvar unchanged))
+
+(put 'gnus-search-or-regist-spec 'lisp-indent-function 4)
+(defmacro gnus-search-or-regist-spec (specs type format val &rest body)
+ `(let* ((entry (assq ,type ,specs))
+ (elem (assoc ,format (cdr entry))))
+ ;; That `(cdr elem)' returns non-nil means the spec for `type'
+ ;; doesn't need to be updated.
+ (or (cdr elem)
+ ;; This variable is set beforehand.
+ (setq unchanged nil)
+ ;; Update the spec. Where `body' will modify `val'. This
+ ;; section will be skipped if compiling the spec is disabled.
+ (when (progn ,@body)
+ (if entry
+ (if elem
+ (setcdr elem ,val)
+ (setcdr entry (cons (cons ,format ,val) (cdr entry))))
+ (push (list ,type (cons ,format ,val)) ,specs))
+ (gnus-product-variable-touch (quote ,specs)))
+ ;; Return the new spec without compiling.
+ ,val)))