[PATCH 0/1] Fix ProofGeneral (emacs front-end for Coq)

  • Done
  • quality assurance status badge
Details
3 participants
  • Liliana Marie Prikler
  • Nicolas Goaziou
  • zimoun
Owner
unassigned
Submitted by
zimoun
Severity
normal
Z
Z
zimoun wrote on 10 Nov 2021 20:26
(address . guix-patches@gnu.org)(name . zimoun)(address . zimon.toutoune@gmail.com)
20211110192622.368232-1-zimon.toutoune@gmail.com
Hi,

This is a follow-up of bug#46016 [1] and I think close it.

Now, it is possible to use ProofGeneral as any other Emacs packages. For
instance,

guix shell emacs proof-general coq
emacs foo.v

For now, the dependency of 'coq' is removed as with many Emacs packages.
Other said, the user has to provide such dependency. IMHO, it is the spirit
of such package where the 'prover' is let to the user (several are more or
less supported, see doc [2]).

Cheers,
simon





zimoun (1):
gnu: proof-general: Adjust autoloads for Emacs.

gnu/packages/coq.scm | 85 +++++++++++++++++++++++---------------------
1 file changed, 45 insertions(+), 40 deletions(-)


base-commit: 140b486437670ce95cb24a935b58cba52a9dac31
--
2.33.1
Z
Z
zimoun wrote on 10 Nov 2021 20:37
[PATCH 1/1] gnu: proof-general: Adjust autoloads for Emacs.
(address . 51755@debbugs.gnu.org)(name . zimoun)(address . zimon.toutoune@gmail.com)
20211110193748.368696-1-zimon.toutoune@gmail.com

* gnu/packages/coq.scm (proof-general)[native-inputs]: Remove 'which'.
[inputs]: Remove 'coq' and 'emacs'.
[arguments]<#:make-flags>: Adjust to find 'emacs'.
Set 'ELISP' and 'DEST_LISP'.
<#:modules, #:imported-modules>: Remove.
<#:phases>: Remove call to 'which' in Makefile.
Add copy file allowing Emacs autoloads.
Clean unnecessary code.
---
gnu/packages/coq.scm | 85 +++++++++++++++++++++++---------------------
1 file changed, 45 insertions(+), 40 deletions(-)

