-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix byte-compilation problems #643
Conversation
One idea for solving the compilation errors would be to merge the Emacs 25 & 26 files into a single .el file. The only solution I can see at the moment is to disable the compilation of the code completely (wrapping everything in Emacs macro @erikmd mentions |
To suggest a slightly different idea using cf. https://www.gnu.org/software/emacs/manual/html_node/elisp/Eval-During-Compile.html
So my suggestion would be to: Enclose the forms of
|
I just realized what @erikmd means. There is already an EDIT: This was written before seeing the preceding message by @erikmd. So "@erikmd means" refers to #636 (comment) |
Any ideas? Otherwise I will go with the |
Slightly related: I saw this in
Here |
could you try again with something like because just to recall, false is a truthy value (everything ≠ |
Good question. Actually this code had been devised by @cpitclaudel so he'd certainly summarize this much better than me But in any case, |
|
@dominique-unruh you may want to test and integrate the patch suggested in the other PR: Thanks a lot @monnier for your input ! 👍 |
Checks fail after 6cf7d1d but this is positive: It means the |
Question: Where should I add my test case? @erikmd I created a test case to see whether qrhl-input loads correctly on all Emacses (especially because I don't have an Emacs 25 instance). I put it in ci/simple-tests because that sounded logical. But in CI, simple-tests are only tested with a single Emacs (but with many coqs). It seems the tests in PS: The test case is currently intentionally broken to check whether testing occurs. |
692ef05
to
876629e
Compare
Hi @dominique-unruh, thanks for your question!
You precisely pinpointed a limitation of the current CI that we are currently working on with @hendriktews; So I'd suggest that:
|
@erikmd Just adding to simple-tests is not enough because this specific issue needs testing in different Emacs versions (because the code is different in Emacs 25 and Emacs 26.) And I don't have Emacs 25 available for testing locally. So what I did as a stopgap is to include the test in simple-tests, but to add it in test test-indent job in test.yml. (See 876629e) A bit untidy, but until you decide how to structure the tests, it will do. Now I can continue to fix the issues in this pull request. |
@dominique-unruh OK, LGTM! thank you |
@monnier I have not included the patch for My main problem is |
My main problem is `qrhl-input.el`: I also incorporated your patch there
(b1e3780) but it does not work. Compilation on Emacs 25 still fails (see the
CI). I do not understand enough Elisp-magic to figure out what needs to be
done to make it work the same as in `qrhl-input-25.el`. Can you help with
this one?
The patch below seems like a better option, tho: it doesn't just make it
so `qrhl-input.el` can be uselessly compiled on Emacs-25, but makes
`qrhl-input.el` actually work correctly under Emacs-25, so we can get
rid of `qrhl-input-25.el`.
Stefan
diff --git a/qrhl/qrhl-input.el b/qrhl/qrhl-input.el
index 8cc520425c..49c16d4880 100644
--- a/qrhl/qrhl-input.el
+++ b/qrhl/qrhl-input.el
@@ -1,8 +1,7 @@
-;;; qrhl-input.el --- Quail package for TeX-style input for qrhl-tool in ProofGeneral -*-coding: utf-8;-*-
+;;; qrhl-input.el --- Quail package for TeX-style input for qrhl-tool in ProofGeneral -*- lexical-binding: t -*-
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
-;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-;; 2010, 2011
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2011
;; National Institute of Advanced Industrial Science and Technology (AIST)
;; Registration Number H14PRO021
;; Copyright (C) 2017-2022 University of Tartu
@@ -28,9 +27,6 @@
;;; Code:
-(if (version< emacs-version "26")
- (error "Emacs version >= 26 required"))
-
(require 'quail)
(quail-define-package
@@ -71,22 +71,28 @@
(pcase rule
(`(,_ ,(pred characterp)) (push rule newrules)) ;; Normal quail rule.
(`(,seq ,re)
- (let ((count 0)
- (re (eval re t)))
- (maphash
+ (let* ((count 0)
+ (re (eval re t))
+ (ucs-names (ucs-names))
+ (process-one-entry
(lambda (name char)
(when (and (characterp char) ;; Ignore char-ranges.
(string-match re name))
(let ((keys (if (stringp seq)
(replace-match seq nil nil name)
- (funcall seq name char))))
+ (funcall (eval seq t) name char))))
(if (listp keys)
(dolist (x keys)
(setq count (1+ count))
(push (list x char) newrules))
(setq count (1+ count))
- (push (list keys char) newrules)))))
- (ucs-names))
+ (push (list keys char) newrules)))))))
+ ;; Emacs-25's `ucs-names' returned an alist rather than a hash
+ ;; table and that changed to a hash-table in Emacs-26.
+ (if (hash-table-p ucs-names)
+ (maphash process-one-entry ucs-names)
+ (dolist (pair ucs-names)
+ (funcall process-one-entry (car pair) (cdr pair))))
;; (message "qrhl-input: %d mappings for %S" count re)
))))
(setq newrules (delete-dups newrules))
|
b1e3780
to
2fb2fe0
Compare
The first was accidentally removed in 847492f. The second is necessary running PG from byte-compiled code. Otherwise we get the error `byte-code: Symbol’s function definition is void: proof-easy-config-check-setup` when loading PG with prover qrhl. Surprisingly, the error does not occur when PG is not byte-compiled.
(Based on patch by @monnier)
2fb2fe0
to
07e6b0d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Many thanks @dominique-unruh for this very tidy fixup PR.
@erikmd The new version is already on MELPA and I verified that it now installs fine (in Emacs 27.1). :) |
Dominique Unruh [2022-03-10 07:41:19] wrote:
@erikmd The new version is already on MELPA and I verified that it now
installs fine (in Emacs 27.1). :)
Yay! Thanks!
|
I have not included the patch for `proof-easy-config.el` because I am not
sure what it does (the problem related to easy-config was resolved by
`(require proof-easy-config)`) and because it also got corrupted by
copy-and-pasting it into the comment. (The line containing `***@***.***`)
`proof-easy-config` is an autoloaded macro, so it is obviously intended
to be used without having to `require` first. But it expands to code
which calls functions from that same file and those functions aren't
autoloaded, so currently if you take advantage of the autoload (like
you did) you have a bug.
We can either decide that users of `proof-easy-config` need to
explicitly `require`, and then we can stop autoloading the macro (the
best option, in my opinion), or we can change `proof-easy-config` so it
makes sure the functions used in the expansion will be available (either
by including a `require` in the output, like my patch does, or by
additionally autoloading those functions).
My main problem is `qrhl-input.el`: I also incorporated your patch there
(b1e3780) but it does not work. Compilation on Emacs 25 still fails (see the
CI).
Oh, I didn't think about the case where we compile with Emacs-25.
The patch below might fix it.
Stefan
diff --git a/qrhl/qrhl-input.el b/qrhl/qrhl-input.el
index 8cc520425c..c051b09c93 100644
--- a/qrhl/qrhl-input.el
+++ b/qrhl/qrhl-input.el
@@ -1,8 +1,7 @@
-;;; qrhl-input.el --- Quail package for TeX-style input for qrhl-tool in ProofGeneral -*-coding: utf-8;-*-
+;;; qrhl-input.el --- Quail package for TeX-style input for qrhl-tool in ProofGeneral -*- lexical-binding: t; -*-
-;; Copyright (C) 2001-2018 Free Software Foundation, Inc.
-;; Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-;; 2010, 2011
+;; Copyright (C) 2001-2022 Free Software Foundation, Inc.
+;; Copyright (C) 2001-2011
;; National Institute of Advanced Industrial Science and Technology (AIST)
;; Registration Number H14PRO021
;; Copyright (C) 2017-2022 University of Tartu
@@ -72,21 +72,25 @@
(`(,_ ,(pred characterp)) (push rule newrules)) ;; Normal quail rule.
(`(,seq ,re)
(let ((count 0)
- (re (eval re t)))
+ (re (eval re t))
+ (ucs-names (ucs-names)))
+ ;; Emacs-25's `ucs-names' returned an alist rather than a hash
+ ;; table.
+ (when (hash-table-p ucs-names)
(maphash
(lambda (name char)
(when (and (characterp char) ;; Ignore char-ranges.
(string-match re name))
(let ((keys (if (stringp seq)
(replace-match seq nil nil name)
- (funcall seq name char))))
+ (funcall (eval seq t) name char))))
(if (listp keys)
(dolist (x keys)
(setq count (1+ count))
(push (list x char) newrules))
(setq count (1+ count))
(push (list keys char) newrules)))))
- (ucs-names))
+ ucs-names))
;; (message "qrhl-input: %d mappings for %S" count re)
))))
(setq newrules (delete-dups newrules))
|
@monnier |
The current MELPA version does not work properly:
byte-code: Symbol’s function definition is void: proof-easy-config-check-setup
Seems solved by 124db99qrhl-input-25.el
in Emacs 26+ (and vice verse forqrhl-input.el
) even though will never be included.