all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Problem with native-compilation
@ 2022-03-24 22:17 Jonas Damm
  2022-03-25  7:04 ` Eli Zaretskii
  0 siblings, 1 reply; 11+ messages in thread
From: Jonas Damm @ 2022-03-24 22:17 UTC (permalink / raw)
  To: help-gnu-emacs


Hi,
I compiled Emacs with the native-compilation option. After installing
the org-contacts package from nongnu org-contrib, at first everything
works as expected.

However, after the compiling in the background is done, some functions
are broken:


Warning (comp): org-contacts.el:648:13: Warning: the function ‘start’ is not known to be defined. Disable showing Disable logging
Warning (comp): org-contacts.el:593:12: Warning: the function ‘lexical-let*’ is not known to be defined. Disable showing Disable logging
Warning (comp): org-contacts.el:505:4: Warning: the function ‘list*’ is not known to be defined. Disable showing Disable logging
Warning (comp): org-contacts.el:459:4: Warning: the function ‘lexical-let’ is not known to be defined. Disable showing Disable logging
Warning (comp): org-contacts.el:372:28: Warning: the function ‘values’ is not known to be defined. Disable showing Disable logging
Warning (comp): org-contacts.el:330:44: Warning: the function ‘first’ is not known to be defined. Disable showing Disable logging



After this, message-tab does not work anymore so i can not complete
addresses in mu4e anymore.


Thanks for any help!
Jonas



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

* Re: Problem with native-compilation
  2022-03-24 22:17 Jonas Damm
@ 2022-03-25  7:04 ` Eli Zaretskii
  2022-03-26 13:58   ` Felix Dietrich
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2022-03-25  7:04 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Jonas Damm <emails@jonas-damm.de>
> Date: Thu, 24 Mar 2022 23:17:38 +0100
> 
> I compiled Emacs with the native-compilation option.

Which version of Emacs?

> After installing
> the org-contacts package from nongnu org-contrib, at first everything
> works as expected.
> 
> However, after the compiling in the background is done, some functions
> are broken:
> 
> 
> Warning (comp): org-contacts.el:648:13: Warning: the function ‘start’ is not known to be defined. Disable showing Disable logging
> Warning (comp): org-contacts.el:593:12: Warning: the function ‘lexical-let*’ is not known to be defined. Disable showing Disable logging
> Warning (comp): org-contacts.el:505:4: Warning: the function ‘list*’ is not known to be defined. Disable showing Disable logging
> Warning (comp): org-contacts.el:459:4: Warning: the function ‘lexical-let’ is not known to be defined. Disable showing Disable logging
> Warning (comp): org-contacts.el:372:28: Warning: the function ‘values’ is not known to be defined. Disable showing Disable logging
> Warning (comp): org-contacts.el:330:44: Warning: the function ‘first’ is not known to be defined. Disable showing Disable logging
> 
> 
> 
> After this, message-tab does not work anymore so i can not complete
> addresses in mu4e anymore.

What is org-contacts.el?  I don't see it in Emacs.

From the messages you show, it sounds like org-contacts.el has
problems that are flagged by the native compilation, in particular it
needs to (require 'cl) (for lexical-let*) and probably other packages
to resolve the other "not known to be defined" problems.

You need to be aware that JIT native compilation happens in a separate
pristine Emacs process, which doesn't know about any packages you have
loaded in the process that requests the compilation.  So native
compilation flags any problems caused by compiling a file in "emacs -Q".



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

* Re: Problem with native-compilation
       [not found] <87wngio1qo.fsf@jonas-damm.de>
@ 2022-03-25 10:17 ` Eli Zaretskii
  2022-03-25 10:36   ` Jonas Damm
  0 siblings, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2022-03-25 10:17 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Jonas Damm <emails@jonas-damm.de>
> Date: Fri, 25 Mar 2022 09:49:51 +0100
> 
> I apologize for emailing you directly, it turns out I was not
> subscribed, and did not get any reply from the mailing list.
> 
> I am using emacs 29.0.50.
> 
> org-contacts is part of nongnu contrib these days. The weird thing for
> me is, that it works before the native compilation, but not after.

Because Emacs loads the natively-compiled code, and that code is not
correct because of the problems mentioned in the warnings.

So you (or the maintainer of org-contacts) need to fix the problems
flagged by the native compilation first.



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

* Re: Problem with native-compilation
  2022-03-25 10:17 ` Problem with native-compilation Eli Zaretskii
