diff options
| author | Pierre Courtieu | 2002-06-14 18:20:45 +0000 |
|---|---|---|
| committer | Pierre Courtieu | 2002-06-14 18:20:45 +0000 |
| commit | a638d1ca03da2f564e945ecce472dcd7b5864cac (patch) | |
| tree | f29966af45599af5077bf714c4bbee4e9f72cff5 | |
| parent | 848f9a434391768be475e5b900e7a8232a7b5da9 (diff) | |
Print and Check guess their argument from the region or the string
near the point.
| -rw-r--r-- | coq/coq.el | 16 |
1 files changed, 12 insertions, 4 deletions
@@ -41,8 +41,6 @@ ;; ----- coq specific menu -;; Pierre: I add Print Check and PrintHint -;; maybe Print and Check should be buttons ? (defpgdefault menu-entries '(["Print..." coq-Print t] ["Check..." coq-Check t] @@ -389,12 +387,22 @@ This is specific to coq-mode." "SearchIsos %s.") cmd)))) +(defun coq-guess-or-ask-for-string (s) + (let ((guess + (if (region-exists-p) + (buffer-substring (region-beginning) (region-end)) + (symbol-near-point)))) + (read-string + (if guess (concat s " (" guess "):")(concat s ":")) + nil 'proof-minibuffer-history guess)) + ) + (defun coq-Print () "Ask for an ident and print the corresponding term" (interactive) (let (cmd) (proof-shell-ready-prover) - (setq cmd (read-string "Print: " nil 'proof-minibuffer-history)) + (setq cmd (coq-guess-or-ask-for-string "Print")) (proof-shell-invisible-command (format "Print %s." cmd)))) @@ -403,7 +411,7 @@ This is specific to coq-mode." (interactive) (let (cmd) (proof-shell-ready-prover) - (setq cmd (read-string "Check: " nil 'proof-minibuffer-history)) + (setq cmd (coq-guess-or-ask-for-string "Check")) (proof-shell-invisible-command (format "Check %s." cmd)))) |
