Hi Ihor,

Thanks for the feedback! I'm attaching a unified patch.

TODO: check that the emacs installed supports native compilation. This is
more for
make native.

Best, /PA


On Wed, 13 Mar 2024 at 13:46, Ihor Radchenko <yanta...@posteo.net> wrote:

> Pedro Andres Aranda Gutierrez <paag...@gmail.com> writes:
>
> >> I have been experiencing some inconsistencies with org-mode, which I
> >> have been able to trace own to using native compilation and not knowing
> >> where the files from main were.
>
> Thanks for the patch!
> See my comments inline.
>
> > +# This is where Emacs stores the .eln files
> > +ELNDIR        = $(shell emacs --batch --eval '(princ (car
> native-comp-eln-load-path))')
>
> Please use $(EMACS).
>
> > +cleaneln::
> > +     for elnf in $(patsubst %.eln, %-*.eln, $(LISPN)); do \
> > +       find $(ELNDIR) -name $$elnf -exec $(RM) -v {} \; ;\
> > +     done
>
> $(FIND).
> Also, avoid using bash as much as possible in favor or GNU make
> constructs. You can use $(foreach ...) here.
>
> >  clean-install:
> >       if [ -d $(DESTDIR)$(lispdir) ] ; then \
> >         $(RM) $(DESTDIR)$(lispdir)/org*.el* $(DESTDIR)$(lispdir)/ob*.el*
> $(DESTDIR)$(lispdir)/ol*.el* $(DESTDIR)$(lispdir)/ox*.el* ; \
> > --
> > 2.34.1
> > From 6d98dfb3d72171e0231823260165b23e8b9963ee Mon Sep 17 00:00:00 2001
> > From: "Pedro A. Aranda" <paag...@gmail.com>
> > Date: Mon, 11 Mar 2024 09:47:12 +0100
> > Subject: [PATCH 1/3] Add cleaneln target
> >
> > * mk/targets.mk: add the 'cleaneln' target
> >
> > ---
> >  mk/targets.mk | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/mk/targets.mk b/mk/targets.mk
> > index de849c4fb..ab9ec2a1f 100644
> > --- a/mk/targets.mk
> > +++ b/mk/targets.mk
> > @@ -143,6 +143,9 @@ cleanall: cleandirs cleantest
> >  $(CLEANDIRS:%=clean%):
> >       -$(FIND) $(@:clean%=%) \( -name \*~ -o -name \*.elc \) -exec $(RM)
> {} +
> >
> > +cleaneln:
> > +     $(MAKE) -C lisp $@
> > +
>
> Should be in .PHONY
>
> > --- a/etc/ORG-NEWS
> > +++ b/etc/ORG-NEWS
> > @@ -11,7 +11,8 @@ See the end of the file for license conditions.
> >
> >  Please send Org bug reports to mailto:emacs-orgmode@gnu.org.
> >
> > -* Version 9.7 (not released yet)
> > +* V
> > +ersion 9.7 (not released yet)
>
> This is a stray newline.
>
> > +*** ~make cleaneln~ will remove the .eln files from the user emacs
> configuration
> > +
> > +Natively compiled Emacs lisp files generated with ~make native~ are
> > +now correctly located and deleted with ~make cleaneln~.
> > +
> >  ** Miscellaneous
> >  *** =org-crypt.el= now applies initial visibility settings to decrypted
> entries
>
> "Add 'native' option to 'make help'" from the previous version of the
> patch still makes sense.
>
> --
> Ihor Radchenko // yantar92,
> Org mode contributor,
> Learn more about Org mode at <https://orgmode.org/>.
> Support Org development at <https://liberapay.com/org-mode>,
> or support my work at <https://liberapay.com/yantar92>
>


-- 
Fragen sind nicht da, um beantwortet zu werden,
Fragen sind da um gestellt zu werden
Georg Kreisler

Headaches with a Juju log:
unit-basic-16: 09:17:36 WARNING juju.worker.uniter.operation we should run
a leader-deposed hook here, but we can't yet
From 52bcbc71c62717e84dd0504ccf37d32668ed3cac Mon Sep 17 00:00:00 2001
From: "Pedro A. Aranda" <paag...@gmail.com>
Date: Wed, 13 Mar 2024 17:41:56 +0100
Subject: [PATCH] Clean eln files from the user emacs eln directory

---
lisp/Makefile: clean .eln files from the directory where the user's natively
compiled files are stored