Toggle diff (102 lines)
diff --git a/gnu/packages/coq.scm b/gnu/packages/coq.scm
index dccb9bea4c..2cf9d1a602 100644
--- a/gnu/packages/coq.scm
+++ b/gnu/packages/coq.scm
@@ -135,50 +135,55 @@ (define-public proof-general
"00cga3n9nj2xa3ivb0fdkkdx3k11fp4879y188738631yd1x2lsa"))))
(build-system gnu-build-system)
(native-inputs
- `(("which" ,which)
- ("emacs" ,emacs-minimal)
+ `(("emacs" ,emacs-minimal)
("texinfo" ,texinfo)))
(inputs
- `(("host-emacs" ,emacs)
- ("perl" ,perl)
- ("coq" ,coq)))
+ `(("perl" ,perl)))
(arguments
- `(#:tests? #f ; no check target
- #:make-flags (list (string-append "PREFIX=" %output)
- (string-append "DEST_PREFIX=" %output)
- (string-append "ELISP_START=" %output
- "/share/emacs/site-lisp/ProofGeneral"))
- #:modules ((guix build gnu-build-system)
- (guix build utils)
- (guix build emacs-utils))
- #:imported-modules (,@%gnu-build-system-modules
- (guix build emacs-utils))
- #:phases
- (modify-phases %standard-phases
- (delete 'configure)
- (add-after 'unpack 'disable-byte-compile-error-on-warn
- (lambda _
- (substitute* "Makefile"
- (("\\(setq byte-compile-error-on-warn t\\)")
- "(setq byte-compile-error-on-warn nil)"))))
- (add-after 'unpack 'patch-hardcoded-paths
- (lambda* (#:key inputs outputs #:allow-other-keys)
- (let ((out (assoc-ref outputs "out"))
- (coq (assoc-ref inputs "coq"))
- (emacs (assoc-ref inputs "host-emacs")))
+ (let ((base-directory "/share/emacs/site-lisp/ProofGeneral"))
+ `(#:tests? #f ; no check target
+ #:make-flags (list (string-append "PREFIX=" %output)
+ (string-append "EMACS=" (assoc-ref %build-inputs "emacs")
+ "/bin/emacs")
+ (string-append "DEST_PREFIX=" %output)
+ (string-append "ELISP=" %output ,base-directory)
+ (string-append "DEST_ELISP=" %output ,base-directory)
+ (string-append "ELISP_START=" %output ,base-directory))
+ #:phases
+ (modify-phases %standard-phases
+ (delete 'configure)
+ (add-after 'unpack 'disable-byte-compile-error-on-warn
+ (lambda _
+ (substitute* "Makefile"
+ (("\\(setq byte-compile-error-on-warn t\\)")
+ "(setq byte-compile-error-on-warn nil)"))))
+ (add-after 'unpack 'patch-hardcoded-paths
+ (lambda _
+ (substitute* "Makefile"
+ (("/sbin/install-info") "install-info"))))
+ (add-after 'unpack 'remove-which
+ (lambda _
+ (substitute* "Makefile"
+ (("`which perl`") "perl")
+ (("`which bash`") "bash"))))
+ (add-after 'unpack 'clean
+ (lambda _
+ ;; Delete the pre-compiled elc files for Emacs 23.
+ (invoke "make" "clean")))
+ (add-after 'install 'install-doc
+ (lambda* (#:key make-flags #:allow-other-keys)
+ ;; XXX FIXME avoid building/installing pdf files,
+ ;; due to unresolved errors building them.
(substitute* "Makefile"
- (("/sbin/install-info") "install-info")))))
- (add-after 'unpack 'clean
- (lambda _
- ;; Delete the pre-compiled elc files for Emacs 23.
- (invoke "make" "clean")))
- (add-after 'install 'install-doc
- (lambda* (#:key make-flags #:allow-other-keys)
- ;; XXX FIXME avoid building/installing pdf files,
- ;; due to unresolved errors building them.
- (substitute* "Makefile"
- ((" [^ ]*\\.pdf") ""))
- (apply invoke "make" "install-doc" make-flags))))))
+ ((" [^ ]*\\.pdf") ""))
+ (apply invoke "make" "install-doc" make-flags)))
+ (add-after 'install 'allow-subfolders-autoloads
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((out (assoc-ref outputs "out")))
+ ;; Make it visible by Emacs
+ (copy-file "proof-general.el"
+ (string-append out ,base-directory
+ "/proof-general-autoloads.el")))))))))
(home-page "https://proofgeneral.github.io/")
(synopsis "Generic front-end for proof assistants based on Emacs")
(description
--
2.33.1
Z
Z
zimoun wrote on 19 Nov 2021 13:27
Re: [bug#51755] [PATCH 0/1] Fix ProofGeneral (emacs front-end for Coq)
(address . 51755@debbugs.gnu.org)
86czmwgwke.fsf@gmail.com
Hi Coq or Emacs reviewers,

On Wed, 10 Nov 2021 at 20:26, zimoun <zimon.toutoune@gmail.com> wrote:

Toggle quote (16 lines)
> This is a follow-up of bug#46016 [1] and I think close it.
>
> Now, it is possible to use ProofGeneral as any other Emacs packages. For
> instance,
>
> guix shell emacs proof-general coq
> emacs foo.v
>
> For now, the dependency of 'coq' is removed as with many Emacs packages.
> Other said, the user has to provide such dependency. IMHO, it is the spirit
> of such package where the 'prover' is let to the user (several are more or
> less supported, see doc [2]).
>
> 1: <http://issues.guix.gnu.org/issue/46016>
> 2: <https://proofgeneral.github.io/doc/master/userman/Introducing-Proof-General/#Supported-proof-assistants>

Friendly ping. :-)


Cheers,
simon
N
N
Nicolas Goaziou wrote on 21 Nov 2021 19:40
Re: [bug#51755] [PATCH 1/1] gnu: proof-general: Adjust autoloads for Emacs.
(name . zimoun)(address . zimon.toutoune@gmail.com)(address . 51755@debbugs.gnu.org)
8735npwdvr.fsf@nicolasgoaziou.fr
Hello,

zimoun <zimon.toutoune@gmail.com> writes:

Toggle quote (9 lines)
> * gnu/packages/coq.scm (proof-general)[native-inputs]: Remove 'which'.
> [inputs]: Remove 'coq' and 'emacs'.
> [arguments]<#:make-flags>: Adjust to find 'emacs'.
> Set 'ELISP' and 'DEST_LISP'.
> <#:modules, #:imported-modules>: Remove.
> <#:phases>: Remove call to 'which' in Makefile.
> Add copy file allowing Emacs autoloads.
> Clean unnecessary code.

Thanks.

Toggle quote (8 lines)
> + (add-after 'install 'allow-subfolders-autoloads
> + (lambda* (#:key outputs #:allow-other-keys)
> + (let ((out (assoc-ref outputs "out")))
> + ;; Make it visible by Emacs
> + (copy-file "proof-general.el"
> + (string-append out ,base-directory
> + "/proof-general-autoloads.el")))))))))

