Function: combobulate-query-builder-thing-to-field-name

combobulate-query-builder-thing-to-field-name is a natively compiled function defined in combobulate-query.el.

Signature

(combobulate-query-builder-thing-to-field-name THING &optional AS-STRING)

Documentation

Turn a THING (string, symbol or :key) into thing:.

IF AS-STRING is non-nil, then the result is returned as a string instead of a symbol.

Source Code

;; Defined in /nix/store/b5fvrwzi3zvkabyzx0in6gw1cj963z46-emacs-packages-deps/share/emacs/site-lisp/combobulate-query.el
(defun combobulate-query-builder-thing-to-field-name (thing &optional as-string)
  "Turn a THING (string, symbol or :key) into `thing:'.

IF AS-STRING is non-nil, then the result is returned as a string
instead of a symbol."
  (and thing
       ;; stringp, symbolp, and plists are supported
       (let ((field
              (cond ((stringp thing)
                     (make-symbol (if (string-suffix-p ":" thing)
                                      thing
                                    (concat thing ":"))))
                    ((symbolp thing)
                     (let ((name (symbol-name thing)))
                       (combobulate-query-builder-thing-to-field-name
                        (if (string-prefix-p ":" name) (substring name 1) name))))
                    (t (error "Unknown thing type: %s" thing)))))
         (if as-string (symbol-name field) field))))