From 52bcbc71c62717e84dd0504ccf37d32668ed3cac Mon Sep 17 00:00:00 2001 From: "Pedro A. Aranda" 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