Skip to content

Commit

Permalink
syntax error in rustic-cargo-add with prefix argument
Browse files Browse the repository at this point in the history
Original description by @sigvei in brotzeit/rustic#536:

rustic-cargo-add with a prefix command called read-from-minibuffer with erroneous arguments.

The current master produces this error message:

funcall-interactively: Wrong type argument: keymapp, " add "

This is due to the line (read-from-minibuffer "Cargo add command: " (rustic-cargo-bin) " add "), which makes " add " a third argument to read-from-minibuffer. I guess it's suppose to just be concated with rustic-cargo-bin.

This commit implements that and also DRY's the code by storing the base command in a let binding.
  • Loading branch information
CeleritasCelery committed May 17, 2024
1 parent 7e51d36 commit 7e54b04
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions rustic-cargo.el
Original file line number Diff line number Diff line change
Expand Up @@ -748,11 +748,10 @@ The documentation is built if necessary."
"Add crate to Cargo.toml using 'cargo add'.
If running with prefix command `C-u', read whole command from minibuffer."
(interactive "P")
(let* ((command (if arg
(read-from-minibuffer "Cargo add command: "
(rustic-cargo-bin) " add ")
(concat (rustic-cargo-bin) " add "
(read-from-minibuffer "Crate: ")))))
(let* ((base (concat (rustic-cargo-bin) " add "))
(command (if arg
(read-from-minibuffer "Cargo add command: " base)
(concat base (read-from-minibuffer "Crate: ")))))
(rustic-run-cargo-command command)))

(defun rustic-cargo-add-missing-dependencies (&optional arg)
Expand Down

0 comments on commit 7e54b04

Please sign in to comment.