I have some experience in Emacs-LISP. Today I spent 6 hours writing LISP code that I guess-timate would have taken 1h30 to write in Python because my workflow to develop and debug is very clunky. In Python I would log successive values with print("Stage N: " + value)
at different stages. I am looking for something better.
I give two examples below. I'm sure other people are more productive given the high reputation of LISP. What workflows do coders use for development and debugging in Emacs-LISP?
One example
Automated testing with ERT does not indicate the line of an error. This is so strange that I made it into its own question).
Another example
In debugging a function with an optional argument, I was unable to log that value to the *Messages*
buffer as I could not find how to convert t
and nil
to string. In the *scratch*
buffer:
(message (concat "Value is: " (string t))) ;; concat: Wrong type argument: characterp, t
(message (concat "Value is: " (string nil))) ;; concat: Wrong type argument: characterp, nil
(message (concat "Value is: " t)) ;; message: Wrong type argument: sequencep, t
(message (concat "Value is: " nil))
"Value is: "
(message "Value is %s" whatever). I suggest
C-h f message`.pdb
. (The last time I was using python, the third-partyipdb
was a much nicer user interface to it.) You can read about the Emacs debuggers (plural) atC-h i g (elisp)Debugging