sagemath / sage-shell-mode

Emacs front end for SageMath
GNU General Public License v3.0
98 stars 16 forks source link

Makefile `compile` target trouble #9

Closed johanrosenkilde closed 7 years ago

johanrosenkilde commented 7 years ago

After cloning sage-shell-mode, I get the following error upon typing make:

emacs -Q -eval "(progn (setq byte-compile-delete-errors nil) (setq byte-compile-error-on-warn t))" \
-batch -f batch-byte-compile sage-shell-mode.el

In toplevel form:
sage-shell-mode.el:53:1:Error: Cannot open load file: no such file or directory, deferred
make: *** [Makefile:5: compile] Error 1

I have deferred installed, and calling byte-compile on sage-shell-mode.el from within a normally started Emacs works fine. Am I doing something wrong here?

stakemori commented 7 years ago

make compile exists only for testing. If you just want to try sage-shell-mode and want to install it manually, please add the sage-shell-mode directory to load-path and (require 'sage-shell-mode). If you want to test sage-shell-mode, please install cask (https://github.com/cask/cask). And run cask install and make compile (or make test) inside sage-shell-mode.

johanrosenkilde commented 7 years ago

Thanks for your lightning-speed response. As a long-time unix user, that's fairly surprising behaviour (when I see a Makefile, I type make ;-) ). Perhaps this should be documented on the landing page.

My usual work-flow would be to have a local clone of sage-shell-mode , possibly with a branch with my local mods or something. I would add this dir to load-path and do require, but I'd like the small optimisation of having the package byte-compiled. You're saying I need to use cask to achieve this? Couldn't there just be a convenient make target for this (and why doesn't the current make compile work for that?)

stakemori commented 7 years ago

I will change it another name (make test-compile or something) and add a make target for byte-compiling. Thanks for suggestion. If you would like to extend sage-shell-mode, I would recommend you to use cask. cask is very good for testing.

johanrosenkilde commented 7 years ago

OK, sounds good. I'll take a look at cask :-)

stakemori commented 7 years ago

I renamed compile to test-compile (d54f33b803fa73167ede72e6f76317e5619a4e72). But I could not add a make target for byte-compiling without using cask. In batch mode, Emacs does not load user's init file. The make compile command raise an error because deferred is not found in load-path.

Anyway, if you install cask, then make test-compile byte-compiles sage-shell-mode.el because cask installs dependencies of the package. Of course, you can use M-x byte-compile-file.

johanrosenkilde commented 7 years ago

OK. One possibility is to add (package-initialize) (require 'deferred) to the expression given to the batch Emacs process, I guess?

stakemori commented 7 years ago

@jsrndk, I guess it works for most users. But package-user-dir may be changed in the init file. Also not all Emacs users use package.el. Some of them use el-get or Cask as package management.

johanrosenkilde commented 7 years ago

OK, good points.

The main thing that worries me is someone like me cloning the repo, running make as the first thing and seeing that fail with a weird error message - that's not a good impression. One possibility is to make the default make target just print some message like

$ make

This make file is provided for testing purposes only using Cask.

To use sage-shell-mode from this clone, simply add the following to your Emacs init file: (add-to-list 'load-path "$(PWD)") (require 'sage-shell-mode)

$

stakemori commented 7 years ago

I added make message in 4c39d0a7a4f0415c9957b14f3fc584fb5ca654bf and make it the default goal. Thanks for suggestion.