* Makefile: Add help for =make native=
* lisp/Makefile: Implement =make cleaneln=
* mk/targets.mk: Add =cleaneln= target


 Makefile      | 1 +
 etc/ORG-NEWS  | 7 +++++++
 lisp/Makefile | 9 ++++++++-
 mk/targets.mk | 5 ++++-
 4 files changed, 20 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index f476a3ea7..b3a167ecb 100644
--- a/Makefile
+++ b/Makefile
@@ -27,6 +27,7 @@ help helpall::
 	$(info make all            - ditto)
 	$(info make compile        - build Org ELisp files)
 	$(info make single         - build Org ELisp files, single Emacs per source)
+	$(info make native         - build Org natively compiled Elisp files)
 	$(info make autoloads      - create org-loaddefs.el to load Org in-place)
 	$(info make test           - build Org ELisp files and run test suite)
 	$(info make vanilla        - run Emacs with this Org-mode and no personal config)
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index ca73f06e7..cb8ed9b71 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -1281,6 +1281,13 @@ optional argument =NEW-HEADING-CONTAINER= specifies where in the
 buffer it will be added.  If not specified, new headings are created
 at level 1 at the end of the accessible part of the buffer, as before.

+*** ~make cleaneln~ will remove the .eln files from the user emacs configuration
+
+Natively compiled Emacs lisp files generated with ~make native~ are
+now correctly located and deleted with ~make cleaneln~.
+
+*** Add text for =make native= to ~make help~
+
 ** Miscellaneous
 *** =org-crypt.el= now applies initial visibility settings to decrypted entries

diff --git a/lisp/Makefile b/lisp/Makefile
index c570d9cfa..0186b4246 100644
--- a/lisp/Makefile
+++ b/lisp/Makefile
@@ -11,12 +11,15 @@ LISPF 	:= $(filter-out $(LISPA),$(sort $(wildcard *.el)))
 LISPC 	:= $(filter-out $(LISPB) $(LISPN:%el=%elc),$(LISPF:%el=%elc))
 LISPN 	:= $(filter-out $(LISPB) $(LISPN:%el=%eln),$(LISPF:%el=%eln))
 _ORGCM_ := dirall single native source slint1 slint2
+# This is where Emacs stores the .eln files
+ELNDIR        = $(shell $(EMACS) --batch --eval '(princ (car native-comp-eln-load-path))')
+
 -include local.mk

 .PHONY:	all compile compile-dirty \
 	$(_ORGCM_) $(_ORGCM_:%=compile-%) \
 	autoloads \
-	install clean cleanauto cleanall cleanelc clean-install
+	install clean cleanauto cleanall cleanelc cleaneln clean-install

 # do not clean here, done in toplevel make
 all compile compile-dirty::	 | autoloads
@@ -79,6 +82,10 @@ cleanauto clean cleanall::
 clean cleanall cleanelc::
 	$(RM) *.elc

+cleaneln::
+	@$(foreach elnf,$(patsubst %.eln, %-*.eln, $(LISPN)), \
+	  $(FIND) $(ELNDIR) -name $(elnf) -exec $(RM) -v {} \; ;)
+
 clean-install:
 	if [ -d $(DESTDIR)$(lispdir) ] ; then \
 	  $(RM) $(DESTDIR)$(lispdir)/org*.el* $(DESTDIR)$(lispdir)/ob*.el* $(DESTDIR)$(lispdir)/ol*.el* $(DESTDIR)$(lispdir)/ox*.el* ; \
diff --git a/mk/targets.mk b/mk/targets.mk
index de849c4fb..4ab5fa13c 100644
--- a/mk/targets.mk
+++ b/mk/targets.mk
@@ -31,7 +31,7 @@ endif
 	info html pdf card refcard doc docs \
 	autoloads cleanall clean $(CLEANDIRS:%=clean%) \
 	clean-install cleanelc cleandirs \
-	cleanlisp cleandoc cleandocs cleantest \
+	cleanlisp cleandoc cleandocs cleantest cleaneln \
 	compile compile-dirty uncompiled \
 	config config-test config-exe config-all config-eol config-version \
 	vanilla repro
@@ -143,6 +143,9 @@ cleanall: cleandirs cleantest
 $(CLEANDIRS:%=clean%):
 	-$(FIND) $(@:clean%=%) \( -name \*~ -o -name \*.elc \) -exec $(RM) {} +

+cleaneln:
+	$(MAKE) -C lisp $@
+
 cleanelc:
 	$(MAKE) -C lisp $@

--
2.34.1

Reply via email to