diff options
| author | Jonas Bernoulli <jonas@bernoul.li> | 2015-04-06 15:18:00 +0200 |
|---|---|---|
| committer | Jonas Bernoulli <jonas@bernoul.li> | 2015-04-06 15:18:00 +0200 |
| commit | 0fb98c2c89ce9e94301f7f3b671f255fbc3c3e9a (patch) | |
| tree | 3d805aa4eaffe4f0e796301386984abf17b7f0a8 /Makefile | |
| parent | 2958790e52e134427dbfd4489a439ee5897a2721 (diff) | |
avoid needlessly loading optional libraries
Aside from just not doing that at load-time, there are some additional
requirements to make this work.
* When using `make lisp' to compile outdated libraries, the targets are
first removed. Otherwise compiling e.g. `magit-stash.el' would result
in `magit' to be loaded, which in turn would result in the outdated
`magit-stash.elc' to be loaded and the byte-compiler to complain about
it.
* The name of the loaddefs file has to be hardcoded in `magit.el' as
well as the `Makefile'.
* `magit-maybe-backup', which is called before applying a change, to
create a backup stash, in case `magit-backup-mode' is enabled, as to
be defined outside of `magit-backup.el', because that's one of the
libraries we try to avoid loading. The old `magit-maybe-backup' is
renamed to `magit-backup-maybe', and the new `magit-maybe-backup' just
checks whether the latter is defined and if so calls it. The latter
is still ultimately responsible for deciding whether to backup or not,
and does it exactly as before, there's just an additional redirection
now.
* Many commands that are defined in the delayed libraries were not
autoloaded. It is important that we do that now.
* When the delayed libraries cannot be autoloaded because
`magit-autoloads.el' does not exist, then we have no choice but to
fall back to loading them upfront.
Note that we have to continue to always load certain libraries after
providing `magit'. These are the libraries that define section
inserters which are used by buffers, whose major-modes are not defined
in these libraries themselves.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 20 |
1 files changed, 7 insertions, 13 deletions
@@ -6,9 +6,6 @@ docdir ?= $(datarootdir)/doc/magit statsdir ?= $(HOME)/Repos/magit/page/stats -LOADDEFS_FILE ?= magit-autoloads.el -LOADDEFS_DIR ?= $(lispdir) - ELS = with-editor.el ELS += git-commit.el ELS += git-rebase.el @@ -78,7 +75,7 @@ VERSION=$(shell \ all: lisp docs .PHONY: lisp -lisp: $(ELCS) loaddefs magit-version.el +lisp: $(ELCS) magit-version.el magit-autoloads.el .PHONY: help help: @@ -126,6 +123,8 @@ help: %.elc: %.el @printf "Compiling %s\n" $< @$(BATCH) -eval "(progn\ + (when (file-exists-p \"$@\")\ + (delete-file \"$@\"))\ (setq with-editor-emacsclient-executable nil)\ (fset 'message* (symbol-function 'message))\ (fset 'message (lambda (f &rest a)\ @@ -147,16 +146,13 @@ magit-version.el: @printf ";; End:\n" >> $@ @printf ";;; magit-version.el ends here\n" >> $@ -.PHONY: loaddefs -loaddefs: $(LOADDEFS_FILE) - -$(LOADDEFS_FILE): $(ELS) +magit-autoloads.el: $(ELS) @printf "Generating magit-autoloads.el\n" @$(BATCH) -eval "(progn\ (fset 'message (lambda (&rest _)))\ (setq vc-handled-backends nil)\ (defvar generated-autoload-file nil)\ - (let ((generated-autoload-file \"$(CURDIR)/$(LOADDEFS_FILE)\")\ + (let ((generated-autoload-file \"$(CURDIR)/magit-autoloads.el\")\ (make-backup-files nil))\ (update-directory-autoloads \".\")))" @@ -220,9 +216,7 @@ install: install-lisp install-docs .PHONY: install-lisp install-lisp: lisp $(MKDIR) $(DESTDIR)$(lispdir) - $(CP) $(ELS) $(ELCS) magit-version.el $(DESTDIR)$(lispdir) - $(MKDIR) $(DESTDIR)$(LOADDEFS_DIR) - $(CP) $(LOADDEFS_FILE) $(DESTDIR)$(LOADDEFS_DIR)/$(LOADDEFS_FILE) + $(CP) $(ELS) $(ELCS) magit-autoloads.el magit-version.el $(DESTDIR)$(lispdir) .PHONY: install-docs install-docs: @@ -241,7 +235,7 @@ test-interactive: .PHONY: clean clean: @printf "Cleaning...\n" - @$(RM) $(ELCS) $(LOADDEFS_FILE) magit-version.el *.tar.gz *.tar + @$(RM) $(ELCS) magit-autoloads.el magit-version.el *.tar.gz *.tar @$(RM) dir Documentation/dir Documentation/magit.info @$(RMDIR) magit-$(VERSION) |
