This Worked for me. I have shown the entire process from nothing to getting Coq and configuring Proof General.
If you want to use Proof-General for Coq, first install Coq or anything that you want to use proof-general for.
I wanted to use it for Coq, so I installed Coq first.
1) Install Coq ->
brew install coq
(for macOS)
Get Emacs.app from https://emacsformacosx.com and install the application by dragging the icon into the Applications folder.
Follow the instructions for installing the Emacs Proof General extension via the MELPA package manager for Emacs or via Git.
2) Install Proof General ->
Using MELPA (recommended procedure)
MELPA is a repository of Emacs packages. Skip this step if you already use MELPA. Otherwise, add the following to your .emacs and restart Emacs:
(require 'package)
(let* ((no-ssl (and (memq system-type '(windows-nt ms-dos))
(not (gnutls-available-p))))
(proto (if no-ssl "http" "https")))
(add-to-list 'package-archives
(cons "melpa" (concat proto "://melpa.org/packages/")) t))
(package-initialize)
Note: If you switch to MELPA from a previously manually-installed Proof General, make sure you removed the old versions of Proof General from your Emacs context (by removing from your .emacs the line loading PG/generic/proof-site, or by uninstalling the proofgeneral package provided by your OS package manager).
Then, run M-x package-refresh-contents RET followed by M-x package-install RET proof-general RET to install and byte-compile proof-general.
You can now open a Coq file (.v), an EasyCrypt file (.ec), or a PhoX file (.phx) to automatically load the corresponding major mode.
Using Git (manual compilation procedure)
Remove old versions of Proof General, clone the PG repo from GitHub and byte-compile the sources:
git clone https://github.com/ProofGeneral/PG ~/.emacs.d/lisp/PG
cd ~/.emacs.d/lisp/PG
make
Then add the following to your .emacs:
;; Open .v files with Proof General's Coq mode
(load "~/.emacs.d/lisp/PG/generic/proof-site")
If Proof General complains about a version mismatch, make sure that the shell's emacs is indeed your usual Emacs. If not, run the Makefile again with an explicit path to Emacs. On macOS in particular you'll probably need something like
make clean; make EMACS=/Applications/Emacs.app/Contents/MacOS/Emacs
3) Add the following lines to your ~/.emacs file:
;; Make sure we can find coqtop
(setq exec-path (append exec-path '("/usr/local/bin")))
4) Add this to your .emacs
(custom-set-variables '(coq-prog-name "PATH/TO/coqtop") '(proof-three-window-enable t))
in case you can't find out your .emacs file, check this out. In my case I had to create a new .emacs file in my home directory.
(require '....)
. So long as the library is in your load path, and so long as it has a statement like(provide '...)
, then that is usually sufficient to resolve load issues.which cotop
(assuming you have it installed) and then adding this(setq coq-prog-name “/usr/bin/coqtop -emacs”)
to your.emacs
file? Of course use your path. Btw, this link is useful: coq.discourse.group/t/coqtop-not-found/856/9-emacs
in coq-prog-name