@ 2022-03-25 10:36   ` Jonas Damm
  2022-03-25 11:24     ` Eli Zaretskii
  2022-03-25 18:01     ` Emanuel Berg via Users list for the GNU Emacs text editor
  0 siblings, 2 replies; 11+ messages in thread
From: Jonas Damm @ 2022-03-25 10:36 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: help-gnu-emacs

Thank you for the insight.

I am willing to try to fix it. I don't know if org-contacts are
maintained anymore.
Could you, (or anyone else) point me to where to start? I can see the
functions mentioned by the error message. Do i need to "import" those
from a different file? I have not much
experience in lisp or emacs in general.

Thanks
Eli Zaretskii writes:

>> From: Jonas Damm <emails@jonas-damm.de>
>> Date: Fri, 25 Mar 2022 09:49:51 +0100
>> 
>> I apologize for emailing you directly, it turns out I was not
>> subscribed, and did not get any reply from the mailing list.
>> 
>> I am using emacs 29.0.50.
>> 
>> org-contacts is part of nongnu contrib these days. The weird thing for
>> me is, that it works before the native compilation, but not after.
>
> Because Emacs loads the natively-compiled code, and that code is not
> correct because of the problems mentioned in the warnings.
>
> So you (or the maintainer of org-contacts) need to fix the problems
> flagged by the native compilation first.




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

* Re: Problem with native-compilation
  2022-03-25 10:36   ` Jonas Damm
@ 2022-03-25 11:24     ` Eli Zaretskii
  2022-03-25 18:01     ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 11+ messages in thread
From: Eli Zaretskii @ 2022-03-25 11:24 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Jonas Damm <emails@jonas-damm.de>
> Cc: help-gnu-emacs@gnu.org
> Date: Fri, 25 Mar 2022 11:36:19 +0100
> 
> Thank you for the insight.
> 
> I am willing to try to fix it. I don't know if org-contacts are
> maintained anymore.
> Could you, (or anyone else) point me to where to start? I can see the
> functions mentioned by the error message. Do i need to "import" those
> from a different file? I have not much
> experience in lisp or emacs in general.

Find out which package(s) need to be loaded before org-contacts so
that the "unknown" functions and variables will be defined, then add
'require' statements for each such package to org-contacts.el.



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

* Re: Problem with native-compilation
  2022-03-25 10:36   ` Jonas Damm
  2022-03-25 11:24     ` Eli Zaretskii
@ 2022-03-25 18:01     ` Emanuel Berg via Users list for the GNU Emacs text editor
  1 sibling, 0 replies; 11+ messages in thread
From: Emanuel Berg via Users list for the GNU Emacs text editor @ 2022-03-25 18:01 UTC (permalink / raw)
  To: help-gnu-emacs

Jonas Damm wrote:

> Thank you for the insight.
>
> I am willing to try to fix it. I don't know if org-contacts
> are maintained anymore. Could you, (or anyone else) point me
> to where to start? I can see the functions mentioned by the
> error message. Do i need to "import" those from a different
> file? I have not much experience in lisp or emacs
> in general.

If you fix it, tell them about it (if you can find them) so
the next person don't have to do the same as you did.

-- 
underground experts united
https://dataswamp.org/~incal




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

* Re: Problem with native-compilation
  2022-03-25  7:04 ` Eli Zaretskii
@ 2022-03-26 13:58   ` Felix Dietrich
  2022-03-26 14:38     ` Eli Zaretskii
  2022-04-03 17:57     ` Jonas Damm
  0 siblings, 2 replies; 11+ messages in thread
From: Felix Dietrich @ 2022-03-26 13:58 UTC (permalink / raw)
  To: help-gnu-emacs

