Function: hash-deep-copy

hash-deep-copy is a byte-compiled function defined in hasht.el.

Signature

(hash-deep-copy OBJ)

Documentation

Return a copy of OBJ with new copies of all elements, except symbols.

Source Code

;; Defined in ~/.emacs.d/elpa/hyperbole-20260414.325/hasht.el
(defun hash-deep-copy (obj)
  "Return a copy of OBJ with new copies of all elements, except symbols."
  (cond ((null obj) nil)
	((stringp obj)
	 (copy-sequence obj))
	((hash-table-p obj)
	 (let ((htable-copy (make-hash-table :size (length obj))))
	   (maphash
	    (lambda (key _value)
	      (puthash key (hash-deep-copy obj) htable-copy))
	    obj)
	   htable-copy))
	((vectorp obj)
	 ;; convert to list for mapping
	 (setq obj (append obj nil))
	 ;; Return as a vector
	 (vconcat (mapcar 'hash-deep-copy obj)))
	((atom obj) obj)
	((consp obj)  ;; cons or list
	 (cons (hash-deep-copy (car obj)) (hash-deep-copy (cdr obj))))
	(t (error "(hash-deep-copy): Invalid type, `%s'" obj))))