unofficial mirror of guix-patches@gnu.org 
 help / color / mirror / Atom feed
* [bug#51755] [PATCH 0/1] Fix ProofGeneral (emacs front-end for Coq)
@ 2021-11-10 19:26 zimoun
  2021-11-10 19:37 ` [bug#51755] [PATCH 1/1] gnu: proof-general: Adjust autoloads for Emacs zimoun
  2021-11-19 12:27 ` [bug#51755] [PATCH 0/1] Fix ProofGeneral (emacs front-end for Coq) zimoun
  0 siblings, 2 replies; 9+ messages in thread
From: zimoun @ 2021-11-10 19:26 UTC (permalink / raw)
  To: 51755; +Cc: zimoun

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



1: <http://issues.guix.gnu.org/issue/46016>
2: <https://proofgeneral.github.io/doc/master/userman/Introducing-Proof-General/#Supported-proof-assistants>


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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#51755] [PATCH 1/1] gnu: proof-general: Adjust autoloads for Emacs.
  2021-11-10 19:26 [bug#51755] [PATCH 0/1] Fix ProofGeneral (emacs front-end for Coq) zimoun
@ 2021-11-10 19:37 ` zimoun
  2021-11-21 18:40   ` Nicolas Goaziou
  2021-11-19 12:27 ` [bug#51755] [PATCH 0/1] Fix ProofGeneral (emacs front-end for Coq) zimoun
  1 sibling, 1 reply; 9+ messages in thread
From: zimoun @ 2021-11-10 19:37 UTC (permalink / raw)
  To: 51755; +Cc: zimoun

Fixes <https://bugs.gnu.org/46016>.

* 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(-)

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





^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#51755] [PATCH 0/1] Fix ProofGeneral (emacs front-end for Coq)
  2021-11-10 19:26 [bug#51755] [PATCH 0/1] Fix ProofGeneral (emacs front-end for Coq) zimoun
  2021-11-10 19:37 ` [bug#51755] [PATCH 1/1] gnu: proof-general: Adjust autoloads for Emacs zimoun
@ 2021-11-19 12:27 ` zimoun
  1 sibling, 0 replies; 9+ messages in thread
From: zimoun @ 2021-11-19 12:27 UTC (permalink / raw)
  To: 51755; +Cc: Julien Lepiller, Nicolas Goaziou

Hi Coq or Emacs reviewers,

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

> 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




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#51755] [PATCH 1/1] gnu: proof-general: Adjust autoloads for Emacs.
  2021-11-10 19:37 ` [bug#51755] [PATCH 1/1] gnu: proof-general: Adjust autoloads for Emacs zimoun
@ 2021-11-21 18:40   ` Nicolas Goaziou
  2021-11-21 19:07     ` Liliana Marie Prikler
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2021-11-21 18:40 UTC (permalink / raw)
  To: zimoun; +Cc: 51755

Hello,

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

> * 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.

> +             (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




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#51755] [PATCH 1/1] gnu: proof-general: Adjust autoloads for Emacs.
  2021-11-21 18:40   ` Nicolas Goaziou
@ 2021-11-21 19:07     ` Liliana Marie Prikler
  2021-11-21 20:15       ` Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: Liliana Marie Prikler @ 2021-11-21 19:07 UTC (permalink / raw)
  To: Nicolas Goaziou, zimoun; +Cc: 51755

Hi,

Am Sonntag, den 21.11.2021, 19:40 +0100 schrieb Nicolas Goaziou:
> > +             (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?





^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#51755] [PATCH 1/1] gnu: proof-general: Adjust autoloads for Emacs.
  2021-11-21 19:07     ` Liliana Marie Prikler
@ 2021-11-21 20:15       ` Nicolas Goaziou
  2021-11-21 21:11         ` zimoun
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2021-11-21 20:15 UTC (permalink / raw)
  To: Liliana Marie Prikler; +Cc: 51755, zimoun

Hello,

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).

> 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")

> 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




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#51755] [PATCH 1/1] gnu: proof-general: Adjust autoloads for Emacs.
  2021-11-21 20:15       ` Nicolas Goaziou
@ 2021-11-21 21:11         ` zimoun
  2021-11-22 18:22           ` bug#51755: " Nicolas Goaziou
  0 siblings, 1 reply; 9+ messages in thread
From: zimoun @ 2021-11-21 21:11 UTC (permalink / raw)
  To: Nicolas Goaziou, Liliana Marie Prikler; +Cc: 51755

Hi,

Thanks for the review.


On Sun, 21 Nov 2021 at 21:15, Nicolas Goaziou <mail@nicolasgoaziou.fr> wrote:
> 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.

1: <https://github.com/ProofGeneral/PG/commit/1a18e33658645a81225c56b5d4f4a4b89434d301>


>> 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.


> 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. ;-)

--8<---------------cut here---------------start------------->8---
             (add-after 'install 'allow-subfolders-autoloads
               (lambda* (#:key outputs #:allow-other-keys)
                 (let ((out (assoc-ref outputs "out")))
                   ;; Make it visible by Emacs
--8<---------------cut here---------------end--------------->8---


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. :-)



Cheers,
simon

*send v2: for the record, I do not have commit right. ;-)




^ permalink raw reply	[flat|nested] 9+ messages in thread

* [bug#51755] [PATCH 1/1] gnu: proof-general: Adjust autoloads for Emacs.
  2021-11-22 18:22           ` bug#51755: " Nicolas Goaziou
@ 2021-11-21 22:17             ` zimoun
  0 siblings, 0 replies; 9+ messages in thread
From: zimoun @ 2021-11-21 22:17 UTC (permalink / raw)
  To: Nicolas Goaziou; +Cc: 51755-done, Liliana Marie Prikler

Hi Nicolas,

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

> I pushed it directly. Thank you!

Thank you.

Cheers,
simon




^ permalink raw reply	[flat|nested] 9+ messages in thread

* bug#51755: [PATCH 1/1] gnu: proof-general: Adjust autoloads for Emacs.
  2021-11-21 21:11         ` zimoun
@ 2021-11-22 18:22           ` Nicolas Goaziou
  2021-11-21 22:17             ` [bug#51755] " zimoun
  0 siblings, 1 reply; 9+ messages in thread
From: Nicolas Goaziou @ 2021-11-22 18:22 UTC (permalink / raw)
  To: zimoun; +Cc: 51755-done, Liliana Marie Prikler

Hello,

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

> 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




^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2021-11-22 21:54 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 19:26 [bug#51755] [PATCH 0/1] Fix ProofGeneral (emacs front-end for Coq) zimoun
2021-11-10 19:37 ` [bug#51755] [PATCH 1/1] gnu: proof-general: Adjust autoloads for Emacs zimoun
2021-11-21 18:40   ` Nicolas Goaziou
2021-11-21 19:07     ` Liliana Marie Prikler
2021-11-21 20:15       ` Nicolas Goaziou
2021-11-21 21:11         ` zimoun
2021-11-22 18:22           ` bug#51755: " Nicolas Goaziou
2021-11-21 22:17             ` [bug#51755] " zimoun
2021-11-19 12:27 ` [bug#51755] [PATCH 0/1] Fix ProofGeneral (emacs front-end for Coq) zimoun

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).