[-- Attachment #1: Type: text/plain, Size: 2592 bytes --]

Eli Zaretskii <eliz@gnu.org> writes:

> What is org-contacts.el?  I don't see it in Emacs.

Itʼs part of org-contrib whose package currently resides here
<https://elpa.nongnu.org/nongnu/org-contrib.html>.  Org-contrib used to
be part of the org-mode repository but was removed with version 9.5.  I
do not know whether it was, together with org-mode, imported into the
Emacs tree.

>> From: Jonas Damm <emails@jonas-damm.de>
>> Date: Thu, 24 Mar 2022 23:17:38 +0100
>
>> After installing
>> the org-contacts package from nongnu org-contrib, at first everything
>> works as expected.
>> 
>> However, after the compiling in the background is done, some functions
>> are broken:
>> 
>> 
>> Warning (comp): org-contacts.el:648:13: Warning: the function ‘start’ is not known to be defined. Disable showing Disable logging
>> Warning (comp): org-contacts.el:593:12: Warning: the function ‘lexical-let*’ is not known to be defined. Disable showing Disable logging
>> Warning (comp): org-contacts.el:505:4: Warning: the function ‘list*’ is not known to be defined. Disable showing Disable logging
>> Warning (comp): org-contacts.el:459:4: Warning: the function ‘lexical-let’ is not known to be defined. Disable showing Disable logging
>> Warning (comp): org-contacts.el:372:28: Warning: the function ‘values’ is not known to be defined. Disable showing Disable logging
>> Warning (comp): org-contacts.el:330:44: Warning: the function ‘first’ is not known to be defined. Disable showing Disable logging
>
> From the messages you show, it sounds like org-contacts.el has
> problems that are flagged by the native compilation, in particular it
> needs to (require 'cl) (for lexical-let*) and probably other packages
> to resolve the other "not known to be defined" problems.

Can or should (require 'cl) be wrapped in a ‘eval-when-compile’?  What
is the state of the cl library?  It is marked as obsolete.  Are there
plans on how long it will be supported?

Anyway, Jonas, attached is a patch that cleans up the compilation errors
and warnings (at least ‘batch-byte-compile’ is satisfied).  If you have
not yet gotten around to it yourself then this might be useful for you.
I did not dispense with ‘lexical-let’ by activating ‘lexical-binding’
because I did not want to read all of the code to see whether
org-contacts makes use of implicitly dynamically bound variables.  The
patch applies to the current master (8c138dc) of the git repository of
the org-contrib package <https://git.sr.ht/~bzg/org-contrib/tree>.


[-- Attachment #2: Patch to clean-up compilation errors in org-contacts.el --]
[-- Type: text/x-diff, Size: 2317 bytes --]

From b4444ae5f46b6edbb9064d2f2be5c4e2e1851948 Mon Sep 17 00:00:00 2001
From: Felix Dietrich <felix.dietrich@sperrhaken.name>
Date: Sat, 26 Mar 2022 13:58:03 +0100
Subject: [PATCH] org-contacts: Fix compilation warnings and erros

---
 lisp/org-contacts.el | 15 ++++++++-------
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/lisp/org-contacts.el b/lisp/org-contacts.el
index 94be38a..2866fff 100644
--- a/lisp/org-contacts.el
+++ b/lisp/org-contacts.el
@@ -62,6 +62,7 @@
 ;;; Code:
 
 (require 'cl-lib)
+(eval-when-compile (require 'cl)) ; for ‘lexical-let’
 (require 'org)
 (require 'gnus-util)
 (require 'gnus-art)
@@ -749,8 +750,8 @@ This function should be called from `gnus-article-prepare-hook'."
       (with-current-buffer (marker-buffer marker)
         (save-excursion
           (goto-char marker)
-          (let* ((org-email-link-description-format (or org-contacts-email-link-description-format
-                                                        org-email-link-description-format))
+          (let* ((org-link-email-description-format (or org-contacts-email-link-description-format
+                                                        org-link-email-description-format))
                  (link (gnus-with-article-buffer (org-store-link nil))))
             (org-set-property org-contacts-last-read-mail-property link)))))))
 
@@ -1169,14 +1170,14 @@ are effectively trimmed).  If nil, all zero-length substrings are retained."
 	     (member (buffer-file-name) (mapcar 'expand-file-name org-contacts-files)))
     (if (bound-and-true-p org-id-link-to-org-use-id)
 	(org-id-store-link)
-      (let ((headline-str (substring-no-properties (org-get-heading t t t t))))
-	(org-store-link-props
+      (let* ((headline-str (substring-no-properties (org-get-heading t t t t)))
+	     (link (concat "org-contact:" headline-str)))
+	(org-link-store-props
 	 :type "org-contact"
 	 :link headline-str
 	 :description headline-str)
-        (setq desc headline-str)
-        (setq link (concat "org-contact:" headline-str))
-        (org-add-link-props :link link :description desc)
+        (org-link-add-props :link link
+			    :description headline-str)
         link))))
 
 (defun org-contacts--all-contacts ()
-- 
2.35.1


[-- Attachment #3: Type: text/plain, Size: 20 bytes --]


-- 
Felix Dietrich

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

* Re: Problem with native-compilation
  2022-03-26 13:58   ` Felix Dietrich
@ 2022-03-26 14:38     ` Eli Zaretskii
  2022-04-04 10:50       ` Felix Dietrich
  2022-04-03 17:57     ` Jonas Damm
  1 sibling, 1 reply; 11+ messages in thread
From: Eli Zaretskii @ 2022-03-26 14:38 UTC (permalink / raw)
  To: help-gnu-emacs

> From: Felix Dietrich <felix.dietrich@sperrhaken.name>
> Date: Sat, 26 Mar 2022 14:58:00 +0100
> 
> Can or should (require 'cl) be wrapped in a ‘eval-when-compile’?

Probably.

> What is the state of the cl library?  It is marked as obsolete.  Are
> there plans on how long it will be supported?

I don't know, but if someone wants to continue using org-contacts, I'd
suggest that they modernize it regardless.  Perhaps switching to
lexical-binding would be the best first step?



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

* Re: Problem with native-compilation
  2022-03-26 13:58   ` Felix Dietrich
  2022-03-26 14:38     ` Eli Zaretskii
@ 2022-04-03 17:57     ` Jonas Damm
  2022-04-04 13:01       ` Felix Dietrich
  1 sibling, 1 reply; 11+ messages in thread
From: Jonas Damm @ 2022-04-03 17:57 UTC (permalink / raw)
  To: Felix Dietrich; +Cc: help-gnu-emacs

Thank you very much.

I am not sure, but your patch seems to have fixed it already.
Here is what i did:

- deleted the old contacts.elc file

- applied your patch to contacts.el

-recompiled with M-x byte-recompile-file

There were no errors except for the 80 Characters Doc warning.
The tab complete function works.


So i guess that was all i needed?

Anyway huge thanks!
Jonas

Felix Dietrich writes:

> Eli Zaretskii <eliz@gnu.org> writes:
>
>> What is org-contacts.el?  I don't see it in Emacs.
>
> Itʼs part of org-contrib whose package currently resides here
> <https://elpa.nongnu.org/nongnu/org-contrib.html>.  Org-contrib used to
> be part of the org-mode repository but was removed with version 9.5.  I
> do not know whether it was, together with org-mode, imported into the
> Emacs tree.
>
>>> From: Jonas Damm <emails@jonas-damm.de>
>>> Date: Thu, 24 Mar 2022 23:17:38 +0100
>>
>>> After installing
>>> the org-contacts package from nongnu org-contrib, at first everything
>>> works as expected.
>>> 
>>> However, after the compiling in the background is done, some functions
>>> are broken:
>>> 
>>> 
>>> Warning (comp): org-contacts.el:648:13: Warning: the function ‘start’ is not known to be defined. Disable showing Disable logging
>>> Warning (comp): org-contacts.el:593:12: Warning: the function ‘lexical-let*’ is not known to be defined. Disable showing Disable logging
>>> Warning (comp): org-contacts.el:505:4: Warning: the function ‘list*’ is not known to be defined. Disable showing Disable logging
>>> Warning (comp): org-contacts.el:459:4: Warning: the function ‘lexical-let’ is not known to be defined. Disable showing Disable logging
>>> Warning (comp): org-contacts.el:372:28: Warning: the function ‘values’ is not known to be defined. Disable showing Disable logging
>>> Warning (comp): org-contacts.el:330:44: Warning: the function ‘first’ is not known to be defined. Disable showing Disable logging
>>
>> From the messages you show, it sounds like org-contacts.el has
>> problems that are flagged by the native compilation, in particular it
>> needs to (require 'cl) (for lexical-let*) and probably other packages
>> to resolve the other "not known to be defined" problems.
>
> Can or should (require 'cl) be wrapped in a ‘eval-when-compile’?  What
> is the state of the cl library?  It is marked as obsolete.  Are there
> plans on how long it will be supported?
>
> Anyway, Jonas, attached is a patch that cleans up the compilation errors
> and warnings (at least ‘batch-byte-compile’ is satisfied).  If you have
> not yet gotten around to it yourself then this might be useful for you.
> I did not dispense with ‘lexical-let’ by activating ‘lexical-binding’
> because I did not want to read all of the code to see whether
> org-contacts makes use of implicitly dynamically bound variables.  The
> patch applies to the current master (8c138dc) of the git repository of
> the org-contrib package <https://git.sr.ht/~bzg/org-contrib/tree>.




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

* Re: Problem with native-compilation
  2022-03-26 14:38     ` Eli Zaretskii
@ 2022-04-04 10:50       ` Felix Dietrich
  0 siblings, 0 replies; 11+ messages in thread
From: Felix Dietrich @ 2022-04-04 10:50 UTC (permalink / raw)
  To: help-gnu-emacs

Eli Zaretskii <eliz@gnu.org> writes:

>> From: Felix Dietrich <felix.dietrich@sperrhaken.name>
>> Date: Sat, 26 Mar 2022 14:58:00 +0100

> I don't know, but if someone wants to continue using org-contacts, I'd
> suggest that they modernize it regardless.  Perhaps switching to
> lexical-binding would be the best first step?

It ainʼt broken yet.  If I continue to use it, Iʼll fix it eventually;
maybe even before it does. ;)

-- 
Felix Dietrich



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

* Re: Problem with native-compilation
  2022-04-03 17:57     ` Jonas Damm
@ 2022-04-04 13:01       ` Felix Dietrich
  0 siblings, 0 replies; 11+ messages in thread
From: Felix Dietrich @ 2022-04-04 13:01 UTC (permalink / raw)
  To: help-gnu-emacs

Jonas Damm <emails@jonas-damm.de> writes:

> Felix Dietrich writes:

>> Jonas Damm <emails@jonas-damm.de> writes:

>>> After installing the org-contacts package from nongnu org-contrib,
>>> at first everything works as expected.
>>> 
>>> However, after the compiling in the background is done, some
>>> functions are broken:
>>>
>>> [error messages at the end bottom of this mail]

>> Jonas, attached is a patch that cleans up the compilation errors and
>> warnings (at least ‘batch-byte-compile’ is satisfied).

> I am not sure, but your patch seems to have fixed it already.
> So i guess that was all i needed?

I think so.

The errors about missing functions were, probably, caused by Emacs not
knowing the ‘lexical-let’ macro because of the missing (require 'cl)
and, thus, misinterpreting the value bindings as function calls.  The
other changes were about fixing assignments to free variables.  I was a
bit lazy in the commit message.

Upon just looking at the compilation messages again for this mail, the
version of “org-contacts” you were using, though, appears to be
different both from the version in, what I believe to be, the current
“org-contrib” [1] repository as well as from the older version I have in
my site-lisp directory: the compilation messages donʼt match – or maybe
this is caused by us using different Emacs versions.  Anyway, if
everything now works for you again, I guess that is alright.

>>> Warning (comp): org-contacts.el:648:13: Warning: the function
>>> ‘start’ is not known to be defined. Disable showing Disable
>>> logging
>>> Warning (comp): org-contacts.el:593:12: Warning: the function
>>> ‘lexical-let*’ is not known to be defined. Disable showing Disable
>>> logging
>>> Warning (comp): org-contacts.el:505:4: Warning: the function
>>> ‘list*’ is not known to be defined. Disable showing Disable
>>> logging
>>> Warning (comp): org-contacts.el:459:4: Warning: the function
>>> ‘lexical-let’ is not known to be defined. Disable showing Disable
>>> logging
>>> Warning (comp): org-contacts.el:372:28: Warning: the function
>>> ‘values’ is not known to be defined. Disable showing Disable
>>> logging
>>> Warning (comp): org-contacts.el:330:44: Warning: the function
>>> ‘first’ is not known to be defined. Disable showing Disable
>>> logging

Footnotes:
[1]  https://git.sr.ht/~bzg/org-contrib

-- 
Felix Dietrich



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

end of thread, other threads:[~2022-04-04 13:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <87wngio1qo.fsf@jonas-damm.de>
2022-03-25 10:17 ` Problem with native-compilation Eli Zaretskii
2022-03-25 10:36   ` Jonas Damm
2022-03-25 11:24     ` Eli Zaretskii
2022-03-25 18:01     ` Emanuel Berg via Users list for the GNU Emacs text editor
2022-03-24 22:17 Jonas Damm
2022-03-25  7:04 ` Eli Zaretskii
2022-03-26 13:58   ` Felix Dietrich
2022-03-26 14:38     ` Eli Zaretskii
2022-04-04 10:50       ` Felix Dietrich
2022-04-03 17:57     ` Jonas Damm
2022-04-04 13:01       ` Felix Dietrich

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.