1

I would like create function that ask me how length I want the Pomodoro but it say wrong type argument.

(defun changePomoLength ()
  (interactive)
  (set-variable org-pomodoro-length (read-string "How longth: "))
  )

When I open set-variable function description. it signature is

(set-variable VARIABLE VALUE &optional MAKE-LOCAL)

VALUE is a LISP Object, is string read from (read-string) function not count as LISP object? how to make my string became LISP object?

3

VARIABLE is a variable, that is, a symbol.

Instead of passing a symbol as the first argument, you passed its value.

set-variable is a function, not a macro or special form. It first evaluates each of its arguments, then acts on their values. The first argument you passed is org-pomodoro-length. That is, because the args get evaluated, you passed the value of org-pomodoro-length - which apparently is not a symbol. Hence the error.

This is probably what you wanted - note the quote mark:

(defun changePomoLength ()
  (interactive)
  (set-variable 'org-pomodoro-length (read-string "How longth: ")))
| improve this answer | |
  • this solution work (I try enter 15) but I got another error when running orrg-pomdoro. user-error: Value ‘"15"’ does not match type integer of org-pomodoro-length is this mean that I should not save the variable as string? can you help me again how to save org-pomdoro-length as integer? – Nyamuk Terbang Apr 21 at 11:56
  • Nevermind, I change (read-string) to (read) and it work, thank you very much. – Nyamuk Terbang Apr 21 at 12:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.