Given the following defcustom:
(defcustom shell-pop-shell-type '("shell" "*shell*" (lambda () (shell)))
"Type of shell that is launched when first popping into a shell.
The value is a list with these items:
- Internal name of the shell type. This should be unique \"id\".
- Name of the buffer this shell opens.
- A function that launches the shell."
:type '(choice
(list :tag "Custom" string string function)
(const :tag "shell"
("shell" "*shell*" (lambda () (shell))))
(const :tag "terminal"
("terminal" "*terminal*" (lambda () (term shell-pop-term-shell))))
(const :tag "ansi-term"
("ansi-term" "*ansi-term*" (lambda () (ansi-term shell-pop-term-shell))))
(const :tag "eshell"
("eshell" "*eshell*" (lambda () (eshell)))))
:set 'shell-pop--set-shell-type
:group 'shell-pop)
Setting this with M-x counsel-set-variable gives the following options:
5 candidates:
function
("shell" "*shell*" (lambda nil (shell)))
("terminal" "*terminal*" (lambda nil (term shell-pop-term-shell)))
("ansi-term" "*ansi-term*" (lambda nil (ansi-term shell-pop-term-shell)))
("eshell" "*eshell*" (lambda nil (eshell)))
function is not a correct value for this variable, and choosing any of the other values gives:
Debugger entered--Lisp error: (invalid-function "shell")
("shell" "*shell*" (lambda nil (shell)))
(setq shell-pop-shell-type ("shell" "*shell*" (lambda nil (shell))))
eval((setq shell-pop-shell-type ("shell" "*shell*" (lambda nil (shell)))))
(progn (setq res (if (assoc res cands) (cdr (assoc res cands)) (read res))) (eval (list (quote setq) sym res)))
(if res (progn (setq res (if (assoc res cands) (cdr (assoc res cands)) (read res))) (eval (list (quote setq) sym res))))
(let* ((sym-val (symbol-value sym)) (sym-val-str (replace-regexp-in-string "%" "%%" (format "%s" sym-val))) (res (ivy-read (format "Set (%S <%s>): " sym sym-val-str) cands :preselect (prin1-to-string sym-val)))) (if res (progn (setq res (if (assoc res cands) (cdr (assoc res cands)) (read res))) (eval (list (quote setq) sym res)))))
(if (and (boundp sym) (setq sym-type (get sym (quote custom-type))) (cond ((and (consp sym-type) (memq (car sym-type) (quote (choice radio)))) (setq cands (delq nil (mapcar (function counsel--setq-doconst) (cdr sym-type))))) ((eq sym-type (quote boolean)) (setq cands (quote (("nil") ("t" . t))))) (t nil))) (let* ((sym-val (symbol-value sym)) (sym-val-str (replace-regexp-in-string "%" "%%" (format "%s" sym-val))) (res (ivy-read (format "Set (%S <%s>): " sym sym-val-str) cands :preselect (prin1-to-string sym-val)))) (if res (progn (setq res (if (assoc res cands) (cdr (assoc res cands)) (read res))) (eval (list (quote setq) sym res))))) (if (boundp sym) nil (set sym nil)) (counsel-read-setq-expression sym))
(let ((sym (intern (ivy-read "Variable: " (counsel-variable-list) :preselect (ivy-thing-at-point) :history (quote counsel-set-variable-history)))) sym-type cands) (if (and (boundp sym) (setq sym-type (get sym (quote custom-type))) (cond ((and (consp sym-type) (memq (car sym-type) (quote ...))) (setq cands (delq nil (mapcar ... ...)))) ((eq sym-type (quote boolean)) (setq cands (quote (... ...)))) (t nil))) (let* ((sym-val (symbol-value sym)) (sym-val-str (replace-regexp-in-string "%" "%%" (format "%s" sym-val))) (res (ivy-read (format "Set (%S <%s>): " sym sym-val-str) cands :preselect (prin1-to-string sym-val)))) (if res (progn (setq res (if (assoc res cands) (cdr ...) (read res))) (eval (list (quote setq) sym res))))) (if (boundp sym) nil (set sym nil)) (counsel-read-setq-expression sym)))
counsel-set-variable()
funcall-interactively(counsel-set-variable)
call-interactively(counsel-set-variable record nil)
command-execute(counsel-set-variable record)
(let ((prefix-arg current-prefix-arg)) (setq real-this-command (setq this-command (intern cmd))) (command-execute (intern cmd) (quote record)))
(closure ((sort) (pred) (cands "toggle-debug-on-error" "auto-insert" "wh/start-tmp-file" "counsel-info-lookup-symbol" "shell-pop" "ielm" "eval-buffer" "racer-describe" "find-library" "ert" "irc" "refine" "lispy-mode" "list-packages" "eshell" "magit-blame" "revert-buffer" "suggest" "ffap" "byte-compile-file" "crux-indent-rigidly-and-copy-to-clipboard" "elisp-refs-function" "indent-buffer" "flycheck-mode" "emr-el-extract-to-let" "exit-recursive-edit" "vr/query-replace" "racer-debug" "flycheck-pkg-config" "company-capf" "fundamental-mode" "xref-find-definitions" "disassemble" "cask-mode" "count-words" "whitespace-mode" "mc/edit-lines" "org-set-property" "markdown-toc-generate-toc" "occur" "paredit-convolute-sexp" "calc" "company-tern" "emr-el-inline-variable" "crux-rename-buffer-and-file" "nameless-mode" "rust-format-buffer" "slime-describe-function" "projectile-regenerate-tags" ...) (initial-input) info-lookup-mode smex-ido-cache t) (cmd) (if (featurep (quote smex)) (progn (smex-rank (intern cmd)))) (let ((prefix-arg current-prefix-arg)) (setq real-this-command (setq this-command (intern cmd))) (command-execute (intern cmd) (quote record))))("counsel-set-variable")
ivy-call()
ivy-read("M-x " ("toggle-debug-on-error" ...)
(let* ((cands obarray) (pred (quote commandp)) (sort t)) (if (require (quote smex) nil (quote noerror)) (progn (if smex-initialized-p nil (smex-initialize)) (smex-detect-new-commands) (smex-update) (setq cands smex-ido-cache) (setq pred nil) (setq sort nil))) (setq this-command last-command) (setq real-this-command real-last-command) (ivy-read (counsel--M-x-prompt) cands :predicate pred :require-match t :history (quote extended-command-history) :action (function (lambda (cmd) (if (featurep (quote smex)) (progn (smex-rank (intern cmd)))) (let ((prefix-arg current-prefix-arg)) (setq real-this-command (setq this-command (intern cmd))) (command-execute (intern cmd) (quote record))))) :sort sort :keymap counsel-describe-map :initial-input initial-input :caller (quote counsel-M-x)))
counsel-M-x()
funcall-interactively(counsel-M-x)
call-interactively(counsel-M-x nil nil)
command-execute(counsel-M-x)
Given the following
defcustom:Setting this with
M-x counsel-set-variablegives the following options:functionis not a correct value for this variable, and choosing any of the other values gives: