Emacs-Lisp: How to package emacs-lisp program as PC application?

随声附和 提交于 2019-12-23 12:07:58

问题


Just wondering if it's possible to package and deploy emacs and Lisp program as PC application such that once downloaded, running setup.exe (kind of), then the user can start application to make emacs run the specific Lisp program as if the application were implemented by other languages and platform, such as .Net, or Python.

With this approach, it would be easier for ordinary users to use the functionality of the Lisp program rather than become a user of emacs, which often takes some learning curve. On the other hand, it would provide some level of protection of the Lisp code for intellectual property.

Of course, one alternative is use some more commercially ready languages/paradigms. But I find that emacs does provide rich functionality that would be pity, if it were not enjoyed by the mass.

Thanks in advance,

Yu Shen


回答1:


There really isn't a good way of doing this. Emacs is simply not set up to work as a "runtime" for easy redistribution.

What you could do is compile a version of Emacs, strip away as much as you wanted from the install (either C features or Elisp libraries), byte-compile the code you want to distribute, throw all of that in an archive (or setup.exe) and distribute that.

To byte-compile multiple files, you can run

$ emacs -batch -f batch-byte-compile files...

Once you have your libraries together, you can have emacs run a particular command on startup with:

$ emacs -f function

You can also load additional elisp files with the -l file switch.

Unless you are really wed to Emacs, I suggest you use a different dialect of Lisp, one that is more suited for redistribution of stand-alone programs.




回答2:


For exacs lisp you can run any of the ELisp programs as a script run using the -script option, so you can package up for any platform as you describe.

For example, you could use WINRAR to unzip Emacs and the scripts onto a Windows machine you wish to install to and then set a WinRar option to run your program as a script. This way you will have a .exe file the user clicks on and your Emacs program will be installed asnd run.



来源:https://stackoverflow.com/questions/1166112/emacs-lisp-how-to-package-emacs-lisp-program-as-pc-application

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!