So, IIUC, the above is basically a hack: you disguise the main file into
an autoloads file because no autoloads file is generated from the code
base? If so, this might deserve a longer comment, IMO.

Otherwise, LGTM.

Regards,
--
Nicolas Goaziou
L
L
Liliana Marie Prikler wrote on 21 Nov 2021 20:07
(address . 51755@debbugs.gnu.org)
6aab24bab9512e0957e33256a3addf1076a9d012.camel@gmail.com
Hi,

Am Sonntag, den 21.11.2021, 19:40 +0100 schrieb Nicolas Goaziou:
Toggle quote (12 lines)
> > + (add-after 'install 'allow-subfolders-autoloads
> > + (lambda* (#:key outputs #:allow-other-keys)
> > + (let ((out (assoc-ref outputs "out")))
> > + ;; Make it visible by Emacs
> > + (copy-file "proof-general.el"
> > + (string-append out ,base-directory
> > + "/proof-general-
> > autoloads.el")))))))))
>
> So, IIUC, the above is basically a hack: you disguise the main file
> into an autoloads file because no autoloads file is generated from
> the code base? If so, this might deserve a longer comment, IMO.
On a related note, what would be so bad about having to (require
'proof-general) interactively? Alternatively, we could in an after-
unpack phase add autoload cookies to the source file or write our own
autoloads altogether. WDYT?
N
N
Nicolas Goaziou wrote on 21 Nov 2021 21:15
(name . Liliana Marie Prikler)(address . liliana.prikler@gmail.com)
87y25huuxp.fsf@nicolasgoaziou.fr
Hello,

Liliana Marie Prikler <liliana.prikler@gmail.com> writes:

Toggle quote (6 lines)
> Am Sonntag, den 21.11.2021, 19:40 +0100 schrieb Nicolas Goaziou:

>> So, IIUC, the above is basically a hack: you disguise the main file
>> into an autoloads file because no autoloads file is generated from
>> the code base? If so, this might deserve a longer comment, IMO.

Actually, my assumption was wrong. "proof-general.el" is
a meta-autoloads file:

;; This file is a thin, package.el-friendly wrapper around generic/proof-site,
;; suitable for execution on Emacs start-up. It serves two purposes:
;;
;; * Setting up the load path when byte-compiling PG.
;; * Loading a minimal PG setup on startup (not all of Proof General, of course;
;; mostly mode hooks and autoloads).

Toggle quote (3 lines)
> On a related note, what would be so bad about having to (require
> 'proof-general) interactively?

When not byte compiled, the file only does

(require 'proof-site (expand-file-name "generic/proof-site" pg-init--pg-root)))

I guess we could also provide a single autoloads file doing just that
or, according to the manual,

(load "PROOF-GENERAL-HOME/generic/proof-site.el")

Toggle quote (4 lines)
> Alternatively, we could in an after-
> unpack phase add autoload cookies to the source file or write our own
> autoloads altogether. WDYT?

Autoload cookies are already present in the code base, but in
sub-directories.

OTOH, I assume the solution proposed by Zimoun, as hackish as it is,
works well enough. And it requires less work. IMO, it is acceptable with
a good comment.

Regards,
--
Nicolas Goaziou
Z
Z
zimoun wrote on 21 Nov 2021 22:11
(address . 51755@debbugs.gnu.org)
86bl2dfc2p.fsf@gmail.com
Hi,

Thanks for the review.


On Sun, 21 Nov 2021 at 21:15, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
Toggle quote (17 lines)
> Liliana Marie Prikler <liliana.prikler@gmail.com> writes:
>> Am Sonntag, den 21.11.2021, 19:40 +0100 schrieb Nicolas Goaziou:

>>> So, IIUC, the above is basically a hack: you disguise the main file
>>> into an autoloads file because no autoloads file is generated from
>>> the code base? If so, this might deserve a longer comment, IMO.
>
> Actually, my assumption was wrong. "proof-general.el" is
> a meta-autoloads file:
>
> ;; This file is a thin, package.el-friendly wrapper around generic/proof-site,
> ;; suitable for execution on Emacs start-up. It serves two purposes:
> ;;
> ;; * Setting up the load path when byte-compiling PG.
> ;; * Loading a minimal PG setup on startup (not all of Proof General, of course;
> ;; mostly mode hooks and autoloads).

Yes. Note that ’proof-general’ was at one moment in its long history a
standalone package, i.e., running ’bin/proofgeneneral’ started Emacs and
launched everything. This had been removed long time ago [1] but the
current code inherits this long history.



Toggle quote (7 lines)
>> Alternatively, we could in an after-
>> unpack phase add autoload cookies to the source file or write our own
>> autoloads altogether. WDYT?
>
> Autoload cookies are already present in the code base, but in
> sub-directories.

Yes. The limitation comes from this subdirectory structure. This
breaks the usual way of packaging Emacs tools for Guix, IIUC.


Toggle quote (4 lines)
> OTOH, I assume the solution proposed by Zimoun, as hackish as it is,
> works well enough. And it requires less work. IMO, it is acceptable with
> a good comment.

From my point of view, my proposed patch appears to me the easiest fix.
If something is better, please let me know. :-)


About the comment, I thought « allow-subfolders-autoloads » and « Make
it visible by Emacs » would have been enough. ;-)

Toggle snippet (7 lines)
(add-after 'install 'allow-subfolders-autoloads
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
;; Make it visible by Emacs


Instead, I propose to extend to:

Toggle snippet (17 lines)
(add-after 'install 'allow-subfolders-autoloads
;; Autoload cookies are present in sub-directories. A friendly
;; wrapper proof-general.el around generic/proof-site.el is
;; provided for execution on Emacs start-up. It serves two
;; purposes:
;; * Setting up the load path when byte-compiling pg.
;; * Loading a minimal PG setup on startup (not all of Proof
;; General, of course;mostly mode hooks and autoloads).
;; The rename to proof-general-autoloads.el is Guix specific.
(lambda* (#:key outputs #:allow-other-keys)
(let ((out (assoc-ref outputs "out")))
(copy-file "proof-general.el"
(string-append out ,base-directory
"/proof-general-autoloads.el")))))))))


Is it fine? If yes, I can send* a v2. Or please push directly. :-)



Cheers,
simon

*send v2: for the record, I do not have commit right. ;-)
N
N
Nicolas Goaziou wrote on 22 Nov 2021 19:22
(name . zimoun)(address . zimon.toutoune@gmail.com)
87r1b8t5hs.fsf@nicolasgoaziou.fr
Hello,

zimoun <zimon.toutoune@gmail.com> writes:

Toggle quote (22 lines)
> Instead, I propose to extend to:
>
> --8<---------------cut here---------------start------------->8---
> (add-after 'install 'allow-subfolders-autoloads
> ;; Autoload cookies are present in sub-directories. A friendly
> ;; wrapper proof-general.el around generic/proof-site.el is
> ;; provided for execution on Emacs start-up. It serves two
> ;; purposes:
> ;; * Setting up the load path when byte-compiling pg.
> ;; * Loading a minimal PG setup on startup (not all of Proof
> ;; General, of course;mostly mode hooks and autoloads).
> ;; The rename to proof-general-autoloads.el is Guix specific.
> (lambda* (#:key outputs #:allow-other-keys)
> (let ((out (assoc-ref outputs "out")))
> (copy-file "proof-general.el"
> (string-append out ,base-directory
> "/proof-general-autoloads.el")))))))))
> --8<---------------cut here---------------end--------------->8---
>
>
> Is it fine? If yes, I can send* a v2. Or please push directly. :-)

I pushed it directly. Thank you!

Regards,
--
Nicolas Goaziou
Closed
Z
Z
zimoun wrote on 21 Nov 2021 23:17
(name . Nicolas Goaziou)(address . mail@nicolasgoaziou.fr)
86ee79xieu.fsf@gmail.com
Hi Nicolas,

On Mon, 22 Nov 2021 at 19:22, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:

Toggle quote (2 lines)
> I pushed it directly. Thank you!

Thank you.

Cheers,
simon
Closed
?
Your comment

This issue is archived.

To comment on this conversation send an email to 51755@debbugs.gnu.org

To respond to this issue using the mumi CLI, first switch to it
mumi current 51755
Then, you may apply the latest patchset in this issue (with sign off)
mumi am -- -s
Or, compose a reply to this issue
mumi compose
Or, send patches to this issue
mumi send-email *.patch