Skip to content

Commit

Permalink
Validate the response.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesse Alama committed Jan 21, 2013
1 parent 7d2decd commit 11002ad
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions ce-dash.el
Expand Up @@ -577,8 +577,11 @@ an edited copy of STRING."
(string= response "E"))
(read-from-minibuffer "" string)
(let ((n (string-to-number response)))
(let ((dash-fixer (nth (1- n) fixers)))
(funcall (oref dash-fixer fixer) string occurrence)))))))
(if (and (positivep n)
(< n (length fixers)))
(let ((dash-fixer (nth (1- n) fixers)))
(funcall (oref dash-fixer fixer) string occurrence))
(message "Invalid response (%s).%c%cEnter a number between 1 and %d, or 'e' to edit the current string." response ?\n ?\n (length fixers))))))))
(let ((dash-fixer (first fixers)))
(funcall (oref dash-fixer fixer) string occurrence))))))

Expand Down

0 comments on commit 11002ad

Please sign in to comment.