Function: clojure-toggle-keyword-string

clojure-toggle-keyword-string is an interactive and byte-compiled function defined in clojure-mode.el.

Signature

(clojure-toggle-keyword-string)

Documentation

Convert the string or keyword at point to keyword or string.

Key Bindings

Source Code

;; Defined in ~/.emacs.d/elpa/clojure-mode-20260325.811/clojure-mode.el
(defun clojure-toggle-keyword-string ()
  "Convert the string or keyword at point to keyword or string."
  (interactive)
  (let ((original-point (point)))
    (unless (memq (char-after) '(?\" ?:))
      (skip-chars-backward "^:\"")
      (unless (bobp)
        (backward-char)))
    (cond
     ((bobp)
      (error "Beginning of file reached, this was probably a mistake"))
     ((eq ?\" (char-after))
      (insert ":" (substring (clojure-delete-and-extract-sexp) 1 -1)))
     ((eq ?: (char-after))
      (insert "\"" (substring (clojure-delete-and-extract-sexp) 1) "\"")))
    (goto-char original-point)))