Function: srecode-dictionary-merge

srecode-dictionary-merge is a byte-compiled function defined in dictionary.el.gz.

Signature

(srecode-dictionary-merge ARG &rest ARGS)

Implementations

((dict srecode-dictionary) otherdict &optional force) in `srecode/dictionary.el'.

Merge into DICT the dictionary entries from OTHERDICT. Unless the optional argument FORCE is non-nil, values in DICT are not modified, even if there are values of the same names in OTHERDICT.

Source Code

;; Defined in /usr/src/emacs/lisp/cedet/srecode/dictionary.el.gz
(cl-defmethod srecode-dictionary-merge ((dict srecode-dictionary) otherdict
				     &optional force)
  "Merge into DICT the dictionary entries from OTHERDICT.
Unless the optional argument FORCE is non-nil, values in DICT are
not modified, even if there are values of the same names in
OTHERDICT."
  (when otherdict
    (maphash
     (lambda (key entry)
       ;; The new values is only merged in if there was no old value
       ;; or FORCE is non-nil.
       ;;
       ;; This protects applications from being whacked, and basically
       ;; makes these new section dictionary entries act like
       ;; "defaults" instead of overrides.
       (when (or force
		 (not (srecode-dictionary-lookup-name dict key t)))
	 (cond
	  ;; A list of section dictionaries. We need to merge them in.
	  ((and (listp entry)
		(srecode-dictionary-p (car entry)))
	   (dolist (sub-dict entry)
	     (srecode-dictionary-merge
	      (srecode-dictionary-add-section-dictionary
	       dict key t t)
	      sub-dict force)))

	  ;; Other values can be set directly.
	  (t
	   (srecode-dictionary-set-value dict key entry)))))
     (oref otherdict namehash))))