This page shows a emacs lisp command that execute the current programing language file.
This way is even better than using a interactive command line, because you can write and edit normally with full emacs power. And you can run it by just pressing a key, such as F8.
Here's the solution:
The code is very easy to understand.
Now, we can define a keyboard shortcut for this:
(global-set-key (kbd "<f8>") 'xah-run-current-file)
So now, doesn't matter we are writing in Perl, Python, elisp, …, we can just press a button and have the file executed or compiled.
If you don't have file extension, you might use the current major mode to determine what language it is.
The major mode's name is stored in the variable major-mode.
You also need to redefine your associative list to store major mode names corresponding to program paths.
(thanks to Matic Bojan for suggesting major mode for determining language.)
原文时间: 2015-08-22 03:36
整理时间: 2015-08-23 00:16
本文由 Hick 整理，转载请保留以上信息;
The articles on this site come from Internet, thanks to all the original authors.
If anything about COPYRIGHT, or LEFT, please contact Emacsist at gmail dot com .