Skip to content

Commit

Permalink
Merge pull request #438 from david-christiansen/issue/428
Browse files Browse the repository at this point in the history
When Idris returns no proof search, don't delete the metavar
  • Loading branch information
david-christiansen authored Dec 12, 2017
2 parents ee57ccb + 6ba3060 commit 0a5a165
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions idris-commands.el
Original file line number Diff line number Diff line change
Expand Up @@ -741,14 +741,16 @@ prefix argument sets the recursion depth directly."
(when (car what)
(save-excursion (idris-load-file-sync))
(let ((result (car (idris-eval `(:proof-search ,(cdr what) ,(car what) ,hints ,@depth)))))
(save-excursion
(let ((start (progn (search-backward "?") (point)))
(end (progn (forward-char) (search-forward-regexp "[^a-zA-Z0-9_']") (backward-char) (point))))
(delete-region start end))
(insert result))))))
(if (string= result "")
(error "Nothing found")
(save-excursion
(let ((start (progn (search-backward "?") (point)))
(end (progn (forward-char) (search-forward-regexp "[^a-zA-Z0-9_']") (backward-char) (point))))
(delete-region start end))
(insert result)))))))

(defun idris-refine (name)
"Refine by some name, without recursive proof search"
"Refine by some NAME, without recursive proof search."
(interactive "MRefine by: ")
(let ((what (idris-thing-at-point)))
(unless (car what)
Expand Down

0 comments on commit 0a5a165

Please sign in to comment.